diff options
Diffstat (limited to 'utils/hwstub/stub/asm/arm')
-rw-r--r-- | utils/hwstub/stub/asm/arm/system.S | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/utils/hwstub/stub/asm/arm/system.S b/utils/hwstub/stub/asm/arm/system.S index df6b5a2e81..41551a8004 100644 --- a/utils/hwstub/stub/asm/arm/system.S +++ b/utils/hwstub/stub/asm/arm/system.S | |||
@@ -18,32 +18,33 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include "system.h" | ||
21 | 22 | ||
22 | /* Handling of data abort: | 23 | /* Handling of data abort: |
23 | * the code can register a "longjmp" buffer to restore the context in case of | 24 | * the code can register a "longjmp" buffer to restore the context in case of |
24 | * fault */ | 25 | * fault */ |
25 | .data | 26 | .data |
26 | data_abort_jmp_ctx_ptr: | 27 | exception_jmp_ctx_ptr: |
27 | /* buffer contains in order: cpsr,r4-r11,sp,lr,pc */ | 28 | /* buffer contains in order: cpsr,r4-r11,sp,lr,pc */ |
28 | .skip 48 /* = 4 * (cpsr + 11 registers) */ | 29 | .skip 48 /* = 4 * (cpsr + 11 registers) */ |
29 | 30 | ||
30 | .text | 31 | .text |
31 | /* Prototype: int set_data_abort_jmp() | 32 | /* Prototype: int set_exception_jmp() |
32 | * Return: 1 in case of data abort, 0 otherwise */ | 33 | * Return: !=0 in case of exception, 0 otherwise */ |
33 | .global set_data_abort_jmp | 34 | .global set_exception_jmp |
34 | set_data_abort_jmp: | 35 | set_exception_jmp: |
35 | mrs r2, cpsr | 36 | mrs r2, cpsr |
36 | ldr r1, =data_abort_jmp_ctx_ptr | 37 | ldr r1, =exception_jmp_ctx_ptr |
37 | mov r0, #0 | 38 | mov r0, #EXCEPTION_NONE /* nothing to report */ |
38 | stmia r1, {r2,r4-r11,sp,lr,pc} /* see PC note below */ | 39 | stmia r1!, {r2,r4-r11,sp,lr} /* see PC note below */ |
39 | bx lr | 40 | mov r3, pc /* see note below */ |
40 | mov r0, #1 /* <-- PC points here in stmia */ | 41 | str r3, [r1] /* store PC */ |
41 | bx lr | 42 | bx lr /* <-- PC points here in mov */ |
42 | 43 | ||
43 | .global data_abort_handler | 44 | .global data_abort_handler |
44 | data_abort_handler: | 45 | data_abort_handler: |
45 | /* restore everything from context */ | 46 | /* restore everything from context */ |
46 | ldr r1, =data_abort_jmp_ctx_ptr | 47 | ldr r1, =exception_jmp_ctx_ptr |
47 | /* NOTE: we need to restore sp_sys and lr_sys, for this we need the | 48 | /* NOTE: we need to restore sp_sys and lr_sys, for this we need the |
48 | * LDM Rn, {}^ | 49 | * LDM Rn, {}^ |
49 | * variant, but we cannot restore PC from it because ^ has a different | 50 | * variant, but we cannot restore PC from it because ^ has a different |
@@ -54,4 +55,5 @@ data_abort_handler: | |||
54 | * because we do not save the abort address and we don't use an abort stack */ | 55 | * because we do not save the abort address and we don't use an abort stack */ |
55 | ldmia r1, {r0,r4-r11,sp,lr}^ /* this variant cannot have writeback (r1!) */ | 56 | ldmia r1, {r0,r4-r11,sp,lr}^ /* this variant cannot have writeback (r1!) */ |
56 | msr spsr, r0 | 57 | msr spsr, r0 |
57 | ldmia r1, {r0,r4-r11,sp,lr,pc}^ /* reload some registers but we don't care */ | 58 | mov r0, #EXCEPTION_ADDR |
59 | ldmia r1, {r1,r4-r11,sp,lr,pc}^ /* reload some registers but we don't care */ | ||