Add the missing "ax" flag for the exception table. With this the jumps in the exception table are correctly relocated and we no longer have to fix them up during runtime. Remove the now unnecessary arm_fixup_vectors().
Reviewed-by: Ahmad Fatoum <[email protected]> Signed-off-by: Sascha Hauer <[email protected]> --- arch/arm/cpu/exceptions_32.S | 54 +++++--------------------------------- arch/arm/cpu/interrupts_32.c | 5 +--- arch/arm/cpu/mmu_32.c | 2 -- arch/arm/cpu/no-mmu.c | 2 -- arch/arm/include/asm/barebox-arm.h | 4 --- 5 files changed, 8 insertions(+), 59 deletions(-) diff --git a/arch/arm/cpu/exceptions_32.S b/arch/arm/cpu/exceptions_32.S index dc3d42663c..68eb696fc7 100644 --- a/arch/arm/cpu/exceptions_32.S +++ b/arch/arm/cpu/exceptions_32.S @@ -127,58 +127,18 @@ fiq: bad_save_user_regs bl do_fiq -#ifdef CONFIG_ARM_EXCEPTIONS -/* - * With relocatable binary support the runtime exception vectors do not match - * the addresses in the binary. We have to fix them up during runtime - */ -ENTRY(arm_fixup_vectors) - ldr r0, =undefined_instruction - ldr r1, =_undefined_instruction - str r0, [r1] - ldr r0, =software_interrupt - ldr r1, =_software_interrupt - str r0, [r1] - ldr r0, =prefetch_abort - ldr r1, =_prefetch_abort - str r0, [r1] - ldr r0, =data_abort - ldr r1, =_data_abort - str r0, [r1] - ldr r0, =irq - ldr r1, =_irq - str r0, [r1] - ldr r0, =fiq - ldr r1, =_fiq - str r0, [r1] - bx lr -ENDPROC(arm_fixup_vectors) -#endif - -.section .text_exceptions +.section .text_exceptions, "ax" .globl extable extable: 1: b 1b /* barebox_arm_reset_vector */ #ifdef CONFIG_ARM_EXCEPTIONS - ldr pc, _undefined_instruction /* undefined instruction */ - ldr pc, _software_interrupt /* software interrupt (SWI) */ - ldr pc, _prefetch_abort /* prefetch abort */ - ldr pc, _data_abort /* data abort */ + ldr pc, =undefined_instruction /* undefined instruction */ + ldr pc, =software_interrupt /* software interrupt (SWI) */ + ldr pc, =prefetch_abort /* prefetch abort */ + ldr pc, =data_abort /* data abort */ 1: b 1b /* (reserved) */ - ldr pc, _irq /* irq (interrupt) */ - ldr pc, _fiq /* fiq (fast interrupt) */ -.globl _undefined_instruction -_undefined_instruction: .word undefined_instruction -.globl _software_interrupt -_software_interrupt: .word software_interrupt -.globl _prefetch_abort -_prefetch_abort: .word prefetch_abort -.globl _data_abort -_data_abort: .word data_abort -.globl _irq -_irq: .word irq -.globl _fiq -_fiq: .word fiq + ldr pc, =irq /* irq (interrupt) */ + ldr pc, =fiq /* fiq (fast interrupt) */ #else 1: b 1b /* undefined instruction */ 1: b 1b /* software interrupt (SWI) */ diff --git a/arch/arm/cpu/interrupts_32.c b/arch/arm/cpu/interrupts_32.c index 0b88db10fe..af2231f2a7 100644 --- a/arch/arm/cpu/interrupts_32.c +++ b/arch/arm/cpu/interrupts_32.c @@ -231,10 +231,8 @@ static __maybe_unused int arm_init_vectors(void) * First try to use the vectors where they actually are, works * on ARMv7 and later. */ - if (!set_vector_table((unsigned long)__exceptions_start)) { - arm_fixup_vectors(); + if (!set_vector_table((unsigned long)__exceptions_start)) return 0; - } /* * Next try high vectors at 0xffff0000. @@ -265,6 +263,5 @@ void arm_pbl_init_exceptions(void) return; set_vbar((unsigned long)__exceptions_start); - arm_fixup_vectors(); } #endif diff --git a/arch/arm/cpu/mmu_32.c b/arch/arm/cpu/mmu_32.c index eee1385a8f..eae5a878e8 100644 --- a/arch/arm/cpu/mmu_32.c +++ b/arch/arm/cpu/mmu_32.c @@ -528,8 +528,6 @@ void create_vector_table(unsigned long adr) get_pte_flags(MAP_CACHED), true); } - arm_fixup_vectors(); - memset(vectors, 0, PAGE_SIZE); memcpy(vectors, __exceptions_start, __exceptions_stop - __exceptions_start); } diff --git a/arch/arm/cpu/no-mmu.c b/arch/arm/cpu/no-mmu.c index c4ef5d1f9d..8e00cffebf 100644 --- a/arch/arm/cpu/no-mmu.c +++ b/arch/arm/cpu/no-mmu.c @@ -58,8 +58,6 @@ static int nommu_v7_vectors_init(void) cr &= ~CR_V; set_cr(cr); - arm_fixup_vectors(); - vectors = xmemalign(PAGE_SIZE, PAGE_SIZE); memset(vectors, 0, PAGE_SIZE); memcpy(vectors, __exceptions_start, __exceptions_size); diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index e1d89d5684..99f8231194 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -45,12 +45,8 @@ unsigned long arm_mem_membase_get(void); unsigned long arm_mem_endmem_get(void); #ifdef CONFIG_ARM_EXCEPTIONS -void arm_fixup_vectors(void); ulong arm_get_vector_table(void); #else -static inline void arm_fixup_vectors(void) -{ -} static inline ulong arm_get_vector_table(void) { return ~0; -- 2.47.3
