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

TOMOYO Linux Cross Reference
Linux/arch/arc/kernel/traps.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arc/kernel/traps.c (Version linux-6.11-rc3) and /arch/sparc64/kernel/traps.c (Version linux-4.13.16)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * Traps/Non-MMU Exception handling for ARC       
  4  *                                                
  5  * Copyright (C) 2004, 2007-2010, 2011-2012 Sy    
  6  *                                                
  7  * vineetg: May 2011                              
  8  *  -user-space unaligned access emulation        
  9  *                                                
 10  * Rahul Trivedi: Codito Technologies 2004        
 11  */                                               
 12                                                   
 13 #include <linux/sched/signal.h>                   
 14 #include <linux/kdebug.h>                         
 15 #include <linux/uaccess.h>                        
 16 #include <linux/ptrace.h>                         
 17 #include <linux/kprobes.h>                        
 18 #include <linux/kgdb.h>                           
 19 #include <asm/entry.h>                            
 20 #include <asm/setup.h>                            
 21 #include <asm/unaligned.h>                        
 22 #include <asm/kprobes.h>                          
 23                                                   
 24 void die(const char *str, struct pt_regs *regs    
 25 {                                                 
 26         show_kernel_fault_diag(str, regs, addr    
 27                                                   
 28         /* DEAD END */                            
 29         __asm__("flag 1");                        
 30 }                                                 
 31                                                   
 32 /*                                                
 33  * Helper called for bulk of exceptions NOT ne    
 34  *  -for user faults enqueues requested signal    
 35  *  -for kernel, chk if due to copy_(to|from)_    
 36  */                                               
 37 static noinline int                               
 38 unhandled_exception(const char *str, struct pt    
 39                     int signo, int si_code, vo    
 40 {                                                 
 41         if (user_mode(regs)) {                    
 42                 struct task_struct *tsk = curr    
 43                                                   
 44                 tsk->thread.fault_address = (_    
 45                                                   
 46                 force_sig_fault(signo, si_code    
 47                                                   
 48         } else {                                  
 49                 /* If not due to copy_(to|from    
 50                 if (fixup_exception(regs))        
 51                         return 0;                 
 52                                                   
 53                 die(str, regs, (unsigned long)    
 54         }                                         
 55                                                   
 56         return 1;                                 
 57 }                                                 
 58                                                   
 59 #define DO_ERROR_INFO(signr, str, name, sicode    
 60 int name(unsigned long address, struct pt_regs    
 61 {                                                 
 62         return unhandled_exception(str, regs,     
 63                                    (void __use    
 64 }                                                 
 65                                                   
 66 /*                                                
 67  * Entry points for exceptions NOT needing spe    
 68  */                                               
 69 DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn",    
 70 DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_    
 71 DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)",    
 72 DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __    
 73 DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_    
 74 DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_    
 75 DO_ERROR_INFO(SIGSEGV, "gcc generated __builti    
 76                                                   
 77 /*                                                
 78  * Entry Point for Misaligned Data access Exce    
 79  */                                               
 80 int do_misaligned_access(unsigned long address    
 81                          struct callee_regs *c    
 82 {                                                 
 83         /* If emulation not enabled, or failed    
 84         if (misaligned_fixup(address, regs, cr    
 85                 return do_misaligned_error(add    
 86                                                   
 87         return 0;                                 
 88 }                                                 
 89                                                   
 90 /*                                                
 91  * Entry point for miscll errors such as Neste    
 92  *  -Duplicate TLB entry is handled separately    
 93  */                                               
 94 void do_machine_check_fault(unsigned long addr    
 95 {                                                 
 96         die("Unhandled Machine Check Exception    
 97 }                                                 
 98                                                   
 99                                                   
100 /*                                                
101  * Entry point for traps induced by ARCompact     
102  * This is same family as TRAP0/SWI insn (use     
103  * The only difference being SWI insn take no     
104  * which reflects in ECR Reg as 8 bit param.      
105  * Thus TRAP_S <n> can be used for specific pu    
106  *  -1 used for software breakpointing (gdb)      
107  *  -2 used by kprobes                            
108  *  -5 __builtin_trap() generated by gcc (2018    
109  *     -fno-isolate-erroneous-paths-dereferenc    
110  */                                               
111 void do_non_swi_trap(unsigned long address, st    
112 {                                                 
113         switch (regs->ecr.param) {                
114         case 1:                                   
115                 trap_is_brkpt(address, regs);     
116                 break;                            
117                                                   
118         case 2:                                   
119                 trap_is_kprobe(address, regs);    
120                 break;                            
121                                                   
122         case 3:                                   
123         case 4:                                   
124                 kgdb_trap(regs);                  
125                 break;                            
126                                                   
127         case 5:                                   
128                 do_trap5_error(address, regs);    
129                 break;                            
130         default:                                  
131                 break;                            
132         }                                         
133 }                                                 
134                                                   
135 /*                                                
136  * Entry point for Instruction Error Exception    
137  *  -For a corner case, ARC kprobes implementa    
138  *   this exception, hence the check              
139  */                                               
140 void do_insterror_or_kprobe(unsigned long addr    
141 {                                                 
142         int rc;                                   
143                                                   
144         /* Check if this exception is caused b    
145         rc = notify_die(DIE_IERR, "kprobe_ierr    
146         if (rc == NOTIFY_STOP)                    
147                 return;                           
148                                                   
149         insterror_is_error(address, regs);        
150 }                                                 
151                                                   
152 /*                                                
153  * abort() call generated by older gcc for __b    
154  */                                               
155 void abort(void)                                  
156 {                                                 
157         __asm__ __volatile__("trap_s  5\n");      
158 }                                                 
159                                                   

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