hv_asm: Move SP saving to a variable, per-CPU

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-09-15 22:03:39 +09:00
parent c317b73b8c
commit 6c186f8468
2 changed files with 10 additions and 2 deletions

View file

@ -17,6 +17,8 @@ extern char _hv_vectors_start[0];
u64 hv_tick_interval;
u64 hv_saved_sp[MAX_CPUS];
void hv_init(void)
{
pcie_shutdown();

View file

@ -138,6 +138,8 @@ _v_hv_serr:
b _hv_return
.extern hv_saved_sp
.globl hv_enter_guest
.type hv_enter_guest, @function
hv_enter_guest:
@ -149,8 +151,10 @@ hv_enter_guest:
stp x19, x20, [sp, #-16]!
str x18, [sp, #-16]!
mrs x7, tpidr_el2
ldr x6, =hv_saved_sp
mov x5, sp
msr tpidr_el2, x5
str x5, [x6, x7, LSL #3]
mrs x5, daif
msr daifclr, 3
@ -168,7 +172,9 @@ hv_enter_guest:
.globl hv_exit_guest
.type hv_exit_guest, @function
hv_exit_guest:
mrs x5, tpidr_el2
mrs x7, tpidr_el2
ldr x6, =hv_saved_sp
ldr x5, [x6, x7, LSL #3]
mov sp, x5
ldr x18, [sp], #16