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/atj213x/crt0.S | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'utils/hwstub/stub/atj213x/crt0.S') diff --git a/utils/hwstub/stub/atj213x/crt0.S b/utils/hwstub/stub/atj213x/crt0.S index 93cc57fc5e..5a3c81dc78 100644 --- a/utils/hwstub/stub/atj213x/crt0.S +++ b/utils/hwstub/stub/atj213x/crt0.S @@ -1,4 +1,5 @@ #include "mips.h" +#include "system.h" .extern main .global start @@ -134,12 +135,12 @@ stack_munge_loop: jr.hb t0 ei - .extern data_abort_jmp_ctx_ptr + .extern exception_jmp_ctx_ptr .global tlb_refill_handler .section .exception.tlb_refill,"ax",%progbits tlb_refill_handler: - la k1, data_abort_jmp_ctx_ptr + la k1, exception_jmp_ctx_ptr lw s0, 0(k1) lw s1, 4(k1) lw s2, 8(k1) @@ -153,7 +154,7 @@ tlb_refill_handler: lw k1, 40(k1) mtc0 k1, C0_EPC ehb - li v0, 1 + li v0, EXCEPTION_ADDR eret nop @@ -161,7 +162,7 @@ tlb_refill_handler: .section .exception.cache_error,"ax",%progbits cache_error_handler: - la k1, data_abort_jmp_ctx_ptr + la k1, exception_jmp_ctx_ptr lw s0, 0(k1) lw s1, 4(k1) lw s2, 8(k1) @@ -175,7 +176,7 @@ cache_error_handler: lw k1, 40(k1) mtc0 k1, C0_EPC ehb - li v0, 1 + li v0, EXCEPTION_ADDR eret nop @@ -183,7 +184,7 @@ cache_error_handler: .section .exception.general_exception,"ax",%progbits general_exception_handler: - la k1, data_abort_jmp_ctx_ptr + la k1, exception_jmp_ctx_ptr lw s0, 0(k1) lw s1, 4(k1) lw s2, 8(k1) @@ -197,7 +198,7 @@ general_exception_handler: lw k1, 40(k1) mtc0 k1, C0_EPC ehb - li v0, 1 + li v0, EXCEPTION_UNSP eret nop -- cgit v1.2.3