Skip to content

Commit 5dd612e

Browse files
hdellerAlex Shi
authored andcommitted
parisc: Use generic extable search and sort routines
Switch to the generic extable search and sort routines which were introduced with commit a272858 from Ard Biesheuvel. This saves quite some memory in the vmlinux binary with the 64bit kernel. Signed-off-by: Helge Deller <deller@gmx.de> (cherry picked from commit 0de798584bdedfdad19db21e3c7aec84f252f4f3) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 200d9e7 commit 5dd612e

5 files changed

Lines changed: 9 additions & 11 deletions

File tree

arch/parisc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ config PARISC
1111
select RTC_DRV_GENERIC
1212
select INIT_ALL_POSSIBLE
1313
select BUG
14+
select BUILDTIME_EXTABLE_SORT
1415
select HAVE_PERF_EVENTS
1516
select GENERIC_ATOMIC64 if !64BIT
1617
select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE

arch/parisc/include/asm/assembly.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@
523523
*/
524524
#define ASM_EXCEPTIONTABLE_ENTRY(fault_addr, except_addr) \
525525
.section __ex_table,"aw" ! \
526-
ASM_ULONG_INSN fault_addr, except_addr ! \
526+
.word (fault_addr - .), (except_addr - .) ! \
527527
.previous
528528

529529

arch/parisc/include/asm/uaccess.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@ static inline long access_ok(int type, const void __user * addr,
6060
* use a 32bit (unsigned int) address here.
6161
*/
6262

63+
#define ARCH_HAS_RELATIVE_EXTABLE
6364
struct exception_table_entry {
64-
unsigned long insn; /* address of insn that is allowed to fault. */
65-
unsigned long fixup; /* fixup routine */
65+
int insn; /* relative address of insn that is allowed to fault. */
66+
int fixup; /* relative address of fixup routine */
6667
};
6768

6869
#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
6970
".section __ex_table,\"aw\"\n" \
70-
ASM_WORD_INSN #fault_addr ", " #except_addr "\n\t" \
71+
".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \
7172
".previous\n"
7273

7374
/*

arch/parisc/mm/fault.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ int fixup_exception(struct pt_regs *regs)
140140
{
141141
const struct exception_table_entry *fix;
142142

143-
/* If we only stored 32bit addresses in the exception table we can drop
144-
* out if we faulted on a 64bit address. */
145-
if ((sizeof(regs->iaoq[0]) > sizeof(fix->insn))
146-
&& (regs->iaoq[0] >> 32))
147-
return 0;
148-
149143
fix = search_exception_tables(regs->iaoq[0]);
150144
if (fix) {
151145
struct exception_data *d;
@@ -155,7 +149,8 @@ int fixup_exception(struct pt_regs *regs)
155149
d->fault_space = regs->isr;
156150
d->fault_addr = regs->ior;
157151

158-
regs->iaoq[0] = ((fix->fixup) & ~3);
152+
regs->iaoq[0] = (unsigned long)&fix->fixup + fix->fixup;
153+
regs->iaoq[0] &= ~3;
159154
/*
160155
* NOTE: In some cases the faulting instruction
161156
* may be in the delay slot of a branch. We

scripts/sortextable.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ do_file(char const *const fname)
283283
case EM_X86_64:
284284
case EM_S390:
285285
case EM_AARCH64:
286+
case EM_PARISC:
286287
custom_sort = sort_relative_table;
287288
break;
288289
case EM_ARCOMPACT:

0 commit comments

Comments
 (0)