source: rtems/cpukit/score/cpu/nios2/nios2-context-switch.S @ 80cf60e

5
Last change on this file since 80cf60e was 80cf60e, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 15, 2020 at 7:48:32 AM

Canonicalize config.h include

Use the following variant which was already used by most source files:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

  • 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.org/license/LICENSE.
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include <rtems/score/cpu.h>
19#include <rtems/score/nios2-utility.h>
20
21        .extern _Nios2_Thread_dispatch_disabled
22
23        .globl  _CPU_Context_switch
24        .globl  _CPU_Context_restore
25
26_CPU_Context_switch:
27
28        ldw     r9, %gprel(_Nios2_Thread_dispatch_disabled)(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_THREAD_DISPATCH_DISABLED(r4)
43
44restore:
45
46        ldw     r10, NIOS2_CONTEXT_OFFSET_THREAD_DISPATCH_DISABLED(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(_Nios2_Thread_dispatch_disabled)(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.