Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ARM] Move processor_modes[] to .../process.c

bad_mode() currently prints the mode which caused the exception, and
then causes an oops dump to be printed which again displays this
information (since the CPSR in the struct pt_regs is correct.) This
leads to processor_modes[] being shared between traps.c and process.c
with a local declaration of it.

We can clean this up by moving processor_modes[] to process.c and
removing the duplication, resulting in processor_modes[] becoming
static.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Russell King and committed by
Russell King
ae0a846e d941caa2

+9 -12
-1
arch/arm/kernel/entry-armv.S
··· 99 99 @ cpsr_<exception>, "old_r0" 100 100 101 101 mov r0, sp 102 - and r2, r6, #0x1f 103 102 b bad_mode 104 103 105 104 /*
+7 -1
arch/arm/kernel/process.c
··· 36 36 #include <asm/uaccess.h> 37 37 #include <asm/mach/time.h> 38 38 39 - extern const char *processor_modes[]; 39 + static const char *processor_modes[] = { 40 + "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" , "UK4_26" , "UK5_26" , "UK6_26" , "UK7_26" , 41 + "UK8_26" , "UK9_26" , "UK10_26", "UK11_26", "UK12_26", "UK13_26", "UK14_26", "UK15_26", 42 + "USER_32", "FIQ_32" , "IRQ_32" , "SVC_32" , "UK4_32" , "UK5_32" , "UK6_32" , "ABT_32" , 43 + "UK8_32" , "UK9_32" , "UK10_32", "UND_32" , "UK12_32", "UK13_32", "UK14_32", "SYS_32" 44 + }; 45 + 40 46 extern void setup_mm_for_reboot(char mode); 41 47 42 48 static volatile int hlt_counter;
+2 -10
arch/arm/kernel/traps.c
··· 32 32 #include "ptrace.h" 33 33 #include "signal.h" 34 34 35 - const char *processor_modes[]= 36 - { "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" , "UK4_26" , "UK5_26" , "UK6_26" , "UK7_26" , 37 - "UK8_26" , "UK9_26" , "UK10_26", "UK11_26", "UK12_26", "UK13_26", "UK14_26", "UK15_26", 38 - "USER_32", "FIQ_32" , "IRQ_32" , "SVC_32" , "UK4_32" , "UK5_32" , "UK6_32" , "ABT_32" , 39 - "UK8_32" , "UK9_32" , "UK10_32", "UND_32" , "UK12_32", "UK13_32", "UK14_32", "SYS_32" 40 - }; 41 - 42 35 static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; 43 36 44 37 #ifdef CONFIG_DEBUG_USER ··· 330 337 * It never returns, and never tries to sync. We hope that we can at least 331 338 * dump out some state information... 332 339 */ 333 - asmlinkage void bad_mode(struct pt_regs *regs, int reason, int proc_mode) 340 + asmlinkage void bad_mode(struct pt_regs *regs, int reason) 334 341 { 335 342 console_verbose(); 336 343 337 - printk(KERN_CRIT "Bad mode in %s handler detected: mode %s\n", 338 - handler[reason], processor_modes[proc_mode]); 344 + printk(KERN_CRIT "Bad mode in %s handler detected\n", handler[reason]); 339 345 340 346 die("Oops - bad mode", regs, 0); 341 347 local_irq_disable();