aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/pxa/patches-2.6.21/032-misalignment-handling.patch
blob: 980d5a6f9e62ae9afd57b23314cb4ac387bb24ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Change the default alingment handling to not be silent failure
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -797,6 +797,8 @@ static int __init alignment_init(void)
 	res->write_proc = proc_alignment_write;
 #endif
 
+	ai_usermode = CONFIG_ALIGNMENT_HANDLING;
+
 	hook_fault_code(1, do_alignment, SIGILL, "alignment exception");
 	hook_fault_code(3, do_alignment, SIGILL, "alignment exception");
 
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -709,6 +709,19 @@ config ALIGNMENT_TRAP
 	  correct operation of some network protocols. With an IP-only
 	  configuration it is safe to say N, otherwise say Y.
 
+config ALIGNMENT_HANDLING
+	hex "Userspace alignment trap handling"
+	default "0x3"
+	depends on ALIGNMENT_TRAP
+	help
+	  How should we handle alignment errors in userspace by default?  This is a bitfield where:
+	  0 - silently ignore alignment errors (will lead to unexpected results)
+	  1 - report alignment errors through printk (will lead to unexpected results, but you'll know about them)
+	  2 - fix the alignment and make things work properly (performance degradation for un-aligned code)
+	  4 - raise SIGBUS on alignment traps
+	  A good number to choose is probably either 3 (work slowly but log message) or 5 (log message and SIGBUS).
+	  You can change the behavior at runtime through /proc/cpu/alignment if you have PROC_FS enabled.
+
 endmenu
 
 menu "Boot options"