diff options
author | Helge Deller <deller@gmx.de> | 2013-10-13 15:11:30 -0400 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2013-11-07 16:25:33 -0500 |
commit | 61dbbaeb86c2181c79efae2d186193e0f8008af1 (patch) | |
tree | d12b369af162dcdb8835731b36da025158c8b616 /arch/parisc | |
parent | 5e01dc7b26d9f24f39abace5da98ccbd6a5ceb52 (diff) |
parisc: provide macro to create exception table entries
Provide a macro ASM_EXCEPTIONTABLE_ENTRY() to create exception table
entries and convert all open-coded places to use that macro.
This patch is a first step toward creating a exception table which only
holds 32bit pointers even on a 64bit kernel. That way in my own kernel
I was able to reduce the in-kernel exception table from 44kB to 22kB.
Signed-off-by: Helge Deller <deller@gmx.de>
Diffstat (limited to 'arch/parisc')
-rw-r--r-- | arch/parisc/include/asm/assembly.h | 12 | ||||
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 7 | ||||
-rw-r--r-- | arch/parisc/kernel/syscall.S | 6 | ||||
-rw-r--r-- | arch/parisc/lib/lusercopy.S | 10 | ||||
-rw-r--r-- | arch/parisc/mm/fault.c | 6 |
5 files changed, 27 insertions, 14 deletions
diff --git a/arch/parisc/include/asm/assembly.h b/arch/parisc/include/asm/assembly.h index 0da848232344..b3069fd83468 100644 --- a/arch/parisc/include/asm/assembly.h +++ b/arch/parisc/include/asm/assembly.h | |||
@@ -515,5 +515,17 @@ | |||
515 | nop /* 7 */ | 515 | nop /* 7 */ |
516 | .endm | 516 | .endm |
517 | 517 | ||
518 | /* | ||
519 | * ASM_EXCEPTIONTABLE_ENTRY | ||
520 | * | ||
521 | * Creates an exception table entry. | ||
522 | * Do not convert to a assembler macro. This won't work. | ||
523 | */ | ||
524 | #define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \ | ||
525 | .section __ex_table,"aw" ! \ | ||
526 | ASM_ULONG_INSN fault_addr, except_addr ! \ | ||
527 | .previous | ||
528 | |||
529 | |||
518 | #endif /* __ASSEMBLY__ */ | 530 | #endif /* __ASSEMBLY__ */ |
519 | #endif | 531 | #endif |
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index e0a82358517e..4006964d8e12 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -59,12 +59,13 @@ static inline long access_ok(int type, const void __user * addr, | |||
59 | /* | 59 | /* |
60 | * The exception table contains two values: the first is an address | 60 | * The exception table contains two values: the first is an address |
61 | * for an instruction that is allowed to fault, and the second is | 61 | * for an instruction that is allowed to fault, and the second is |
62 | * the address to the fixup routine. | 62 | * the address to the fixup routine. Even on a 64bit kernel we could |
63 | * use a 32bit (unsigned int) address here. | ||
63 | */ | 64 | */ |
64 | 65 | ||
65 | struct exception_table_entry { | 66 | struct exception_table_entry { |
66 | unsigned long insn; /* address of insn that is allowed to fault. */ | 67 | unsigned long insn; /* address of insn that is allowed to fault. */ |
67 | long fixup; /* fixup routine */ | 68 | unsigned long fixup; /* fixup routine */ |
68 | }; | 69 | }; |
69 | 70 | ||
70 | #define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\ | 71 | #define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\ |
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S index e767ab733e32..a63bb179f79a 100644 --- a/arch/parisc/kernel/syscall.S +++ b/arch/parisc/kernel/syscall.S | |||
@@ -649,10 +649,8 @@ cas_action: | |||
649 | /* Two exception table entries, one for the load, | 649 | /* Two exception table entries, one for the load, |
650 | the other for the store. Either return -EFAULT. | 650 | the other for the store. Either return -EFAULT. |
651 | Each of the entries must be relocated. */ | 651 | Each of the entries must be relocated. */ |
652 | .section __ex_table,"aw" | 652 | ASM_EXCEPTIONTABLE_ENTRY(1b-linux_gateway_page, 3b-linux_gateway_page) |
653 | ASM_ULONG_INSN (1b - linux_gateway_page), (3b - linux_gateway_page) | 653 | ASM_EXCEPTIONTABLE_ENTRY(2b-linux_gateway_page, 3b-linux_gateway_page) |
654 | ASM_ULONG_INSN (2b - linux_gateway_page), (3b - linux_gateway_page) | ||
655 | .previous | ||
656 | 654 | ||
657 | 655 | ||
658 | /* Make sure nothing else is placed on this page */ | 656 | /* Make sure nothing else is placed on this page */ |
diff --git a/arch/parisc/lib/lusercopy.S b/arch/parisc/lib/lusercopy.S index 6f2d9355efe2..a512f07d4feb 100644 --- a/arch/parisc/lib/lusercopy.S +++ b/arch/parisc/lib/lusercopy.S | |||
@@ -88,9 +88,7 @@ ENDPROC(lclear_user) | |||
88 | ldo 1(%r25),%r25 | 88 | ldo 1(%r25),%r25 |
89 | .previous | 89 | .previous |
90 | 90 | ||
91 | .section __ex_table,"aw" | 91 | ASM_EXCEPTIONTABLE_ENTRY(1b,2b) |
92 | ASM_ULONG_INSN 1b,2b | ||
93 | .previous | ||
94 | 92 | ||
95 | .procend | 93 | .procend |
96 | 94 | ||
@@ -129,10 +127,8 @@ ENDPROC(lstrnlen_user) | |||
129 | copy %r24,%r26 /* reset r26 so 0 is returned on fault */ | 127 | copy %r24,%r26 /* reset r26 so 0 is returned on fault */ |
130 | .previous | 128 | .previous |
131 | 129 | ||
132 | .section __ex_table,"aw" | 130 | ASM_EXCEPTIONTABLE_ENTRY(1b,3b) |
133 | ASM_ULONG_INSN 1b,3b | 131 | ASM_EXCEPTIONTABLE_ENTRY(2b,3b) |
134 | ASM_ULONG_INSN 2b,3b | ||
135 | .previous | ||
136 | 132 | ||
137 | .procend | 133 | .procend |
138 | 134 | ||
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 0293588d5b8c..df0d32971cdf 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c | |||
@@ -142,6 +142,12 @@ int fixup_exception(struct pt_regs *regs) | |||
142 | { | 142 | { |
143 | const struct exception_table_entry *fix; | 143 | const struct exception_table_entry *fix; |
144 | 144 | ||
145 | /* If we only stored 32bit addresses in the exception table we can drop | ||
146 | * out if we faulted on a 64bit address. */ | ||
147 | if ((sizeof(regs->iaoq[0]) > sizeof(fix->insn)) | ||
148 | && (regs->iaoq[0] >> 32)) | ||
149 | return 0; | ||
150 | |||
145 | fix = search_exception_tables(regs->iaoq[0]); | 151 | fix = search_exception_tables(regs->iaoq[0]); |
146 | if (fix) { | 152 | if (fix) { |
147 | struct exception_data *d; | 153 | struct exception_data *d; |