|
11 | 11 | .set MODE_SYS, 0x1F |
12 | 12 | |
13 | 13 |
|
14 | | - .equ I_F_BIT, 0xC0 |
15 | | - .equ MASK_SWI_NUM, 0xFF000000 |
| 14 | + .equ I_F_BIT, 0xC0 |
16 | 15 | .equ MASK_SR_MODE, 0x1F |
17 | 16 |
|
18 | 17 | @ This will be placed at 0xffff0000 by the linker script |
@@ -52,6 +51,12 @@ UnknownExceptionHandler: |
52 | 51 | @ Save r0-r12, lr |
53 | 52 | stmfd sp!, {r0-r12, lr} |
54 | 53 | mov r7, #EV3_PANIC_UNKNOWN |
| 54 | + b CommonPanicHandler |
| 55 | + |
| 56 | +SWIHandler: |
| 57 | + @ Save r0-r12, lr |
| 58 | + stmfd sp!, {r0-r12, lr} |
| 59 | + mov r7, #EV3_PANIC_SWI |
55 | 60 | @ b CommonPanicHandler |
56 | 61 | @ fall through |
57 | 62 |
|
@@ -87,25 +92,7 @@ FIQHandler: |
87 | 92 | MOV lr, pc |
88 | 93 | LDR pc, [r0] |
89 | 94 | LDMFD r13!, {r0-r7, lr} |
90 | | - SUBS pc, lr, #0x4 |
91 | | - |
92 | | -@****************************************************************************** |
93 | | -@* Function Definition of SWI Handler |
94 | | -@****************************************************************************** |
95 | | -@ |
96 | | -@ The SWI Handler switches to system mode if the SWI number is 458752. If the |
97 | | -@ SWI number is different, no mode switching will be done. No other SWI are |
98 | | -@ handled here |
99 | | -@ |
100 | | -SWIHandler: |
101 | | - STMFD r13!, {r0-r1, r14} @ Save context in SVC stack |
102 | | - LDR r0, [r14, #-4] @ R0 points to SWI instruction |
103 | | - BIC r0, r0, #MASK_SWI_NUM @ Get the SWI number |
104 | | - CMP r0, #458752 |
105 | | - MRSEQ r1, spsr @ Copy SPSR |
106 | | - ORREQ r1, r1, #0x1F @ Change the mode to System |
107 | | - MSREQ spsr_cf, r1 @ Restore SPSR |
108 | | - LDMFD r13!, {r0-r1, pc}^ @ Restore registers from IRQ stack |
| 95 | + SUBS pc, lr, #0x4 |
109 | 96 |
|
110 | 97 | @****************************************************************************** |
111 | 98 | @* Function Definition of IRQ Handler |
|
0 commit comments