Blackfin arch: ensure that speculative loads of bad pointers don't cause us to do...
authorRobin Getz <robin.getz@analog.com>
Mon, 29 Oct 2007 10:23:28 +0000 (18:23 +0800)
committerBryan Wu <bryan.wu@analog.com>
Mon, 29 Oct 2007 10:23:28 +0000 (18:23 +0800)
Fix/change formatting of a few more things.

Signed-off-by: Robin Getz <robin.getz@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
arch/blackfin/kernel/fixed_code.S
arch/blackfin/kernel/setup.c
arch/blackfin/mach-common/entry.S
include/asm-blackfin/bfin-global.h
include/asm-blackfin/fixed_code.h

index d8b1ebc7099684d1dd46fea05cf4d94186fcd7df..90262691b11a299993108608e0ad63d19feb0a63 100644 (file)
@@ -129,4 +129,18 @@ ENTRY(_atomic_xor32)
        rts;
 ENDPROC (_atomic_ior32)
 
+.align 16
+       /*
+        * safe_user_instruction
+        * Four NOPS are enough to allow the pipeline to speculativily load
+        * execute anything it wants. After that, things have gone bad, and
+        * we are stuck - so panic. Since we might be in user space, we can't
+        * call panic, so just cause a unhandled exception, this should cause
+        * a dump of the trace buffer so we can tell were we are, and a reboot
+        */
+ENTRY(_safe_user_instruction)
+       NOP; NOP; NOP; NOP;
+       EXCPT 0x4;
+ENDPROC(_safe_user_instruction)
+
 ENTRY(_fixed_code_end)
index fc22ec8c2f47ef397257cff3f2aacfb9591aaece..934234f438390d8ddfb11c664528bfe984cc297d 100644 (file)
@@ -431,6 +431,8 @@ void __init setup_arch(char **cmdline_p)
               != ATOMIC_AND32 - FIXED_CODE_START);
        BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
               != ATOMIC_XOR32 - FIXED_CODE_START);
+       BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
+               != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
 
        init_exception_vectors();
        bf53x_cache_init();
index e3ad5802868a2489865a761ae32b824b6a87ecc4..1b13fa470977e8d0c13aa3ba722f009f47556445 100644 (file)
@@ -917,7 +917,7 @@ ENTRY(_ex_table)
        .long _ex_soft_bp       /* 0x01 - User Defined - Software breakpoint */
        .long _ex_replaceable   /* 0x02 - User Defined */
        .long _ex_trap_c        /* 0x03 - User Defined - userspace stack overflow */
-       .long _ex_replaceable   /* 0x04 - User Defined */
+       .long _ex_trap_c        /* 0x04 - User Defined - dump trace buffer */
        .long _ex_replaceable   /* 0x05 - User Defined */
        .long _ex_replaceable   /* 0x06 - User Defined */
        .long _ex_replaceable   /* 0x07 - User Defined */
index 14cb8d35924e7c3505126057d3f9648d927435fe..0212e180b90e327d1a82c9c68145c551ab757843 100644 (file)
@@ -80,6 +80,7 @@ extern int atomic_sub32(void);
 extern int atomic_ior32(void);
 extern int atomic_and32(void);
 extern int atomic_xor32(void);
+extern void safe_user_instruction(void);
 extern void sigreturn_stub(void);
 
 extern void *l1_data_A_sram_alloc(size_t);
index e6df84ee1557893f4e930b4fb4a3f3ac556fd2f6..37db66c7030d12e91eabc205ed9ea4059195515a 100644 (file)
@@ -17,4 +17,6 @@
 
 #define ATOMIC_SEQS_END                0x480
 
-#define FIXED_CODE_END         0x480
+#define SAFE_USER_INSTRUCTION   0x480
+
+#define FIXED_CODE_END         0x490