]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
x86: Reorder stack layout in svm_vmexit
authorJan Kiszka <jan.kiszka@siemens.com>
Fri, 3 Apr 2015 11:46:28 +0000 (13:46 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 10 Apr 2015 07:00:52 +0000 (09:00 +0200)
Push the guest registers first so that they end up at the same location
on the stack as on Intel. This will allow to address them generically
via the per_cpu structure.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/x86/svm-vmexit.S

index fa16549fe9b791ba9b3bebaf5fb3981724337c6d..c20193e9b2e3ffbd48481a84e41a2703e643a5f0 100644 (file)
@@ -18,9 +18,7 @@
        .globl svm_vmexit
 svm_vmexit:
        /* XXX: GIF is always cleared here */
-       push %rax
-
-       push -PERCPU_STACK_END+1*8+PERCPU_VMCB_RAX(%rsp)
+       push -PERCPU_STACK_END+PERCPU_VMCB_RAX(%rsp)
        push %rcx
        push %rdx
        push %rbx
@@ -38,8 +36,10 @@ svm_vmexit:
        push %r15
 
        mov %rsp,%rdi
-       lea -PERCPU_STACK_END+1*8+16*8(%rsp),%rsi
+       lea -PERCPU_STACK_END+16*8(%rsp),%rsi
+       push %rax
        call vcpu_handle_exit
+       pop %rax
 
        pop %r15
        pop %r14
@@ -56,9 +56,7 @@ svm_vmexit:
        pop %rbx
        pop %rdx
        pop %rcx
-       pop -PERCPU_STACK_END+1*8+PERCPU_VMCB_RAX(%rsp)
-
-       pop %rax
+       pop -PERCPU_STACK_END+PERCPU_VMCB_RAX(%rsp)
 
        vmload %rax
        vmrun %rax