source: rtems/cpukit/score/cpu/nios2/nios2-context-switch.S @ 900d9e66

4.115
Last change on this file since 900d9e66 was e2d0c68, checked in by Sebastian Huber <sebastian.huber@…>, on 09/01/11 at 15:52:12

2011-09-01 Sebastian Huber <sebastian.huber@…>

  • 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.
  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
2 * Copyright (c) 2011 embedded brains GmbH
3 *
4 * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de)
5 *
6 * Derived from no_cpu/cpu_asm.S, copyright (c) 1989-1999,
7 *   On-Line Applications Research Corporation (OAR).
8 *
9 * The license and distribution terms for this file may be
10 * found in the file LICENSE in this distribution or at
11 * http://www.rtems.com/license/LICENSE.
12 *
13 * $Id$
14 */
15
16#ifdef HAVE_CONFIG_H
17  #include "config.h"
18#endif
19
20#include <rtems/score/cpu.h>
21#include <rtems/score/nios2-utility.h>
22
23        .extern _Nios2_Thread_dispatch_disabled
24
25        .globl  _CPU_Context_switch
26        .globl  _CPU_Context_restore
27
28_CPU_Context_switch:
29
30        movhi   r12, %hiadj(_Nios2_Thread_dispatch_disabled)
31        addi    r12, r12, %lo(_Nios2_Thread_dispatch_disabled)
32        ldw     r9, 0(r12)
33        rdctl   r8, status
34        stw     r16, NIOS2_CONTEXT_OFFSET_R16(r4)
35        stw     r17, NIOS2_CONTEXT_OFFSET_R17(r4)
36        stw     r18, NIOS2_CONTEXT_OFFSET_R18(r4)
37        stw     r19, NIOS2_CONTEXT_OFFSET_R19(r4)
38        stw     r20, NIOS2_CONTEXT_OFFSET_R20(r4)
39        stw     r21, NIOS2_CONTEXT_OFFSET_R21(r4)
40        stw     r22, NIOS2_CONTEXT_OFFSET_R22(r4)
41        stw     r23, NIOS2_CONTEXT_OFFSET_R23(r4)
42        stw     fp, NIOS2_CONTEXT_OFFSET_FP(r4)
43        stw     r8, NIOS2_CONTEXT_OFFSET_STATUS(r4)
44        stw     sp, NIOS2_CONTEXT_OFFSET_SP(r4)
45        stw     ra, NIOS2_CONTEXT_OFFSET_RA(r4)
46        stw     r9, NIOS2_CONTEXT_OFFSET_TDD(r4)
47
48restore:
49
50        ldw     r10, NIOS2_CONTEXT_OFFSET_TDD(r5)
51        ldw     r16, NIOS2_CONTEXT_OFFSET_R16(r5)
52        ldw     r17, NIOS2_CONTEXT_OFFSET_R17(r5)
53        ldw     r18, NIOS2_CONTEXT_OFFSET_R18(r5)
54        ldw     r19, NIOS2_CONTEXT_OFFSET_R19(r5)
55        ldw     r20, NIOS2_CONTEXT_OFFSET_R20(r5)
56        ldw     r21, NIOS2_CONTEXT_OFFSET_R21(r5)
57        ldw     r22, NIOS2_CONTEXT_OFFSET_R22(r5)
58        ldw     r23, NIOS2_CONTEXT_OFFSET_R23(r5)
59        ldw     fp, NIOS2_CONTEXT_OFFSET_FP(r5)
60        stw     r10, 0(r12)
61        ldw     r11, NIOS2_CONTEXT_OFFSET_STATUS(r5)
62        ldw     sp, NIOS2_CONTEXT_OFFSET_SP(r5)
63        ldw     ra, NIOS2_CONTEXT_OFFSET_RA(r5)
64        wrctl   status, r11
65
66        ret
67
68_CPU_Context_restore:
69
70        mov     r5, r4
71        br      restore
Note: See TracBrowser for help on using the repository browser.