summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/nios2/nios2-context-switch.S
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-01 15:52:12 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-01 15:52:12 +0000
commite2d0c6833eeab2bb9b5d9e6fabfdf0689042fb90 (patch)
treef3764f435117a16fd409a88b24788324c7c0a39c /cpukit/score/cpu/nios2/nios2-context-switch.S
parentRemove. (diff)
downloadrtems-e2d0c6833eeab2bb9b5d9e6fabfdf0689042fb90.tar.bz2
2011-09-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* cpu.c, cpu_asm.S: Removed files. * nios2-context-initialize.c, nios2-context-switch.S, nios2-fatal-halt.c, nios2-initialize-vectors.c, nios2-initialize.c, nios2-isr-get-level.c, nios2-isr-install-raw-handler.c, nios2-isr-install-vector.c, nios2-isr-is-in-progress.c, nios2-isr-set-level.c, nios2-thread-dispatch-disabled.c, rtems/score/nios2-utility.h: New files. * Makefile.am, preinstall.am: Reflect changes above. * irq.c: Update due to API changes. * rtems/score/cpu.h: New functions _CPU_Initialize_vectors(), _CPU_ISR_Set_level(), and _CPU_Fatal_halt() (instead of macros). Support for external interrupt controller (EIC). Documentation changes.
Diffstat (limited to 'cpukit/score/cpu/nios2/nios2-context-switch.S')
-rw-r--r--cpukit/score/cpu/nios2/nios2-context-switch.S71
1 files changed, 71 insertions, 0 deletions
diff --git a/cpukit/score/cpu/nios2/nios2-context-switch.S b/cpukit/score/cpu/nios2/nios2-context-switch.S
new file mode 100644
index 0000000000..bf6b836f6b
--- /dev/null
+++ b/cpukit/score/cpu/nios2/nios2-context-switch.S
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2011 embedded brains GmbH
+ *
+ * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
+ *
+ * Derived from no_cpu/cpu_asm.S, copyright (c) 1989-1999,
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+#include <rtems/score/nios2-utility.h>
+
+ .extern _Nios2_Thread_dispatch_disabled
+
+ .globl _CPU_Context_switch
+ .globl _CPU_Context_restore
+
+_CPU_Context_switch:
+
+ movhi r12, %hiadj(_Nios2_Thread_dispatch_disabled)
+ addi r12, r12, %lo(_Nios2_Thread_dispatch_disabled)
+ ldw r9, 0(r12)
+ rdctl r8, status
+ stw r16, NIOS2_CONTEXT_OFFSET_R16(r4)
+ stw r17, NIOS2_CONTEXT_OFFSET_R17(r4)
+ stw r18, NIOS2_CONTEXT_OFFSET_R18(r4)
+ stw r19, NIOS2_CONTEXT_OFFSET_R19(r4)
+ stw r20, NIOS2_CONTEXT_OFFSET_R20(r4)
+ stw r21, NIOS2_CONTEXT_OFFSET_R21(r4)
+ stw r22, NIOS2_CONTEXT_OFFSET_R22(r4)
+ stw r23, NIOS2_CONTEXT_OFFSET_R23(r4)
+ stw fp, NIOS2_CONTEXT_OFFSET_FP(r4)
+ stw r8, NIOS2_CONTEXT_OFFSET_STATUS(r4)
+ stw sp, NIOS2_CONTEXT_OFFSET_SP(r4)
+ stw ra, NIOS2_CONTEXT_OFFSET_RA(r4)
+ stw r9, NIOS2_CONTEXT_OFFSET_TDD(r4)
+
+restore:
+
+ ldw r10, NIOS2_CONTEXT_OFFSET_TDD(r5)
+ ldw r16, NIOS2_CONTEXT_OFFSET_R16(r5)
+ ldw r17, NIOS2_CONTEXT_OFFSET_R17(r5)
+ ldw r18, NIOS2_CONTEXT_OFFSET_R18(r5)
+ ldw r19, NIOS2_CONTEXT_OFFSET_R19(r5)
+ ldw r20, NIOS2_CONTEXT_OFFSET_R20(r5)
+ ldw r21, NIOS2_CONTEXT_OFFSET_R21(r5)
+ ldw r22, NIOS2_CONTEXT_OFFSET_R22(r5)
+ ldw r23, NIOS2_CONTEXT_OFFSET_R23(r5)
+ ldw fp, NIOS2_CONTEXT_OFFSET_FP(r5)
+ stw r10, 0(r12)
+ ldw r11, NIOS2_CONTEXT_OFFSET_STATUS(r5)
+ ldw sp, NIOS2_CONTEXT_OFFSET_SP(r5)
+ ldw ra, NIOS2_CONTEXT_OFFSET_RA(r5)
+ wrctl status, r11
+
+ ret
+
+_CPU_Context_restore:
+
+ mov r5, r4
+ br restore