|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v3 1/4] x86/HVM: don't (almost) open-code POP_GPRS
It can be used as-is for VMX. For SVM the special treatment of %rax needs
accounting for.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
This is the minimum required as a prereq to the next patch (to avoid the
need for custom adjustments in the two places). We could go further and
switch to using PUSH_AND_CLEAR_GPRS at the same time.
---
v3: New.
--- a/xen/arch/x86/hvm/svm/entry.S
+++ b/xen/arch/x86/hvm/svm/entry.S
@@ -82,22 +82,8 @@ __UNLIKELY_END(nsvm_hap)
*/
sti
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
mov VCPU_svm_vmcb_pa(%rbx),%rax
- pop %rbx
- pop %r11
- pop %r10
- pop %r9
- pop %r8
- pop %rcx /* Skip %rax: restored by VMRUN. */
- pop %rcx
- pop %rdx
- pop %rsi
- pop %rdi
+ POP_GPRS skip_rax=1 /* %rax restored by VMRUN. */
SPEC_CTRL_COND_VERW /* Req: %rsp=eframe Clob:
efl */
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -139,21 +139,7 @@ UNLIKELY_END(realmode)
and $SCF_verw, %eax
or %eax, %ecx
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- pop %r11
- pop %r10
- pop %r9
- pop %r8
- pop %rax
- pop %rcx
- pop %rdx
- pop %rsi
- pop %rdi
+ POP_GPRS /* Preserves flags. */
jpe .L_skip_verw
/* VERW clobbers ZF, but preserves all others, including SF. */
--- a/xen/arch/x86/include/asm/asm_defns.h
+++ b/xen/arch/x86/include/asm/asm_defns.h
@@ -357,7 +357,7 @@ static always_inline void stac(void)
/*
* POP GPRs from a UREGS_* frame on the stack. Does not modify flags.
*/
-.macro POP_GPRS
+.macro POP_GPRS skip_rax=0
pop %r15
pop %r14
pop %r13
@@ -368,7 +368,11 @@ static always_inline void stac(void)
pop %r10
pop %r9
pop %r8
+ .if \skip_rax
+ pop %rcx
+ .else
pop %rax
+ .endif
pop %rcx
pop %rdx
pop %rsi
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |