source: rtems/cpukit/score/cpu/nios2/nios2-context-switch.S @ 19acb3b

Last change on this file since 19acb3b was 9165349d, checked in by Sebastian Huber <sebastian.huber@…>, on 01/12/21 at 06:13:08

nios2: Use Per_CPU_Control::isr_dispatch_disable

  • Property mode set to 100644
File size: 1.9 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.org/license/LICENSE.
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/score/percpu.h>
19#include <rtems/score/nios2-utility.h>
20
21        .extern _Per_CPU_Information
22
23        .globl  _CPU_Context_switch
24        .globl  _CPU_Context_restore
25
26_CPU_Context_switch:
27
28        ldw     r9, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
29        rdctl   r8, status
30        stw     r16, NIOS2_CONTEXT_OFFSET_R16(r4)
31        stw     r17, NIOS2_CONTEXT_OFFSET_R17(r4)
32        stw     r18, NIOS2_CONTEXT_OFFSET_R18(r4)
33        stw     r19, NIOS2_CONTEXT_OFFSET_R19(r4)
34        stw     r20, NIOS2_CONTEXT_OFFSET_R20(r4)
35        stw     r21, NIOS2_CONTEXT_OFFSET_R21(r4)
36        stw     r22, NIOS2_CONTEXT_OFFSET_R22(r4)
37        stw     r23, NIOS2_CONTEXT_OFFSET_R23(r4)
38        stw     fp, NIOS2_CONTEXT_OFFSET_FP(r4)
39        stw     r8, NIOS2_CONTEXT_OFFSET_STATUS(r4)
40        stw     sp, NIOS2_CONTEXT_OFFSET_SP(r4)
41        stw     ra, NIOS2_CONTEXT_OFFSET_RA(r4)
42        stw     r9, NIOS2_CONTEXT_OFFSET_ISR_DISPATCH_DISABLE(r4)
43
44restore:
45
46        ldw     r10, NIOS2_CONTEXT_OFFSET_ISR_DISPATCH_DISABLE(r5)
47        ldw     r16, NIOS2_CONTEXT_OFFSET_R16(r5)
48        ldw     r17, NIOS2_CONTEXT_OFFSET_R17(r5)
49        ldw     r18, NIOS2_CONTEXT_OFFSET_R18(r5)
50        ldw     r19, NIOS2_CONTEXT_OFFSET_R19(r5)
51        ldw     r20, NIOS2_CONTEXT_OFFSET_R20(r5)
52        ldw     r21, NIOS2_CONTEXT_OFFSET_R21(r5)
53        ldw     r22, NIOS2_CONTEXT_OFFSET_R22(r5)
54        ldw     r23, NIOS2_CONTEXT_OFFSET_R23(r5)
55        ldw     fp, NIOS2_CONTEXT_OFFSET_FP(r5)
56        stw     r10, %gprel(_Per_CPU_Information + PER_CPU_ISR_DISPATCH_DISABLE)(gp)
57        ldw     r11, NIOS2_CONTEXT_OFFSET_STATUS(r5)
58        ldw     sp, NIOS2_CONTEXT_OFFSET_SP(r5)
59        ldw     ra, NIOS2_CONTEXT_OFFSET_RA(r5)
60        wrctl   status, r11
61
62        ret
63
64_CPU_Context_restore:
65
66        mov     r5, r4
67        br      restore
Note: See TracBrowser for help on using the repository browser.