|
15 | 15 | #include <asm/kvm_mmu.h>
|
16 | 16 | #include <asm/mmu.h>
|
17 | 17 |
|
| 18 | +.macro save_caller_saved_regs_vect |
| 19 | + /* x0 and x1 were saved in the vector entry */ |
| 20 | + stp x2, x3, [sp, #-16]! |
| 21 | + stp x4, x5, [sp, #-16]! |
| 22 | + stp x6, x7, [sp, #-16]! |
| 23 | + stp x8, x9, [sp, #-16]! |
| 24 | + stp x10, x11, [sp, #-16]! |
| 25 | + stp x12, x13, [sp, #-16]! |
| 26 | + stp x14, x15, [sp, #-16]! |
| 27 | + stp x16, x17, [sp, #-16]! |
| 28 | +.endm |
| 29 | + |
| 30 | +.macro restore_caller_saved_regs_vect |
| 31 | + ldp x16, x17, [sp], #16 |
| 32 | + ldp x14, x15, [sp], #16 |
| 33 | + ldp x12, x13, [sp], #16 |
| 34 | + ldp x10, x11, [sp], #16 |
| 35 | + ldp x8, x9, [sp], #16 |
| 36 | + ldp x6, x7, [sp], #16 |
| 37 | + ldp x4, x5, [sp], #16 |
| 38 | + ldp x2, x3, [sp], #16 |
| 39 | + ldp x0, x1, [sp], #16 |
| 40 | +.endm |
| 41 | + |
18 | 42 | .text
|
19 | 43 |
|
20 | 44 | .macro do_el2_call
|
@@ -157,27 +181,14 @@ el2_sync:
|
157 | 181 |
|
158 | 182 |
|
159 | 183 | el2_error:
|
160 |
| - ldp x0, x1, [sp], #16 |
| 184 | + save_caller_saved_regs_vect |
| 185 | + stp x29, x30, [sp, #-16]! |
| 186 | + |
| 187 | + bl kvm_unexpected_el2_exception |
| 188 | + |
| 189 | + ldp x29, x30, [sp], #16 |
| 190 | + restore_caller_saved_regs_vect |
161 | 191 |
|
162 |
| - /* |
163 |
| - * Only two possibilities: |
164 |
| - * 1) Either we come from the exit path, having just unmasked |
165 |
| - * PSTATE.A: change the return code to an EL2 fault, and |
166 |
| - * carry on, as we're already in a sane state to handle it. |
167 |
| - * 2) Or we come from anywhere else, and that's a bug: we panic. |
168 |
| - * |
169 |
| - * For (1), x0 contains the original return code and x1 doesn't |
170 |
| - * contain anything meaningful at that stage. We can reuse them |
171 |
| - * as temp registers. |
172 |
| - * For (2), who cares? |
173 |
| - */ |
174 |
| - mrs x0, elr_el2 |
175 |
| - adr x1, abort_guest_exit_start |
176 |
| - cmp x0, x1 |
177 |
| - adr x1, abort_guest_exit_end |
178 |
| - ccmp x0, x1, #4, ne |
179 |
| - b.ne __hyp_panic |
180 |
| - mov x0, #(1 << ARM_EXIT_WITH_SERROR_BIT) |
181 | 192 | eret
|
182 | 193 | sb
|
183 | 194 |
|
|
0 commit comments