aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Getz <robin.getz@analog.com>2007-10-29 06:23:28 -0400
committerBryan Wu <bryan.wu@analog.com>2007-10-29 06:23:28 -0400
commit9f336a53266f43ae1002f4aaad5373944589c828 (patch)
tree8de3512c947eb68d9b0bb2ed7de8cd6be37aecb1
parent15b3ad6a4b348ea53ea1a45f9b166ac31c4b3f39 (diff)
Blackfin arch: ensure that speculative loads of bad pointers don't cause us to do bad things.
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>
-rw-r--r--arch/blackfin/kernel/fixed_code.S14
-rw-r--r--arch/blackfin/kernel/setup.c2
-rw-r--r--arch/blackfin/mach-common/entry.S2
-rw-r--r--include/asm-blackfin/bfin-global.h1
-rw-r--r--include/asm-blackfin/fixed_code.h4
5 files changed, 21 insertions, 2 deletions
diff --git a/arch/blackfin/kernel/fixed_code.S b/arch/blackfin/kernel/fixed_code.S
index d8b1ebc70996..90262691b11a 100644
--- a/arch/blackfin/kernel/fixed_code.S
+++ b/arch/blackfin/kernel/fixed_code.S
@@ -129,4 +129,18 @@ ENTRY(_atomic_xor32)
129 rts; 129 rts;
130ENDPROC (_atomic_ior32) 130ENDPROC (_atomic_ior32)
131 131
132.align 16
133 /*
134 * safe_user_instruction
135 * Four NOPS are enough to allow the pipeline to speculativily load
136 * execute anything it wants. After that, things have gone bad, and
137 * we are stuck - so panic. Since we might be in user space, we can't
138 * call panic, so just cause a unhandled exception, this should cause
139 * a dump of the trace buffer so we can tell were we are, and a reboot
140 */
141ENTRY(_safe_user_instruction)
142 NOP; NOP; NOP; NOP;
143 EXCPT 0x4;
144ENDPROC(_safe_user_instruction)
145
132ENTRY(_fixed_code_end) 146ENTRY(_fixed_code_end)
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index fc22ec8c2f47..934234f43839 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -431,6 +431,8 @@ void __init setup_arch(char **cmdline_p)
431 != ATOMIC_AND32 - FIXED_CODE_START); 431 != ATOMIC_AND32 - FIXED_CODE_START);
432 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start 432 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
433 != ATOMIC_XOR32 - FIXED_CODE_START); 433 != ATOMIC_XOR32 - FIXED_CODE_START);
434 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
435 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
434 436
435 init_exception_vectors(); 437 init_exception_vectors();
436 bf53x_cache_init(); 438 bf53x_cache_init();
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index e3ad5802868a..1b13fa470977 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -917,7 +917,7 @@ ENTRY(_ex_table)
917 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ 917 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
918 .long _ex_replaceable /* 0x02 - User Defined */ 918 .long _ex_replaceable /* 0x02 - User Defined */
919 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */ 919 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
920 .long _ex_replaceable /* 0x04 - User Defined */ 920 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
921 .long _ex_replaceable /* 0x05 - User Defined */ 921 .long _ex_replaceable /* 0x05 - User Defined */
922 .long _ex_replaceable /* 0x06 - User Defined */ 922 .long _ex_replaceable /* 0x06 - User Defined */
923 .long _ex_replaceable /* 0x07 - User Defined */ 923 .long _ex_replaceable /* 0x07 - User Defined */
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h
index 14cb8d35924e..0212e180b90e 100644
--- a/include/asm-blackfin/bfin-global.h
+++ b/include/asm-blackfin/bfin-global.h
@@ -80,6 +80,7 @@ extern int atomic_sub32(void);
80extern int atomic_ior32(void); 80extern int atomic_ior32(void);
81extern int atomic_and32(void); 81extern int atomic_and32(void);
82extern int atomic_xor32(void); 82extern int atomic_xor32(void);
83extern void safe_user_instruction(void);
83extern void sigreturn_stub(void); 84extern void sigreturn_stub(void);
84 85
85extern void *l1_data_A_sram_alloc(size_t); 86extern void *l1_data_A_sram_alloc(size_t);
diff --git a/include/asm-blackfin/fixed_code.h b/include/asm-blackfin/fixed_code.h
index e6df84ee1557..37db66c7030d 100644
--- a/include/asm-blackfin/fixed_code.h
+++ b/include/asm-blackfin/fixed_code.h
@@ -17,4 +17,6 @@
17 17
18#define ATOMIC_SEQS_END 0x480 18#define ATOMIC_SEQS_END 0x480
19 19
20#define FIXED_CODE_END 0x480 20#define SAFE_USER_INSTRUCTION 0x480
21
22#define FIXED_CODE_END 0x490