~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/nios2/include/asm/entry.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
  3  * Copyright (C) 2004 Microtronix Datacom Ltd.
  4  *
  5  * This file is subject to the terms and conditions of the GNU General Public
  6  * License. See the file "COPYING" in the main directory of this archive
  7  * for more details.
  8  */
  9 
 10 #ifndef _ASM_NIOS2_ENTRY_H
 11 #define _ASM_NIOS2_ENTRY_H
 12 
 13 #ifdef __ASSEMBLY__
 14 
 15 #include <asm/processor.h>
 16 #include <asm/registers.h>
 17 #include <asm/asm-offsets.h>
 18 
 19 /*
 20  * Standard Nios2 interrupt entry and exit macros.
 21  * Must be called with interrupts disabled.
 22  */
 23 .macro SAVE_ALL
 24         rdctl   r24, estatus
 25         andi    r24, r24, ESTATUS_EU
 26         beq     r24, r0, 1f /* In supervisor mode, already on kernel stack */
 27 
 28         movia   r24, _current_thread    /* Switch to current kernel stack */
 29         ldw     r24, 0(r24)             /* using the thread_info */
 30         addi    r24, r24, THREAD_SIZE-PT_REGS_SIZE
 31         stw     sp, PT_SP(r24)          /* Save user stack before changing */
 32         mov     sp, r24
 33         br      2f
 34 
 35 1 :     mov     r24, sp
 36         addi    sp, sp, -PT_REGS_SIZE   /* Backup the kernel stack pointer */
 37         stw     r24, PT_SP(sp)
 38 2 :     stw     r1, PT_R1(sp)
 39         stw     r2, PT_R2(sp)
 40         stw     r3, PT_R3(sp)
 41         stw     r4, PT_R4(sp)
 42         stw     r5, PT_R5(sp)
 43         stw     r6, PT_R6(sp)
 44         stw     r7, PT_R7(sp)
 45         stw     r8, PT_R8(sp)
 46         stw     r9, PT_R9(sp)
 47         stw     r10, PT_R10(sp)
 48         stw     r11, PT_R11(sp)
 49         stw     r12, PT_R12(sp)
 50         stw     r13, PT_R13(sp)
 51         stw     r14, PT_R14(sp)
 52         stw     r15, PT_R15(sp)
 53         movi    r24, -1
 54         stw     r24, PT_ORIG_R2(sp)
 55         stw     r7, PT_ORIG_R7(sp)
 56 
 57         stw     ra, PT_RA(sp)
 58         stw     fp, PT_FP(sp)
 59         stw     gp, PT_GP(sp)
 60         rdctl   r24, estatus
 61         stw     r24, PT_ESTATUS(sp)
 62         stw     ea, PT_EA(sp)
 63 .endm
 64 
 65 .macro RESTORE_ALL
 66         ldw     r1, PT_R1(sp)           /* Restore registers */
 67         ldw     r2, PT_R2(sp)
 68         ldw     r3, PT_R3(sp)
 69         ldw     r4, PT_R4(sp)
 70         ldw     r5, PT_R5(sp)
 71         ldw     r6, PT_R6(sp)
 72         ldw     r7, PT_R7(sp)
 73         ldw     r8, PT_R8(sp)
 74         ldw     r9, PT_R9(sp)
 75         ldw     r10, PT_R10(sp)
 76         ldw     r11, PT_R11(sp)
 77         ldw     r12, PT_R12(sp)
 78         ldw     r13, PT_R13(sp)
 79         ldw     r14, PT_R14(sp)
 80         ldw     r15, PT_R15(sp)
 81         ldw     ra, PT_RA(sp)
 82         ldw     fp, PT_FP(sp)
 83         ldw     gp, PT_GP(sp)
 84         ldw     r24, PT_ESTATUS(sp)
 85         wrctl   estatus, r24
 86         ldw     ea, PT_EA(sp)
 87         ldw     sp, PT_SP(sp)           /* Restore sp last */
 88 .endm
 89 
 90 .macro  SAVE_SWITCH_STACK
 91         addi    sp, sp, -SWITCH_STACK_SIZE
 92         stw     r16, SW_R16(sp)
 93         stw     r17, SW_R17(sp)
 94         stw     r18, SW_R18(sp)
 95         stw     r19, SW_R19(sp)
 96         stw     r20, SW_R20(sp)
 97         stw     r21, SW_R21(sp)
 98         stw     r22, SW_R22(sp)
 99         stw     r23, SW_R23(sp)
100         stw     fp, SW_FP(sp)
101         stw     gp, SW_GP(sp)
102         stw     ra, SW_RA(sp)
103 .endm
104 
105 .macro  RESTORE_SWITCH_STACK
106         ldw     r16, SW_R16(sp)
107         ldw     r17, SW_R17(sp)
108         ldw     r18, SW_R18(sp)
109         ldw     r19, SW_R19(sp)
110         ldw     r20, SW_R20(sp)
111         ldw     r21, SW_R21(sp)
112         ldw     r22, SW_R22(sp)
113         ldw     r23, SW_R23(sp)
114         ldw     fp, SW_FP(sp)
115         ldw     gp, SW_GP(sp)
116         ldw     ra, SW_RA(sp)
117         addi    sp, sp, SWITCH_STACK_SIZE
118 .endm
119 
120 #endif /* __ASSEMBLY__ */
121 #endif /* _ASM_NIOS2_ENTRY_H */
122 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php