From 9bb6050d40b9936beda5cb1cd15040f6c1b07179 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Wed, 18 Jan 2017 14:36:27 +0100 Subject: hwstub: rewrite exception catching Since we can catch exceptions like data aborts on read/write, it takes very little to also catch exceptions in calls. When extending this with the catching of illegal instructions, the call instruction now becomes much more robust and also for address and instruction probing. Since we can catch several types of exception, rename set_data_abort_jmp to set_exception_jmp. At the same time, simplify the logic in read/write request handlers. Also fix a bug in ARM jump code: it was using stmia r1, {..., pc} as if pc would get current pc + 8 but this is actually implementation defined on older ARMs (typically pc + 12) and deprecated on newer ARMs, so rewrite the code avoid that. The set_exception_jmp() function now also reports the exception type. Change-Id: Icd0dd52d2456b361b27c4776be09c3d13528ed93 --- utils/hwstub/stub/jz4760b/crt0.S | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'utils/hwstub/stub/jz4760b/crt0.S') diff --git a/utils/hwstub/stub/jz4760b/crt0.S b/utils/hwstub/stub/jz4760b/crt0.S index 94d95b3e73..4e1bcc5dbc 100644 --- a/utils/hwstub/stub/jz4760b/crt0.S +++ b/utils/hwstub/stub/jz4760b/crt0.S @@ -1,4 +1,5 @@ #include "mips.h" +#include "system.h" .extern main .global start @@ -137,26 +138,30 @@ die_blink: j .blink_loop nop -/* restore_data_abort_jmp restores the context and returns from exception */ - .extern restore_data_abort_jmp +/* restore_exception_jmp restores the context and returns from exception, it takes + * as argument the type of exception */ + .extern restore_exception_jmp .global tlb_refill_handler .section .exception.tlb_refill,"ax",%progbits tlb_refill_handler: - la k0, restore_data_abort_jmp + li a0, EXCEPTION_ADDR + la k0, restore_exception_jmp jr k0 nop .global cache_error_handler .section .exception.cache_error,"ax",%progbits cache_error_handler: - la k0, restore_data_abort_jmp + li a0, EXCEPTION_ADDR + la k0, restore_exception_jmp jr k0 nop .global general_exception_handler .section .exception.general_exception,"ax",%progbits general_exception_handler: - la k0, restore_data_abort_jmp + li a0, EXCEPTION_UNSP + la k0, restore_exception_jmp jr k0 nop -- cgit v1.2.3