diff --git a/payloads/libpayload/arch/arm/exception_asm.S b/payloads/libpayload/arch/arm/exception_asm.S index 974d1724b5..7b722cb86f 100644 --- a/payloads/libpayload/arch/arm/exception_asm.S +++ b/payloads/libpayload/arch/arm/exception_asm.S @@ -45,25 +45,44 @@ exception_table: 1: mov sp, $0 b exception_common + +/* Undefined Instruction (CAREFUL: the PC offset is specific to thumb mode!) */ 2: + sub lr, lr, $2 mov sp, $1 b exception_common + +/* Software Interrupt (no PC offset necessary) */ 3: mov sp, $2 b exception_common + +/* Prefetch Abort */ 4: + sub lr, lr, $4 mov sp, $3 b exception_common + +/* Data Abort */ 5: + sub lr, lr, $8 mov sp, $4 b exception_common + +/* (not used) */ 6: mov sp, $5 b exception_common + +/* Interrupt */ 7: + sub lr, lr, $4 mov sp, $6 b exception_common + +/* Fast Interrupt */ 8: + sub lr, lr, $4 mov sp, $7 b exception_common diff --git a/src/arch/arm/armv7/exception.c b/src/arch/arm/armv7/exception.c index b02e5c1892..eedd47d1d5 100644 --- a/src/arch/arm/armv7/exception.c +++ b/src/arch/arm/armv7/exception.c @@ -81,6 +81,7 @@ static void print_regs(uint32_t *regs) void exception_undefined_instruction(uint32_t *regs) { printk(BIOS_ERR, "exception _undefined_instruction\n"); + regs[15] -= 2; /* CAREFUL: specific to thumb mode (otherwise 4)! */ print_regs(regs); dump_stack(regs[13], 512); die("exception"); @@ -97,6 +98,7 @@ void exception_software_interrupt(uint32_t *regs) void exception_prefetch_abort(uint32_t *regs) { printk(BIOS_ERR, "exception _prefetch_abort\n"); + regs[15] -= 4; print_regs(regs); dump_stack(regs[13], 512); die("exception"); @@ -105,6 +107,7 @@ void exception_prefetch_abort(uint32_t *regs) void exception_data_abort(uint32_t *regs) { printk(BIOS_ERR, "exception _data_abort\n"); + regs[15] -= 8; print_regs(regs); dump_stack(regs[13], 512); die("exception"); @@ -121,6 +124,7 @@ void exception_not_used(uint32_t *regs) void exception_irq(uint32_t *regs) { printk(BIOS_ERR, "exception _irq\n"); + regs[15] -= 4; print_regs(regs); dump_stack(regs[13], 512); die("exception"); @@ -129,6 +133,7 @@ void exception_irq(uint32_t *regs) void exception_fiq(uint32_t *regs) { printk(BIOS_ERR, "exception _fiq\n"); + regs[15] -= 4; print_regs(regs); dump_stack(regs[13], 512); die("exception");