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

TOMOYO Linux Cross Reference
Linux/arch/nios2/kernel/entry.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/nios2/kernel/entry.S (Version linux-6.12-rc7) and /arch/alpha/kernel/entry.S (Version linux-3.10.108)


  1 /*                                                  1 /*
  2  * linux/arch/nios2/kernel/entry.S             !!   2  * arch/alpha/kernel/entry.S
  3  *                                                  3  *
  4  * Copyright (C) 2013-2014  Altera Corporation !!   4  * Kernel entry-points.
  5  * Copyright (C) 2009, Wind River Systems Inc  << 
  6  *                                             << 
  7  * Implemented by fredrik.markstrom@gmail.com  << 
  8  *                                             << 
  9  *  Copyright (C) 1999-2002, Greg Ungerer (ger << 
 10  *  Copyright (C) 1998  D. Jeff Dionne <jeff@li << 
 11  *                      Kenneth Albanowski <kja << 
 12  *  Copyright (C) 2000  Lineo Inc. (www.lineo. << 
 13  *  Copyright (C) 2004  Microtronix Datacom Lt << 
 14  *                                             << 
 15  * This file is subject to the terms and condi << 
 16  * License.  See the file "COPYING" in the mai << 
 17  * for more details.                           << 
 18  *                                             << 
 19  * Linux/m68k support by Hamish Macdonald      << 
 20  *                                             << 
 21  * 68060 fixes by Jesper Skov                  << 
 22  * ColdFire support by Greg Ungerer (gerg@snap << 
 23  * 5307 fixes by David W. Miller               << 
 24  * linux 2.4 support David McCullough <davidm@s << 
 25  */                                                 5  */
 26                                                     6 
 27 #include <linux/sys.h>                         << 
 28 #include <linux/linkage.h>                     << 
 29 #include <asm/asm-offsets.h>                        7 #include <asm/asm-offsets.h>
 30 #include <asm/asm-macros.h>                    << 
 31 #include <asm/thread_info.h>                        8 #include <asm/thread_info.h>
                                                   >>   9 #include <asm/pal.h>
 32 #include <asm/errno.h>                             10 #include <asm/errno.h>
 33 #include <asm/setup.h>                         << 
 34 #include <asm/entry.h>                         << 
 35 #include <asm/unistd.h>                            11 #include <asm/unistd.h>
 36 #include <asm/processor.h>                     << 
 37                                                    12 
 38 .macro GET_THREAD_INFO reg                     !!  13         .text
 39 .if THREAD_SIZE & 0xffff0000                   !!  14         .set noat
 40         andhi   \reg, sp, %hi(~(THREAD_SIZE-1) << 
 41 .else                                          << 
 42         addi    \reg, r0, %lo(~(THREAD_SIZE-1) << 
 43         and     \reg, \reg, sp                 << 
 44 .endif                                         << 
 45 .endm                                          << 
 46                                                    15 
 47 .macro  kuser_cmpxchg_check                    !!  16 /* Stack offsets.  */
 48         /*                                     !!  17 #define SP_OFF                  184
 49          * Make sure our user space atomic hel !!  18 #define SWITCH_STACK_SIZE       320
 50          * interrupted in a critical region.   << 
 51          * ea-4 = address of interrupted insn  << 
 52          * sp = saved regs.                    << 
 53          * cmpxchg_ldw = first critical insn,  << 
 54          * If ea <= cmpxchg_stw and ea > cmpxc << 
 55          * cmpxchg_ldw + 4.                    << 
 56         */                                     << 
 57         /* et = cmpxchg_stw + 4 */             << 
 58         movui   et, (KUSER_BASE + 4 + (cmpxchg << 
 59         bgtu    ea, et, 1f                     << 
 60                                                << 
 61         subi    et, et, (cmpxchg_stw - cmpxchg << 
 62         bltu    ea, et, 1f                     << 
 63         stw     et, PT_EA(sp)   /* fix up EA * << 
 64         mov     ea, et                         << 
 65 1:                                             << 
 66 .endm                                          << 
 67                                                    19 
 68 .section .rodata                               !!  20 /*
 69 .align 4                                       !!  21  * This defines the normal kernel pt-regs layout.
 70 exception_table:                               !!  22  *
 71         .word unhandled_exception       /* 0 - !!  23  * regs 9-15 preserved by C code
 72         .word unhandled_exception       /* 1 - !!  24  * regs 16-18 saved by PAL-code
 73         .word external_interrupt        /* 2 - !!  25  * regs 29-30 saved and set up by PAL-code
 74         .word handle_trap               /* 3 - !!  26  * JRP - Save regs 16-18 in a special area of the stack, so that
 75                                                !!  27  * the palcode-provided values are available to the signal handler.
 76         .word instruction_trap          /* 4 - !!  28  */
 77         .word handle_illegal            /* 5 - << 
 78         .word handle_unaligned          /* 6 - << 
 79         .word handle_unaligned          /* 7 - << 
 80                                                << 
 81         .word handle_diverror           /* 8 - << 
 82         .word protection_exception_ba   /* 9 - << 
 83         .word protection_exception_instr /* 10 << 
 84         .word protection_exception_ba   /* 11  << 
 85                                                << 
 86         .word unhandled_exception       /* 12  << 
 87         .word protection_exception_pte  /* 13  << 
 88         .word protection_exception_pte  /* 14  << 
 89         .word protection_exception_pte  /* 15  << 
 90                                                << 
 91         .word unhandled_exception       /* 16  << 
 92                                                << 
 93 trap_table:                                    << 
 94         .word   handle_system_call      /* 0   << 
 95         .word   handle_trap_1           /* 1   << 
 96         .word   handle_trap_2           /* 2   << 
 97         .word   handle_trap_3           /* 3   << 
 98         .word   handle_trap_reserved    /* 4   << 
 99         .word   handle_trap_reserved    /* 5   << 
100         .word   handle_trap_reserved    /* 6   << 
101         .word   handle_trap_reserved    /* 7   << 
102         .word   handle_trap_reserved    /* 8   << 
103         .word   handle_trap_reserved    /* 9   << 
104         .word   handle_trap_reserved    /* 10  << 
105         .word   handle_trap_reserved    /* 11  << 
106         .word   handle_trap_reserved    /* 12  << 
107         .word   handle_trap_reserved    /* 13  << 
108         .word   handle_trap_reserved    /* 14  << 
109         .word   handle_trap_reserved    /* 15  << 
110         .word   handle_trap_reserved    /* 16  << 
111         .word   handle_trap_reserved    /* 17  << 
112         .word   handle_trap_reserved    /* 18  << 
113         .word   handle_trap_reserved    /* 19  << 
114         .word   handle_trap_reserved    /* 20  << 
115         .word   handle_trap_reserved    /* 21  << 
116         .word   handle_trap_reserved    /* 22  << 
117         .word   handle_trap_reserved    /* 23  << 
118         .word   handle_trap_reserved    /* 24  << 
119         .word   handle_trap_reserved    /* 25  << 
120         .word   handle_trap_reserved    /* 26  << 
121         .word   handle_trap_reserved    /* 27  << 
122         .word   handle_trap_reserved    /* 28  << 
123         .word   handle_trap_reserved    /* 29  << 
124 #ifdef CONFIG_KGDB                             << 
125         .word   handle_kgdb_breakpoint  /* 30  << 
126 #else                                          << 
127         .word   instruction_trap               << 
128 #endif                                         << 
129         .word   handle_breakpoint       /* 31  << 
130                                                << 
131 .text                                          << 
132 .set noat                                      << 
133 .set nobreak                                   << 
134                                                    29 
135 ENTRY(inthandler)                              !!  30 #define SAVE_ALL                        \
136         SAVE_ALL                               !!  31         subq    $sp, SP_OFF, $sp;       \
                                                   >>  32         stq     $0, 0($sp);             \
                                                   >>  33         stq     $1, 8($sp);             \
                                                   >>  34         stq     $2, 16($sp);            \
                                                   >>  35         stq     $3, 24($sp);            \
                                                   >>  36         stq     $4, 32($sp);            \
                                                   >>  37         stq     $28, 144($sp);          \
                                                   >>  38         lda     $2, alpha_mv;           \
                                                   >>  39         stq     $5, 40($sp);            \
                                                   >>  40         stq     $6, 48($sp);            \
                                                   >>  41         stq     $7, 56($sp);            \
                                                   >>  42         stq     $8, 64($sp);            \
                                                   >>  43         stq     $19, 72($sp);           \
                                                   >>  44         stq     $20, 80($sp);           \
                                                   >>  45         stq     $21, 88($sp);           \
                                                   >>  46         ldq     $2, HAE_CACHE($2);      \
                                                   >>  47         stq     $22, 96($sp);           \
                                                   >>  48         stq     $23, 104($sp);          \
                                                   >>  49         stq     $24, 112($sp);          \
                                                   >>  50         stq     $25, 120($sp);          \
                                                   >>  51         stq     $26, 128($sp);          \
                                                   >>  52         stq     $27, 136($sp);          \
                                                   >>  53         stq     $2, 152($sp);           \
                                                   >>  54         stq     $16, 160($sp);          \
                                                   >>  55         stq     $17, 168($sp);          \
                                                   >>  56         stq     $18, 176($sp)
                                                   >>  57 
                                                   >>  58 #define RESTORE_ALL                     \
                                                   >>  59         lda     $19, alpha_mv;          \
                                                   >>  60         ldq     $0, 0($sp);             \
                                                   >>  61         ldq     $1, 8($sp);             \
                                                   >>  62         ldq     $2, 16($sp);            \
                                                   >>  63         ldq     $3, 24($sp);            \
                                                   >>  64         ldq     $21, 152($sp);          \
                                                   >>  65         ldq     $20, HAE_CACHE($19);    \
                                                   >>  66         ldq     $4, 32($sp);            \
                                                   >>  67         ldq     $5, 40($sp);            \
                                                   >>  68         ldq     $6, 48($sp);            \
                                                   >>  69         ldq     $7, 56($sp);            \
                                                   >>  70         subq    $20, $21, $20;          \
                                                   >>  71         ldq     $8, 64($sp);            \
                                                   >>  72         beq     $20, 99f;               \
                                                   >>  73         ldq     $20, HAE_REG($19);      \
                                                   >>  74         stq     $21, HAE_CACHE($19);    \
                                                   >>  75         stq     $21, 0($20);            \
                                                   >>  76 99:;                                    \
                                                   >>  77         ldq     $19, 72($sp);           \
                                                   >>  78         ldq     $20, 80($sp);           \
                                                   >>  79         ldq     $21, 88($sp);           \
                                                   >>  80         ldq     $22, 96($sp);           \
                                                   >>  81         ldq     $23, 104($sp);          \
                                                   >>  82         ldq     $24, 112($sp);          \
                                                   >>  83         ldq     $25, 120($sp);          \
                                                   >>  84         ldq     $26, 128($sp);          \
                                                   >>  85         ldq     $27, 136($sp);          \
                                                   >>  86         ldq     $28, 144($sp);          \
                                                   >>  87         addq    $sp, SP_OFF, $sp
137                                                    88 
138         kuser_cmpxchg_check                    !!  89 /*
                                                   >>  90  * Non-syscall kernel entry points.
                                                   >>  91  */
139                                                    92 
140         /* Clear EH bit before we get a new ex !!  93         .align  4
141          * and after we have saved it to the e !!  94         .globl  entInt
142          * whether it's trap, tlb-miss or inte !!  95         .ent    entInt
143          * estatus is not updated the next exc !!  96 entInt:
144          */                                    !!  97         SAVE_ALL
145         rdctl   r24, status                    !!  98         lda     $8, 0x3fff
146         movi    r9, %lo(~STATUS_EH)            !!  99         lda     $26, ret_from_sys_call
147         and     r24, r24, r9                   !! 100         bic     $sp, $8, $8
148         wrctl   status, r24                    !! 101         mov     $sp, $19
149                                                !! 102         jsr     $31, do_entInt
150         /* Read cause and vector and branch to !! 103 .end entInt
151         mov     r4, sp                         !! 104 
152         rdctl   r5, exception                  !! 105         .align  4
153         movia   r9, exception_table            !! 106         .globl  entArith
154         add     r24, r9, r5                    !! 107         .ent    entArith
155         ldw     r24, 0(r24)                    !! 108 entArith:
156         jmp     r24                            !! 109         SAVE_ALL
157                                                !! 110         lda     $8, 0x3fff
158                                                !! 111         lda     $26, ret_from_sys_call
159 /********************************************* !! 112         bic     $sp, $8, $8
160  * Handle traps                                !! 113         mov     $sp, $18
161  ********************************************* !! 114         jsr     $31, do_entArith
162  */                                            !! 115 .end entArith
163 ENTRY(handle_trap)                             !! 116 
164         ldwio   r24, -4(ea)     /* instruction !! 117         .align  4
165         srli    r24, r24, 4                    !! 118         .globl  entMM
166         andi    r24, r24, 0x7c                 !! 119         .ent    entMM
167         movia   r9,trap_table                  !! 120 entMM:
168         add     r24, r24, r9                   !! 121         SAVE_ALL
169         ldw     r24, 0(r24)                    !! 122 /* save $9 - $15 so the inline exception code can manipulate them.  */
170         jmp     r24                            !! 123         subq    $sp, 56, $sp
171                                                !! 124         stq     $9, 0($sp)
172                                                !! 125         stq     $10, 8($sp)
173 /********************************************* !! 126         stq     $11, 16($sp)
174  * Handle system calls                         !! 127         stq     $12, 24($sp)
175  ********************************************* !! 128         stq     $13, 32($sp)
176  */                                            !! 129         stq     $14, 40($sp)
177 ENTRY(handle_system_call)                      !! 130         stq     $15, 48($sp)
178         /* Enable interrupts */                !! 131         addq    $sp, 56, $19
179         rdctl   r10, status                    !! 132 /* handle the fault */
180         ori     r10, r10, STATUS_PIE           !! 133         lda     $8, 0x3fff
181         wrctl   status, r10                    !! 134         bic     $sp, $8, $8
182                                                !! 135         jsr     $26, do_page_fault
183         /* Reload registers destroyed by commo !! 136 /* reload the registers after the exception code played.  */
184         ldw     r4, PT_R4(sp)                  !! 137         ldq     $9, 0($sp)
185         ldw     r5, PT_R5(sp)                  !! 138         ldq     $10, 8($sp)
186                                                !! 139         ldq     $11, 16($sp)
187 local_restart:                                 !! 140         ldq     $12, 24($sp)
188         stw     r2, PT_ORIG_R2(sp)             !! 141         ldq     $13, 32($sp)
189         /* Check that the requested system cal !! 142         ldq     $14, 40($sp)
190         movui   r1, __NR_syscalls              !! 143         ldq     $15, 48($sp)
191         bgeu    r2, r1, ret_invsyscall         !! 144         addq    $sp, 56, $sp
192         slli    r1, r2, 2                      !! 145 /* finish up the syscall as normal.  */
193         movhi   r11, %hiadj(sys_call_table)    !! 146         br      ret_from_sys_call
194         add     r1, r1, r11                    !! 147 .end entMM
195         ldw     r1, %lo(sys_call_table)(r1)    !! 148 
196                                                !! 149         .align  4
197         /* Check if we are being traced */     !! 150         .globl  entIF
198         GET_THREAD_INFO r11                    !! 151         .ent    entIF
199         ldw     r11,TI_FLAGS(r11)              !! 152 entIF:
200         BTBNZ   r11,r11,TIF_SYSCALL_TRACE,trac !! 153         SAVE_ALL
201                                                !! 154         lda     $8, 0x3fff
202         /* Execute the system call */          !! 155         lda     $26, ret_from_sys_call
203         callr   r1                             !! 156         bic     $sp, $8, $8
204                                                !! 157         mov     $sp, $17
205         /* If the syscall returns a negative r !! 158         jsr     $31, do_entIF
206          *   Set r7 to 1 to indicate error,    !! 159 .end entIF
207          *   Negate r2 to get a positive error !! 160 
208          * If the syscall returns zero or a po !! 161         .align  4
209          *   Set r7 to 0.                      !! 162         .globl  entUna
210          * The sigreturn system calls will ski !! 163         .ent    entUna
211          * adding to register ra. To avoid des !! 164 entUna:
212          */                                    !! 165         lda     $sp, -256($sp)
213 translate_rc_and_ret:                          !! 166         stq     $0, 0($sp)
214         movi    r1, 0                          !! 167         ldq     $0, 256($sp)    /* get PS */
215         bge     r2, zero, 3f                   !! 168         stq     $1, 8($sp)
216         ldw     r1, PT_ORIG_R2(sp)             !! 169         stq     $2, 16($sp)
217         addi    r1, r1, 1                      !! 170         stq     $3, 24($sp)
218         beq     r1, zero, 3f                   !! 171         and     $0, 8, $0               /* user mode? */
219         sub     r2, zero, r2                   !! 172         stq     $4, 32($sp)
220         movi    r1, 1                          !! 173         bne     $0, entUnaUser  /* yup -> do user-level unaligned fault */
221 3:                                             !! 174         stq     $5, 40($sp)
222         stw     r2, PT_R2(sp)                  !! 175         stq     $6, 48($sp)
223         stw     r1, PT_R7(sp)                  !! 176         stq     $7, 56($sp)
224 end_translate_rc_and_ret:                      !! 177         stq     $8, 64($sp)
225                                                !! 178         stq     $9, 72($sp)
226 ret_from_exception:                            !! 179         stq     $10, 80($sp)
227         ldw     r1, PT_ESTATUS(sp)             !! 180         stq     $11, 88($sp)
228         /* if so, skip resched, signals */     !! 181         stq     $12, 96($sp)
229         TSTBNZ  r1, r1, ESTATUS_EU, Luser_retu !! 182         stq     $13, 104($sp)
                                                   >> 183         stq     $14, 112($sp)
                                                   >> 184         stq     $15, 120($sp)
                                                   >> 185         /* 16-18 PAL-saved */
                                                   >> 186         stq     $19, 152($sp)
                                                   >> 187         stq     $20, 160($sp)
                                                   >> 188         stq     $21, 168($sp)
                                                   >> 189         stq     $22, 176($sp)
                                                   >> 190         stq     $23, 184($sp)
                                                   >> 191         stq     $24, 192($sp)
                                                   >> 192         stq     $25, 200($sp)
                                                   >> 193         stq     $26, 208($sp)
                                                   >> 194         stq     $27, 216($sp)
                                                   >> 195         stq     $28, 224($sp)
                                                   >> 196         mov     $sp, $19
                                                   >> 197         stq     $gp, 232($sp)
                                                   >> 198         lda     $8, 0x3fff
                                                   >> 199         stq     $31, 248($sp)
                                                   >> 200         bic     $sp, $8, $8
                                                   >> 201         jsr     $26, do_entUna
                                                   >> 202         ldq     $0, 0($sp)
                                                   >> 203         ldq     $1, 8($sp)
                                                   >> 204         ldq     $2, 16($sp)
                                                   >> 205         ldq     $3, 24($sp)
                                                   >> 206         ldq     $4, 32($sp)
                                                   >> 207         ldq     $5, 40($sp)
                                                   >> 208         ldq     $6, 48($sp)
                                                   >> 209         ldq     $7, 56($sp)
                                                   >> 210         ldq     $8, 64($sp)
                                                   >> 211         ldq     $9, 72($sp)
                                                   >> 212         ldq     $10, 80($sp)
                                                   >> 213         ldq     $11, 88($sp)
                                                   >> 214         ldq     $12, 96($sp)
                                                   >> 215         ldq     $13, 104($sp)
                                                   >> 216         ldq     $14, 112($sp)
                                                   >> 217         ldq     $15, 120($sp)
                                                   >> 218         /* 16-18 PAL-saved */
                                                   >> 219         ldq     $19, 152($sp)
                                                   >> 220         ldq     $20, 160($sp)
                                                   >> 221         ldq     $21, 168($sp)
                                                   >> 222         ldq     $22, 176($sp)
                                                   >> 223         ldq     $23, 184($sp)
                                                   >> 224         ldq     $24, 192($sp)
                                                   >> 225         ldq     $25, 200($sp)
                                                   >> 226         ldq     $26, 208($sp)
                                                   >> 227         ldq     $27, 216($sp)
                                                   >> 228         ldq     $28, 224($sp)
                                                   >> 229         ldq     $gp, 232($sp)
                                                   >> 230         lda     $sp, 256($sp)
                                                   >> 231         call_pal PAL_rti
                                                   >> 232 .end entUna
                                                   >> 233 
                                                   >> 234         .align  4
                                                   >> 235         .ent    entUnaUser
                                                   >> 236 entUnaUser:
                                                   >> 237         ldq     $0, 0($sp)      /* restore original $0 */
                                                   >> 238         lda     $sp, 256($sp)   /* pop entUna's stack frame */
                                                   >> 239         SAVE_ALL                /* setup normal kernel stack */
                                                   >> 240         lda     $sp, -56($sp)
                                                   >> 241         stq     $9, 0($sp)
                                                   >> 242         stq     $10, 8($sp)
                                                   >> 243         stq     $11, 16($sp)
                                                   >> 244         stq     $12, 24($sp)
                                                   >> 245         stq     $13, 32($sp)
                                                   >> 246         stq     $14, 40($sp)
                                                   >> 247         stq     $15, 48($sp)
                                                   >> 248         lda     $8, 0x3fff
                                                   >> 249         addq    $sp, 56, $19
                                                   >> 250         bic     $sp, $8, $8
                                                   >> 251         jsr     $26, do_entUnaUser
                                                   >> 252         ldq     $9, 0($sp)
                                                   >> 253         ldq     $10, 8($sp)
                                                   >> 254         ldq     $11, 16($sp)
                                                   >> 255         ldq     $12, 24($sp)
                                                   >> 256         ldq     $13, 32($sp)
                                                   >> 257         ldq     $14, 40($sp)
                                                   >> 258         ldq     $15, 48($sp)
                                                   >> 259         lda     $sp, 56($sp)
                                                   >> 260         br      ret_from_sys_call
                                                   >> 261 .end entUnaUser
                                                   >> 262 
                                                   >> 263         .align  4
                                                   >> 264         .globl  entDbg
                                                   >> 265         .ent    entDbg
                                                   >> 266 entDbg:
                                                   >> 267         SAVE_ALL
                                                   >> 268         lda     $8, 0x3fff
                                                   >> 269         lda     $26, ret_from_sys_call
                                                   >> 270         bic     $sp, $8, $8
                                                   >> 271         mov     $sp, $16
                                                   >> 272         jsr     $31, do_entDbg
                                                   >> 273 .end entDbg
                                                   >> 274 
                                                   >> 275 /*
                                                   >> 276  * The system call entry point is special.  Most importantly, it looks
                                                   >> 277  * like a function call to userspace as far as clobbered registers.  We
                                                   >> 278  * do preserve the argument registers (for syscall restarts) and $26
                                                   >> 279  * (for leaf syscall functions).
                                                   >> 280  *
                                                   >> 281  * So much for theory.  We don't take advantage of this yet.
                                                   >> 282  *
                                                   >> 283  * Note that a0-a2 are not saved by PALcode as with the other entry points.
                                                   >> 284  */
230                                                   285 
                                                   >> 286         .align  4
                                                   >> 287         .globl  entSys
                                                   >> 288         .globl  ret_from_sys_call
                                                   >> 289         .ent    entSys
                                                   >> 290 entSys:
                                                   >> 291         SAVE_ALL
                                                   >> 292         lda     $8, 0x3fff
                                                   >> 293         bic     $sp, $8, $8
                                                   >> 294         lda     $4, NR_SYSCALLS($31)
                                                   >> 295         stq     $16, SP_OFF+24($sp)
                                                   >> 296         lda     $5, sys_call_table
                                                   >> 297         lda     $27, sys_ni_syscall
                                                   >> 298         cmpult  $0, $4, $4
                                                   >> 299         ldl     $3, TI_FLAGS($8)
                                                   >> 300         stq     $17, SP_OFF+32($sp)
                                                   >> 301         s8addq  $0, $5, $5
                                                   >> 302         stq     $18, SP_OFF+40($sp)
                                                   >> 303         blbs    $3, strace
                                                   >> 304         beq     $4, 1f
                                                   >> 305         ldq     $27, 0($5)
                                                   >> 306 1:      jsr     $26, ($27), alpha_ni_syscall
                                                   >> 307         ldgp    $gp, 0($26)
                                                   >> 308         blt     $0, $syscall_error      /* the call failed */
                                                   >> 309         stq     $0, 0($sp)
                                                   >> 310         stq     $31, 72($sp)            /* a3=0 => no error */
                                                   >> 311 
                                                   >> 312         .align  4
                                                   >> 313 ret_from_sys_call:
                                                   >> 314         cmovne  $26, 0, $18             /* $18 = 0 => non-restartable */
                                                   >> 315         ldq     $0, SP_OFF($sp)
                                                   >> 316         and     $0, 8, $0
                                                   >> 317         beq     $0, ret_to_kernel
                                                   >> 318 ret_to_user:
                                                   >> 319         /* Make sure need_resched and sigpending don't change between
                                                   >> 320                 sampling and the rti.  */
                                                   >> 321         lda     $16, 7
                                                   >> 322         call_pal PAL_swpipl
                                                   >> 323         ldl     $17, TI_FLAGS($8)
                                                   >> 324         and     $17, _TIF_WORK_MASK, $2
                                                   >> 325         bne     $2, work_pending
231 restore_all:                                      326 restore_all:
232         rdctl   r10, status                    << 
233         andi    r10, r10, %lo(~STATUS_PIE)     << 
234         wrctl   status, r10                    << 
235         RESTORE_ALL                               327         RESTORE_ALL
236         eret                                   !! 328         call_pal PAL_rti
237                                                   329 
238         /* If the syscall number was invalid r !! 330 ret_to_kernel:
239 ret_invsyscall:                                !! 331         lda     $16, 7
240         movi    r2, -ENOSYS                    !! 332         call_pal PAL_swpipl
241         br      translate_rc_and_ret           !! 333         br restore_all
242                                                !! 334 
243         /* This implements the same as above,  !! 335         .align 3
244          * do_syscall_trace_enter and do_sysca !! 336 $syscall_error:
245          * syscall in order for utilities like !! 337         /*
246          */                                    !! 338          * Some system calls (e.g., ptrace) can return arbitrary
247 traced_system_call:                            !! 339          * values which might normally be mistaken as error numbers.
248         SAVE_SWITCH_STACK                      !! 340          * Those functions must zero $0 (v0) directly in the stack
249         call    do_syscall_trace_enter         !! 341          * frame to indicate that a negative return value wasn't an
250         RESTORE_SWITCH_STACK                   !! 342          * error number..
251                                                << 
252         /* Create system call register argumen << 
253            arguments on stack are already in p << 
254            of pt_regs. */                      << 
255         ldw     r2, PT_R2(sp)                  << 
256         ldw     r4, PT_R4(sp)                  << 
257         ldw     r5, PT_R5(sp)                  << 
258         ldw     r6, PT_R6(sp)                  << 
259         ldw     r7, PT_R7(sp)                  << 
260                                                << 
261         /* Fetch the syscall function. */      << 
262         movui   r1, __NR_syscalls              << 
263         bgeu    r2, r1, traced_invsyscall      << 
264         slli    r1, r2, 2                      << 
265         movhi   r11,%hiadj(sys_call_table)     << 
266         add     r1, r1, r11                    << 
267         ldw     r1, %lo(sys_call_table)(r1)    << 
268                                                << 
269         callr   r1                             << 
270                                                << 
271         /* If the syscall returns a negative r << 
272          *   Set r7 to 1 to indicate error,    << 
273          *   Negate r2 to get a positive error << 
274          * If the syscall returns zero or a po << 
275          *   Set r7 to 0.                      << 
276          * The sigreturn system calls will ski << 
277          * adding to register ra. To avoid des << 
278          */                                       343          */
279 translate_rc_and_ret2:                         !! 344         ldq     $18, 0($sp)     /* old syscall nr (zero if success) */
280         movi    r1, 0                          !! 345         beq     $18, $ret_success
281         bge     r2, zero, 4f                   !! 346 
282         ldw     r1, PT_ORIG_R2(sp)             !! 347         ldq     $19, 72($sp)    /* .. and this a3 */
283         addi    r1, r1, 1                      !! 348         subq    $31, $0, $0     /* with error in v0 */
284         beq     r1, zero, 4f                   !! 349         addq    $31, 1, $1      /* set a3 for errno return */
285         sub     r2, zero, r2                   !! 350         stq     $0, 0($sp)
286         movi    r1, 1                          !! 351         mov     $31, $26        /* tell "ret_from_sys_call" we can restart */
287 4:                                             !! 352         stq     $1, 72($sp)     /* a3 for return */
288         stw     r2, PT_R2(sp)                  !! 353         br      ret_from_sys_call
289         stw     r1, PT_R7(sp)                  !! 354 
290 end_translate_rc_and_ret2:                     !! 355 $ret_success:
291         SAVE_SWITCH_STACK                      !! 356         stq     $0, 0($sp)
292         call    do_syscall_trace_exit          !! 357         stq     $31, 72($sp)    /* a3=0 => no error */
293         RESTORE_SWITCH_STACK                   !! 358         br      ret_from_sys_call
294         br      ret_from_exception             !! 359 .end entSys
295                                                !! 360 
296         /* If the syscall number was invalid r << 
297 traced_invsyscall:                             << 
298         movi    r2, -ENOSYS                    << 
299         br      translate_rc_and_ret2          << 
300                                                << 
301 Luser_return:                                  << 
302         GET_THREAD_INFO r11                    << 
303         ldw     r10, TI_FLAGS(r11)             << 
304         ANDI32  r11, r10, _TIF_WORK_MASK       << 
305         beq     r11, r0, restore_all           << 
306         BTBZ    r1, r10, TIF_NEED_RESCHED, Lsi << 
307                                                << 
308         /* Reschedule work */                  << 
309         call    schedule                       << 
310         br      ret_from_exception             << 
311                                                << 
312 Lsignal_return:                                << 
313         ANDI32  r1, r10, _TIF_SIGPENDING | _TI << 
314         beq     r1, r0, restore_all            << 
315         mov     r4, sp                  /* pt_ << 
316         SAVE_SWITCH_STACK                      << 
317         call    do_notify_resume               << 
318         beq     r2, r0, no_work_pending        << 
319         RESTORE_SWITCH_STACK                   << 
320         /* prepare restart syscall here withou << 
321         ldw     r2, PT_R2(sp)   /* reload sysc << 
322         ldw     r4, PT_R4(sp)   /* reload sysc << 
323         ldw     r5, PT_R5(sp)                  << 
324         ldw     r6, PT_R6(sp)                  << 
325         ldw     r7, PT_R7(sp)                  << 
326         ldw     r8, PT_R8(sp)                  << 
327         ldw     r9, PT_R9(sp)                  << 
328         br      local_restart   /* restart sys << 
329                                                << 
330 no_work_pending:                               << 
331         RESTORE_SWITCH_STACK                   << 
332         br      ret_from_exception             << 
333                                                << 
334 /********************************************* << 
335  * Handle external interrupts.                 << 
336  ********************************************* << 
337  */                                            << 
338 /*                                                361 /*
339  * This is the generic interrupt handler (for  !! 362  * Do all cleanup when returning from all interrupts and system calls.
340  * sources). It figures out the vector number  !! 363  *
341  * interrupt service routine directly.         !! 364  * Arguments:
342  */                                            !! 365  *       $8: current.
343 external_interrupt:                            !! 366  *      $17: TI_FLAGS.
344         rdctl   r12, ipending                  !! 367  *      $18: The old syscall number, or zero if this is not a return
345         rdctl   r9, ienable                    !! 368  *           from a syscall that errored and is possibly restartable.
346         and     r12, r12, r9                   !! 369  *      $19: The old a3 value
347         /* skip if no interrupt is pending */  !! 370  */
348         beq     r12, r0, ret_from_interrupt    << 
349                                                   371 
                                                   >> 372         .align  4
                                                   >> 373         .ent    work_pending
                                                   >> 374 work_pending:
                                                   >> 375         and     $17, _TIF_NOTIFY_RESUME | _TIF_SIGPENDING, $2
                                                   >> 376         bne     $2, $work_notifysig
                                                   >> 377 
                                                   >> 378 $work_resched:
350         /*                                        379         /*
351          * Process an external hardware interr !! 380          * We can get here only if we returned from syscall without SIGPENDING
                                                   >> 381          * or got through work_notifysig already.  Either case means no syscall
                                                   >> 382          * restarts for us, so let $18 and $19 burn.
352          */                                       383          */
353                                                !! 384         jsr     $26, schedule
354         addi    ea, ea, -4      /* re-issue th !! 385         mov     0, $18
355         stw     ea, PT_EA(sp)                  !! 386         br      ret_to_user
356 2:      movi    r4, %lo(-1)     /* Start from  !! 387 
357                                         highes !! 388 $work_notifysig:
358                                 /* This is the !! 389         mov     $sp, $16
359 1:      andi    r10, r12, 1     /* Isolate bit !! 390         bsr     $1, do_switch_stack
360         srli    r12, r12, 1     /* shift count !! 391         jsr     $26, do_work_pending
361                                         multip !! 392         bsr     $1, undo_switch_stack
362         addi    r4, r4, 1                      << 
363         beq     r10, r0, 1b                    << 
364         mov     r5, sp          /* Setup pt_re << 
365         call    do_IRQ                         << 
366         rdctl   r12, ipending   /* check again << 
367         rdctl   r9, ienable     /* Isolate pos << 
368         and     r12, r12, r9                   << 
369         bne     r12, r0, 2b                    << 
370         /* br   ret_from_interrupt */ /* fall  << 
371                                                << 
372 ENTRY(ret_from_interrupt)                      << 
373         ldw     r1, PT_ESTATUS(sp)      /* che << 
374         TSTBNZ  r1, r1, ESTATUS_EU, Luser_retu << 
375                                                << 
376 #ifdef CONFIG_PREEMPTION                       << 
377         GET_THREAD_INFO r1                     << 
378         ldw     r4, TI_PREEMPT_COUNT(r1)       << 
379         bne     r4, r0, restore_all            << 
380         ldw     r4, TI_FLAGS(r1)               << 
381         BTBZ    r10, r4, TIF_NEED_RESCHED, res << 
382         ldw     r4, PT_ESTATUS(sp)      /* ? I << 
383         andi    r10, r4, ESTATUS_EPIE          << 
384         beq     r10, r0, restore_all           << 
385         call    preempt_schedule_irq           << 
386 #endif                                         << 
387         br      restore_all                       393         br      restore_all
                                                   >> 394 .end work_pending
388                                                   395 
389 /********************************************* << 
390  * A few syscall wrappers                      << 
391  ********************************************* << 
392  */                                            << 
393 /*                                                396 /*
394  * int clone(unsigned long clone_flags, unsign !! 397  * PTRACE syscall handler
395  *              int __user * parent_tidptr, in !! 398  */
396  *              int tls_val)                   << 
397  */                                            << 
398 ENTRY(sys_clone)                               << 
399         SAVE_SWITCH_STACK                      << 
400         subi    sp, sp, 4 /* make space for tl << 
401         stw     r8, 0(sp) /* pass tls pointer  << 
402         call    nios2_clone                    << 
403         addi    sp, sp, 4                      << 
404         RESTORE_SWITCH_STACK                   << 
405         ret                                    << 
406                                                << 
407 ENTRY(sys_rt_sigreturn)                        << 
408         SAVE_SWITCH_STACK                      << 
409         mov     r4, sp                         << 
410         call    do_rt_sigreturn                << 
411         RESTORE_SWITCH_STACK                   << 
412         addi    ra, ra, (end_translate_rc_and_ << 
413         ret                                    << 
414                                                   399 
415 /********************************************* !! 400         .align  4
416  * A few other wrappers and stubs              !! 401         .ent    strace
417  ********************************************* !! 402 strace:
418  */                                            !! 403         /* set up signal stack, call syscall_trace */
419 protection_exception_pte:                      !! 404         bsr     $1, do_switch_stack
420         rdctl   r6, pteaddr                    !! 405         jsr     $26, syscall_trace_enter /* returns the syscall number */
421         slli    r6, r6, 10                     !! 406         bsr     $1, undo_switch_stack
422         call    do_page_fault                  !! 407 
423         br      ret_from_exception             !! 408         /* get the arguments back.. */
424                                                !! 409         ldq     $16, SP_OFF+24($sp)
425 protection_exception_ba:                       !! 410         ldq     $17, SP_OFF+32($sp)
426         rdctl   r6, badaddr                    !! 411         ldq     $18, SP_OFF+40($sp)
427         call    do_page_fault                  !! 412         ldq     $19, 72($sp)
428         br      ret_from_exception             !! 413         ldq     $20, 80($sp)
429                                                !! 414         ldq     $21, 88($sp)
430 protection_exception_instr:                    !! 415 
431         call    handle_supervisor_instr        !! 416         /* get the system call pointer.. */
432         br      ret_from_exception             !! 417         lda     $1, NR_SYSCALLS($31)
433                                                !! 418         lda     $2, sys_call_table
434 handle_breakpoint:                             !! 419         lda     $27, alpha_ni_syscall
435         call    breakpoint_c                   !! 420         cmpult  $0, $1, $1
436         br      ret_from_exception             !! 421         s8addq  $0, $2, $2
437                                                !! 422         beq     $1, 1f
438 #ifdef CONFIG_NIOS2_ALIGNMENT_TRAP             !! 423         ldq     $27, 0($2)
439 handle_unaligned:                              !! 424 1:      jsr     $26, ($27), sys_gettimeofday
440         SAVE_SWITCH_STACK                      !! 425 ret_from_straced:
441         call    handle_unaligned_c             !! 426         ldgp    $gp, 0($26)
442         RESTORE_SWITCH_STACK                   !! 427 
443         br      ret_from_exception             !! 428         /* check return.. */
444 #else                                          !! 429         blt     $0, $strace_error       /* the call failed */
445 handle_unaligned:                              !! 430         stq     $31, 72($sp)            /* a3=0 => no error */
446         call    handle_unaligned_c             !! 431 $strace_success:
447         br      ret_from_exception             !! 432         stq     $0, 0($sp)              /* save return value */
448 #endif                                         !! 433 
449                                                !! 434         bsr     $1, do_switch_stack
450 handle_illegal:                                !! 435         jsr     $26, syscall_trace_leave
451         call    handle_illegal_c               !! 436         bsr     $1, undo_switch_stack
452         br      ret_from_exception             !! 437         br      $31, ret_from_sys_call
453                                                !! 438 
454 handle_diverror:                               !! 439         .align  3
455         call    handle_diverror_c              !! 440 $strace_error:
456         br      ret_from_exception             !! 441         ldq     $18, 0($sp)     /* old syscall nr (zero if success) */
457                                                !! 442         beq     $18, $strace_success
458 #ifdef CONFIG_KGDB                             !! 443         ldq     $19, 72($sp)    /* .. and this a3 */
459 handle_kgdb_breakpoint:                        !! 444 
460         call    kgdb_breakpoint_c              !! 445         subq    $31, $0, $0     /* with error in v0 */
461         br      ret_from_exception             !! 446         addq    $31, 1, $1      /* set a3 for errno return */
462 #endif                                         !! 447         stq     $0, 0($sp)
463                                                !! 448         stq     $1, 72($sp)     /* a3 for return */
464 handle_trap_1:                                 !! 449 
465         call    handle_trap_1_c                !! 450         bsr     $1, do_switch_stack
466         br      ret_from_exception             !! 451         mov     $18, $9         /* save old syscall number */
467                                                !! 452         mov     $19, $10        /* save old a3 */
468 handle_trap_2:                                 !! 453         jsr     $26, syscall_trace_leave
469         call    handle_trap_2_c                !! 454         mov     $9, $18
470         br      ret_from_exception             !! 455         mov     $10, $19
471                                                !! 456         bsr     $1, undo_switch_stack
472 handle_trap_3:                                 !! 457 
473 handle_trap_reserved:                          !! 458         mov     $31, $26        /* tell "ret_from_sys_call" we can restart */
474         call    handle_trap_3_c                !! 459         br      ret_from_sys_call
475         br      ret_from_exception             !! 460 .end strace
                                                   >> 461 
                                                   >> 462 /*
                                                   >> 463  * Save and restore the switch stack -- aka the balance of the user context.
                                                   >> 464  */
476                                                   465 
                                                   >> 466         .align  4
                                                   >> 467         .ent    do_switch_stack
                                                   >> 468 do_switch_stack:
                                                   >> 469         lda     $sp, -SWITCH_STACK_SIZE($sp)
                                                   >> 470         stq     $9, 0($sp)
                                                   >> 471         stq     $10, 8($sp)
                                                   >> 472         stq     $11, 16($sp)
                                                   >> 473         stq     $12, 24($sp)
                                                   >> 474         stq     $13, 32($sp)
                                                   >> 475         stq     $14, 40($sp)
                                                   >> 476         stq     $15, 48($sp)
                                                   >> 477         stq     $26, 56($sp)
                                                   >> 478         stt     $f0, 64($sp)
                                                   >> 479         stt     $f1, 72($sp)
                                                   >> 480         stt     $f2, 80($sp)
                                                   >> 481         stt     $f3, 88($sp)
                                                   >> 482         stt     $f4, 96($sp)
                                                   >> 483         stt     $f5, 104($sp)
                                                   >> 484         stt     $f6, 112($sp)
                                                   >> 485         stt     $f7, 120($sp)
                                                   >> 486         stt     $f8, 128($sp)
                                                   >> 487         stt     $f9, 136($sp)
                                                   >> 488         stt     $f10, 144($sp)
                                                   >> 489         stt     $f11, 152($sp)
                                                   >> 490         stt     $f12, 160($sp)
                                                   >> 491         stt     $f13, 168($sp)
                                                   >> 492         stt     $f14, 176($sp)
                                                   >> 493         stt     $f15, 184($sp)
                                                   >> 494         stt     $f16, 192($sp)
                                                   >> 495         stt     $f17, 200($sp)
                                                   >> 496         stt     $f18, 208($sp)
                                                   >> 497         stt     $f19, 216($sp)
                                                   >> 498         stt     $f20, 224($sp)
                                                   >> 499         stt     $f21, 232($sp)
                                                   >> 500         stt     $f22, 240($sp)
                                                   >> 501         stt     $f23, 248($sp)
                                                   >> 502         stt     $f24, 256($sp)
                                                   >> 503         stt     $f25, 264($sp)
                                                   >> 504         stt     $f26, 272($sp)
                                                   >> 505         stt     $f27, 280($sp)
                                                   >> 506         mf_fpcr $f0             # get fpcr
                                                   >> 507         stt     $f28, 288($sp)
                                                   >> 508         stt     $f29, 296($sp)
                                                   >> 509         stt     $f30, 304($sp)
                                                   >> 510         stt     $f0, 312($sp)   # save fpcr in slot of $f31
                                                   >> 511         ldt     $f0, 64($sp)    # dont let "do_switch_stack" change fp state.
                                                   >> 512         ret     $31, ($1), 1
                                                   >> 513 .end do_switch_stack
                                                   >> 514 
                                                   >> 515         .align  4
                                                   >> 516         .ent    undo_switch_stack
                                                   >> 517 undo_switch_stack:
                                                   >> 518         ldq     $9, 0($sp)
                                                   >> 519         ldq     $10, 8($sp)
                                                   >> 520         ldq     $11, 16($sp)
                                                   >> 521         ldq     $12, 24($sp)
                                                   >> 522         ldq     $13, 32($sp)
                                                   >> 523         ldq     $14, 40($sp)
                                                   >> 524         ldq     $15, 48($sp)
                                                   >> 525         ldq     $26, 56($sp)
                                                   >> 526         ldt     $f30, 312($sp)  # get saved fpcr
                                                   >> 527         ldt     $f0, 64($sp)
                                                   >> 528         ldt     $f1, 72($sp)
                                                   >> 529         ldt     $f2, 80($sp)
                                                   >> 530         ldt     $f3, 88($sp)
                                                   >> 531         mt_fpcr $f30            # install saved fpcr
                                                   >> 532         ldt     $f4, 96($sp)
                                                   >> 533         ldt     $f5, 104($sp)
                                                   >> 534         ldt     $f6, 112($sp)
                                                   >> 535         ldt     $f7, 120($sp)
                                                   >> 536         ldt     $f8, 128($sp)
                                                   >> 537         ldt     $f9, 136($sp)
                                                   >> 538         ldt     $f10, 144($sp)
                                                   >> 539         ldt     $f11, 152($sp)
                                                   >> 540         ldt     $f12, 160($sp)
                                                   >> 541         ldt     $f13, 168($sp)
                                                   >> 542         ldt     $f14, 176($sp)
                                                   >> 543         ldt     $f15, 184($sp)
                                                   >> 544         ldt     $f16, 192($sp)
                                                   >> 545         ldt     $f17, 200($sp)
                                                   >> 546         ldt     $f18, 208($sp)
                                                   >> 547         ldt     $f19, 216($sp)
                                                   >> 548         ldt     $f20, 224($sp)
                                                   >> 549         ldt     $f21, 232($sp)
                                                   >> 550         ldt     $f22, 240($sp)
                                                   >> 551         ldt     $f23, 248($sp)
                                                   >> 552         ldt     $f24, 256($sp)
                                                   >> 553         ldt     $f25, 264($sp)
                                                   >> 554         ldt     $f26, 272($sp)
                                                   >> 555         ldt     $f27, 280($sp)
                                                   >> 556         ldt     $f28, 288($sp)
                                                   >> 557         ldt     $f29, 296($sp)
                                                   >> 558         ldt     $f30, 304($sp)
                                                   >> 559         lda     $sp, SWITCH_STACK_SIZE($sp)
                                                   >> 560         ret     $31, ($1), 1
                                                   >> 561 .end undo_switch_stack
                                                   >> 562 
477 /*                                                563 /*
478  * Beware - when entering resume, prev (the cu !! 564  * The meat of the context switch code.
479  * in r4, next (the new task) is in r5, don't  !! 565  */
480  * registers.                                  << 
481  */                                            << 
482 ENTRY(resume)                                  << 
483                                                << 
484         rdctl   r7, status                     << 
485         stw     r7, TASK_THREAD + THREAD_KPSR( << 
486                                                << 
487         andi    r7, r7, %lo(~STATUS_PIE)       << 
488         wrctl   status, r7                     << 
489                                                << 
490         SAVE_SWITCH_STACK                      << 
491         stw     sp, TASK_THREAD + THREAD_KSP(r << 
492         ldw     sp, TASK_THREAD + THREAD_KSP(r << 
493         movia   r24, _current_thread           << 
494         GET_THREAD_INFO r1                     << 
495         stw     r1, 0(r24)                     << 
496         RESTORE_SWITCH_STACK                   << 
497                                                   566 
498         ldw     r7, TASK_THREAD + THREAD_KPSR( !! 567         .align  4
499         wrctl   status, r7                     !! 568         .globl  alpha_switch_to
                                                   >> 569         .ent    alpha_switch_to
                                                   >> 570 alpha_switch_to:
                                                   >> 571         .prologue 0
                                                   >> 572         bsr     $1, do_switch_stack
                                                   >> 573         call_pal PAL_swpctx
                                                   >> 574         lda     $8, 0x3fff
                                                   >> 575         bsr     $1, undo_switch_stack
                                                   >> 576         bic     $sp, $8, $8
                                                   >> 577         mov     $17, $0
500         ret                                       578         ret
501                                                !! 579 .end alpha_switch_to
502 ENTRY(ret_from_fork)                           << 
503         call    schedule_tail                  << 
504         br      ret_from_exception             << 
505                                                << 
506 ENTRY(ret_from_kernel_thread)                  << 
507         call    schedule_tail                  << 
508         mov     r4,r17  /* arg */              << 
509         callr   r16     /* function */         << 
510         br      ret_from_exception             << 
511                                                   580 
512 /*                                                581 /*
513  * Kernel user helpers.                        !! 582  * New processes begin life here.
514  *                                             << 
515  * Each segment is 64-byte aligned and will be << 
516  * New segments (if ever needed) must be added << 
517  * This mechanism should be used only for thin << 
518  * justified, and not be abused freely.        << 
519  *                                             << 
520  */                                               583  */
521                                                   584 
522  /* Filling pads with undefined instructions.  !! 585         .globl  ret_from_fork
523 .macro  kuser_pad sym size                     !! 586         .align  4
524         .if     ((. - \sym) & 3)               !! 587         .ent    ret_from_fork
525         .rept   (4 - (. - \sym) & 3)           !! 588 ret_from_fork:
526         .byte   0                              !! 589         lda     $26, ret_from_sys_call
527         .endr                                  !! 590         mov     $17, $16
528         .endif                                 !! 591         jmp     $31, schedule_tail
529         .rept   ((\size - (. - \sym)) / 4)     !! 592 .end ret_from_fork
530         .word   0xdeadbeef                     << 
531         .endr                                  << 
532 .endm                                          << 
533                                                   593 
534         .align  6                              !! 594 /*
535         .globl  __kuser_helper_start           !! 595  * ... and new kernel threads - here
536 __kuser_helper_start:                          !! 596  */
                                                   >> 597         .align 4
                                                   >> 598         .globl  ret_from_kernel_thread
                                                   >> 599         .ent    ret_from_kernel_thread
                                                   >> 600 ret_from_kernel_thread:
                                                   >> 601         mov     $17, $16
                                                   >> 602         jsr     $26, schedule_tail
                                                   >> 603         mov     $9, $27
                                                   >> 604         mov     $10, $16
                                                   >> 605         jsr     $26, ($9)
                                                   >> 606         mov     $31, $19                /* to disable syscall restarts */
                                                   >> 607         br      $31, ret_to_user
                                                   >> 608 .end ret_from_kernel_thread
537                                                   609 
538 __kuser_helper_version:                        !! 610 
539         .word   ((__kuser_helper_end - __kuser !! 611 /*
                                                   >> 612  * Special system calls.  Most of these are special in that they either
                                                   >> 613  * have to play switch_stack games or in some way use the pt_regs struct.
                                                   >> 614  */
540                                                   615 
541 __kuser_cmpxchg:                               !! 616 .macro  fork_like name
542         /*                                     !! 617         .align  4
543          * r4 pointer to exchange variable     !! 618         .globl  alpha_\name
544          * r5 old value                        !! 619         .ent    alpha_\name
545          * r6 new value                        !! 620 alpha_\name:
546          */                                    !! 621         .prologue 0
547 cmpxchg_ldw:                                   !! 622         bsr     $1, do_switch_stack
548         ldw     r2, 0(r4)                      !! 623         jsr     $26, sys_\name
549         sub     r2, r2, r5                     !! 624         ldq     $26, 56($sp)
550         bne     r2, zero, cmpxchg_ret          !! 625         lda     $sp, SWITCH_STACK_SIZE($sp)
551                                                << 
552         /* We had a match, store the new value << 
553 cmpxchg_stw:                                   << 
554         stw     r6, 0(r4)                      << 
555 cmpxchg_ret:                                   << 
556         ret                                       626         ret
                                                   >> 627 .end    alpha_\name
                                                   >> 628 .endm
557                                                   629 
558         kuser_pad __kuser_cmpxchg, 64          !! 630 fork_like fork
559                                                !! 631 fork_like vfork
560         .globl  __kuser_sigtramp               !! 632 fork_like clone
561 __kuser_sigtramp:                              !! 633 
562         movi    r2, __NR_rt_sigreturn          !! 634         .align  4
563         trap                                   !! 635         .globl  sys_sigreturn
564                                                !! 636         .ent    sys_sigreturn
565         kuser_pad __kuser_sigtramp, 64         !! 637 sys_sigreturn:
566                                                !! 638         .prologue 0
567         .globl  __kuser_helper_end             !! 639         lda     $9, ret_from_straced
568 __kuser_helper_end:                            !! 640         cmpult  $26, $9, $9
                                                   >> 641         lda     $sp, -SWITCH_STACK_SIZE($sp)
                                                   >> 642         jsr     $26, do_sigreturn
                                                   >> 643         bne     $9, 1f
                                                   >> 644         jsr     $26, syscall_trace_leave
                                                   >> 645 1:      br      $1, undo_switch_stack
                                                   >> 646         br      ret_from_sys_call
                                                   >> 647 .end sys_sigreturn
                                                   >> 648 
                                                   >> 649         .align  4
                                                   >> 650         .globl  sys_rt_sigreturn
                                                   >> 651         .ent    sys_rt_sigreturn
                                                   >> 652 sys_rt_sigreturn:
                                                   >> 653         .prologue 0
                                                   >> 654         lda     $9, ret_from_straced
                                                   >> 655         cmpult  $26, $9, $9
                                                   >> 656         lda     $sp, -SWITCH_STACK_SIZE($sp)
                                                   >> 657         jsr     $26, do_rt_sigreturn
                                                   >> 658         bne     $9, 1f
                                                   >> 659         jsr     $26, syscall_trace_leave
                                                   >> 660 1:      br      $1, undo_switch_stack
                                                   >> 661         br      ret_from_sys_call
                                                   >> 662 .end sys_rt_sigreturn
                                                   >> 663 
                                                   >> 664         .align  4
                                                   >> 665         .globl  alpha_ni_syscall
                                                   >> 666         .ent    alpha_ni_syscall
                                                   >> 667 alpha_ni_syscall:
                                                   >> 668         .prologue 0
                                                   >> 669         /* Special because it also implements overflow handling via
                                                   >> 670            syscall number 0.  And if you recall, zero is a special
                                                   >> 671            trigger for "not an error".  Store large non-zero there.  */
                                                   >> 672         lda     $0, -ENOSYS
                                                   >> 673         unop
                                                   >> 674         stq     $0, 0($sp)
                                                   >> 675         ret
                                                   >> 676 .end alpha_ni_syscall
                                                      

~ [ 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