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

TOMOYO Linux Cross Reference
Linux/arch/arc/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/arc/kernel/entry.S (Version linux-6.12-rc7) and /arch/sparc64/kernel/entry.S (Version linux-5.11.22)


  1 /* SPDX-License-Identifier: GPL-2.0-only */       
  2 /*                                                
  3  * Common Low Level Interrupts/Traps/Exception    
  4  * (included from entry-<isa>.S                   
  5  *                                                
  6  * Copyright (C) 2014-15 Synopsys, Inc. (www.s    
  7  * Copyright (C) 2004, 2007-2010, 2011-2012 Sy    
  8  */                                               
  9                                                   
 10 /*--------------------------------------------    
 11  *    Function                            ABI     
 12  *--------------------------------------------    
 13  *                                                
 14  *  Arguments                           r0 - r    
 15  *  Caller Saved Registers              r0 - r    
 16  *  Callee Saved Registers              r13- r    
 17  *  Global Pointer (gp)                 r26       
 18  *  Frame Pointer (fp)                  r27       
 19  *  Stack Pointer (sp)                  r28       
 20  *  Branch link register (blink)        r31       
 21  *--------------------------------------------    
 22  */                                               
 23                                                   
 24 ;################### Special Sys Call Wrappers    
 25                                                   
 26 ENTRY(sys_clone_wrapper)                          
 27         SAVE_CALLEE_SAVED_USER                    
 28         bl  @sys_clone                            
 29         DISCARD_CALLEE_SAVED_USER                 
 30                                                   
 31         GET_CURR_THR_INFO_FLAGS   r10             
 32         and.f 0, r10, _TIF_SYSCALL_WORK           
 33         bnz   tracesys_exit                       
 34                                                   
 35         b .Lret_from_system_call                  
 36 END(sys_clone_wrapper)                            
 37                                                   
 38 ENTRY(sys_clone3_wrapper)                         
 39         SAVE_CALLEE_SAVED_USER                    
 40         bl  @sys_clone3                           
 41         DISCARD_CALLEE_SAVED_USER                 
 42                                                   
 43         GET_CURR_THR_INFO_FLAGS   r10             
 44         and.f 0, r10, _TIF_SYSCALL_WORK           
 45         bnz   tracesys_exit                       
 46                                                   
 47         b .Lret_from_system_call                  
 48 END(sys_clone3_wrapper)                           
 49                                                   
 50 ENTRY(ret_from_fork)                              
 51         ; when the forked child comes here fro    
 52         ; r0 has the last task pointer.           
 53         ; put last task in scheduler queue        
 54         jl   @schedule_tail                       
 55                                                   
 56         ld   r9, [sp, PT_status32]                
 57         brne r9, 0, 1f                            
 58                                                   
 59         jl.d [r14]              ; kernel threa    
 60         mov  r0, r13            ; (see PF_KTHR    
 61                                                   
 62 1:                                                
 63         ; Return to user space                    
 64         ; 1. Any forked task (Reach here via B    
 65         ; 2. First ever init task (Reach here     
 66         ;    This is the historic "kernel_exec    
 67         ;    user mode, in a round about way s    
 68         ;    a kernel thread which is executed    
 69         ;    out whenever kernel_execve (now i    
 70         b    ret_from_exception                   
 71 END(ret_from_fork)                                
 72                                                   
 73 ;################### Non TLB Exception Handlin    
 74                                                   
 75 ; --------------------------------------------    
 76 ; Instruction Error Exception Handler             
 77 ; --------------------------------------------    
 78                                                   
 79 ENTRY(instr_service)                              
 80                                                   
 81         EXCEPTION_PROLOGUE                        
 82                                                   
 83         bl  do_insterror_or_kprobe                
 84         b   ret_from_exception                    
 85 END(instr_service)                                
 86                                                   
 87 ; --------------------------------------------    
 88 ; Machine Check Exception Handler                 
 89 ; --------------------------------------------    
 90                                                   
 91 ENTRY(EV_MachineCheck)                            
 92                                                   
 93         EXCEPTION_PROLOGUE_KEEP_AE      ; ECR     
 94                                                   
 95         lr  r0, [efa]                             
 96         mov r1, sp                                
 97                                                   
 98         ; MC exceptions disable MMU               
 99         ARC_MMU_REENABLE r3                       
100                                                   
101         lsr     r3, r10, 8                        
102         bmsk    r3, r3, 7                         
103         brne    r3, ECR_C_MCHK_DUP_TLB, 1f        
104                                                   
105         bl      do_tlb_overlap_fault              
106         b       ret_from_exception                
107                                                   
108 1:                                                
109         ; DEAD END: can't do much, display Reg    
110         SAVE_CALLEE_SAVED_USER                    
111                                                   
112         GET_CURR_TASK_FIELD_PTR   TASK_THREAD,    
113         st  sp, [r10, THREAD_CALLEE_REG]          
114                                                   
115         j  do_machine_check_fault                 
116                                                   
117 END(EV_MachineCheck)                              
118                                                   
119 ; --------------------------------------------    
120 ; Privilege Violation Exception Handler           
121 ; --------------------------------------------    
122 ENTRY(EV_PrivilegeV)                              
123                                                   
124         EXCEPTION_PROLOGUE                        
125                                                   
126         bl  do_privilege_fault                    
127         b   ret_from_exception                    
128 END(EV_PrivilegeV)                                
129                                                   
130 ; --------------------------------------------    
131 ; Extension Instruction Exception Handler         
132 ; --------------------------------------------    
133 ENTRY(EV_Extension)                               
134                                                   
135         EXCEPTION_PROLOGUE                        
136                                                   
137         bl  do_extension_fault                    
138         b   ret_from_exception                    
139 END(EV_Extension)                                 
140                                                   
141 ;################ Trap Handling (Syscall, Brea    
142                                                   
143 ; --------------------------------------------    
144 ; syscall Tracing                                 
145 ; --------------------------------------------    
146 tracesys:                                         
147         ; safekeep EFA (r12) if syscall tracer    
148         ; for traps, ERET is pre-commit so poi    
149         GET_CURR_TASK_FIELD_PTR   TASK_THREAD,    
150         st  r12, [r11, THREAD_FAULT_ADDR]         
151                                                   
152         ; PRE syscall trace hook                  
153         mov r0, sp                                
154         bl  @syscall_trace_enter                  
155                                                   
156         ; Tracing code now returns the syscall    
157         mov r8, r0                                
158                                                   
159         ; Do the Sys Call as we normally would    
160         cmp     r8,  NR_syscalls - 1              
161         mov.hi  r0, -ENOSYS                       
162         bhi     tracesys_exit                     
163                                                   
164         ; Restore the sys-call args. Mere invo    
165         ; clobbered them (since they are in sc    
166         ; have deliberately changed the syscal    
167         ld  r0, [sp, PT_r0]                       
168         ld  r1, [sp, PT_r1]                       
169         ld  r2, [sp, PT_r2]                       
170         ld  r3, [sp, PT_r3]                       
171         ld  r4, [sp, PT_r4]                       
172         ld  r5, [sp, PT_r5]                       
173         ld  r6, [sp, PT_r6]                       
174         ld  r7, [sp, PT_r7]                       
175         ld.as   r9, [sys_call_table, r8]          
176         jl      [r9]                              
177                                                   
178 tracesys_exit:                                    
179         st  r0, [sp, PT_r0]                       
180                                                   
181         ; POST syscall trace hook                 
182         mov r0, sp              ; pt_regs need    
183         bl  @syscall_trace_exit                   
184                                                   
185         ; don't call ret_from_system_call as i    
186         b   ret_from_exception                    
187                                                   
188 ; --------------------------------------------    
189 ; Breakpoint TRAP                                 
190 ; --------------------------------------------    
191 trap_with_param:                                  
192         mov r0, r12     ; EFA in case ptracer/    
193         mov r1, sp      ; pt_regs                 
194                                                   
195         ; save callee regs in case tracer/gdb     
196         SAVE_CALLEE_SAVED_USER                    
197                                                   
198         ; safekeep ref to callee regs             
199         GET_CURR_TASK_FIELD_PTR   TASK_THREAD,    
200         st  sp, [r10, THREAD_CALLEE_REG]          
201                                                   
202         ; call the non syscall trap handler       
203         bl  do_non_swi_trap                       
204                                                   
205         ; unwind stack to discard callee regs     
206         DISCARD_CALLEE_SAVED_USER                 
207                                                   
208         b   ret_from_exception                    
209                                                   
210 ; --------------------------------------------    
211 ; syscall TRAP                                    
212 ; ABI: (r0-r7) up to 8 args, (r8) syscall numb    
213 ; --------------------------------------------    
214                                                   
215 ENTRY(EV_Trap)                                    
216                                                   
217         EXCEPTION_PROLOGUE_KEEP_AE                
218                                                   
219         lr  r12, [efa]                            
220                                                   
221         FAKE_RET_FROM_EXCPN                       
222                                                   
223         ;============ TRAP N : breakpoints, kp    
224         bmsk.f 0, r10, 7                          
225         bnz    trap_with_param                    
226                                                   
227         ;============ TRAP 0 (no param): sysca    
228                                                   
229         ; syscall tracing ongoing, invoke pre-    
230         GET_CURR_THR_INFO_FLAGS   r10             
231         and.f 0, r10, _TIF_SYSCALL_WORK           
232         bnz   tracesys  ; this never comes bac    
233                                                   
234         ;============ Normal syscall case         
235                                                   
236         cmp     r8,  NR_syscalls - 1              
237         mov.hi  r0, -ENOSYS                       
238         bhi     .Lret_from_system_call            
239                                                   
240         ld.as   r9,[sys_call_table, r8]           
241         jl      [r9]                              
242                                                   
243 .Lret_from_system_call:                           
244         st  r0, [sp, PT_r0]     ; sys call ret    
245                                                   
246         ; fall through to ret_from_exception      
247 END(EV_Trap)                                      
248                                                   
249 ;############# Return from Intr/Excp/Trap (Lin    
250 ;                                                 
251 ; If ret to user mode do we need to handle sig    
252                                                   
253 ENTRY(ret_from_exception)                         
254                                                   
255         ; Pre-{IRQ,Trap,Exception} K/U mode fr    
256         ld  r8, [sp, PT_status32]   ; returnin    
257                                                   
258         bbit0  r8, STATUS_U_BIT, resume_kernel    
259                                                   
260         ; Before returning to User mode check-    
261         ; such as rescheduling/signal-delivery    
262 resume_user_mode_begin:                           
263                                                   
264         ; Disable IRQs to ensures that chk for    
265         ; (and we don't end up missing a NEED_    
266         ; interim IRQ).                           
267         IRQ_DISABLE     r10                       
268                                                   
269         ; Fast Path return to user mode if no     
270         GET_CURR_THR_INFO_FLAGS   r9              
271         and.f  0,  r9, _TIF_WORK_MASK             
272         bz     .Lrestore_regs                     
273                                                   
274         ; --- (Slow Path #1) task preemption -    
275         bbit0  r9, TIF_NEED_RESCHED, .Lchk_pen    
276         mov    blink, resume_user_mode_begin      
277         j      @schedule        ; BTST+Bnz cau    
278                                                   
279 .Lchk_pend_signals:                               
280         IRQ_ENABLE      r10                       
281                                                   
282         ; --- (Slow Path #2) pending signal  -    
283         mov r0, sp      ; pt_regs for arg to d    
284                                                   
285         GET_CURR_THR_INFO_FLAGS   r9              
286         and.f  0,  r9, _TIF_SIGPENDING|_TIF_NO    
287         bz .Lchk_notify_resume                    
288                                                   
289         ; Normal Trap/IRQ entry only saves Scr    
290         ; in pt_reg since the "C" ABI (kernel     
291         ; save/restore callee-saved regs.         
292         ;                                         
293         ; However, here we need to explicitly     
294         ; (i)  If this signal causes coredump     
295         ; (ii) If signal is SIGTRAP/SIGSTOP, t    
296         ;      tracer might call PEEKUSR(CALLE    
297         ;                                         
298         ; NOTE: SP will grow up by size of CAL    
299         SAVE_CALLEE_SAVED_USER                    
300                                                   
301         ; save location of saved Callee Regs @    
302         GET_CURR_TASK_FIELD_PTR   TASK_THREAD,    
303         st  sp, [r10, THREAD_CALLEE_REG]          
304                                                   
305         bl  @do_signal                            
306                                                   
307         ; Ideally we want to discard the Calle    
308         ; a tracing signal, tracer could have     
309         RESTORE_CALLEE_SAVED_USER                 
310                                                   
311         b      resume_user_mode_begin   ; loop    
312                                                   
313         ; --- (Slow Path #3) notify_resume ---    
314 .Lchk_notify_resume:                              
315         btst   r9, TIF_NOTIFY_RESUME              
316         blnz   @do_notify_resume                  
317         b      resume_user_mode_begin   ; unco    
318                                         ; for     
319                                                   
320 resume_kernel_mode:                               
321                                                   
322         ; Disable Interrupts from this point o    
323         ; CONFIG_PREEMPTION: This is a must fo    
324         ; !CONFIG_PREEMPTION: To ensure restor    
325         IRQ_DISABLE     r9                        
326                                                   
327 #ifdef CONFIG_PREEMPTION                          
328                                                   
329         ; Can't preempt if preemption disabled    
330         GET_CURR_THR_INFO_FROM_SP   r10           
331         ld  r8, [r10, THREAD_INFO_PREEMPT_COUN    
332         brne  r8, 0, .Lrestore_regs               
333                                                   
334         ; check if this task's NEED_RESCHED fl    
335         ld  r9, [r10, THREAD_INFO_FLAGS]          
336         bbit0  r9, TIF_NEED_RESCHED, .Lrestore    
337                                                   
338         ; Invoke PREEMPTION                       
339         jl      preempt_schedule_irq              
340                                                   
341         ; preempt_schedule_irq() always return    
342 #endif                                            
343                                                   
344         b       .Lrestore_regs                    
345                                                   
346 ##### DONT ADD CODE HERE - .Lrestore_regs actu    
347                                                   
                                                      

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