There is no need to save and restore the host's return address in the
'struct vmxctx'. It is preserved on the host stack across a guest entry and exit and just restoring the host's '%rsp' is sufficient. Pointed out by: grehan@
This commit is contained in:
parent
2ffb755cec
commit
81d597b736
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264353
@ -60,7 +60,6 @@ struct vmxctx {
|
||||
register_t host_rbp;
|
||||
register_t host_rsp;
|
||||
register_t host_rbx;
|
||||
register_t host_rip;
|
||||
/*
|
||||
* XXX todo debug registers and fpu state
|
||||
*/
|
||||
|
@ -65,7 +65,6 @@ ASSYM(VMXCTX_HOST_R12, offsetof(struct vmxctx, host_r12));
|
||||
ASSYM(VMXCTX_HOST_RBP, offsetof(struct vmxctx, host_rbp));
|
||||
ASSYM(VMXCTX_HOST_RSP, offsetof(struct vmxctx, host_rsp));
|
||||
ASSYM(VMXCTX_HOST_RBX, offsetof(struct vmxctx, host_rbx));
|
||||
ASSYM(VMXCTX_HOST_RIP, offsetof(struct vmxctx, host_rip));
|
||||
|
||||
ASSYM(VMXCTX_INST_FAIL_STATUS, offsetof(struct vmxctx, inst_fail_status));
|
||||
ASSYM(VMXCTX_PMAP, offsetof(struct vmxctx, pmap));
|
||||
|
@ -72,8 +72,7 @@
|
||||
*
|
||||
* Assumes that %rdi holds a pointer to the 'vmxctx'.
|
||||
*/
|
||||
#define VMX_HOST_SAVE(tmpreg) \
|
||||
movq (%rsp), tmpreg; /* return address */ \
|
||||
#define VMX_HOST_SAVE \
|
||||
movq %r15, VMXCTX_HOST_R15(%rdi); \
|
||||
movq %r14, VMXCTX_HOST_R14(%rdi); \
|
||||
movq %r13, VMXCTX_HOST_R13(%rdi); \
|
||||
@ -81,9 +80,8 @@
|
||||
movq %rbp, VMXCTX_HOST_RBP(%rdi); \
|
||||
movq %rsp, VMXCTX_HOST_RSP(%rdi); \
|
||||
movq %rbx, VMXCTX_HOST_RBX(%rdi); \
|
||||
movq tmpreg, VMXCTX_HOST_RIP(%rdi)
|
||||
|
||||
#define VMX_HOST_RESTORE(tmpreg) \
|
||||
#define VMX_HOST_RESTORE \
|
||||
movq VMXCTX_HOST_R15(%rdi), %r15; \
|
||||
movq VMXCTX_HOST_R14(%rdi), %r14; \
|
||||
movq VMXCTX_HOST_R13(%rdi), %r13; \
|
||||
@ -91,8 +89,6 @@
|
||||
movq VMXCTX_HOST_RBP(%rdi), %rbp; \
|
||||
movq VMXCTX_HOST_RSP(%rdi), %rsp; \
|
||||
movq VMXCTX_HOST_RBX(%rdi), %rbx; \
|
||||
movq VMXCTX_HOST_RIP(%rdi), tmpreg; \
|
||||
movq tmpreg, (%rsp) /* return address */
|
||||
|
||||
/*
|
||||
* vmx_enter_guest(struct vmxctx *vmxctx, int launched)
|
||||
@ -105,7 +101,7 @@ ENTRY(vmx_enter_guest)
|
||||
/*
|
||||
* Save host state before doing anything else.
|
||||
*/
|
||||
VMX_HOST_SAVE(%r10)
|
||||
VMX_HOST_SAVE
|
||||
|
||||
/*
|
||||
* Activate guest pmap on this cpu.
|
||||
@ -186,7 +182,7 @@ inst_error:
|
||||
movl PCPU(CPUID), %r10d
|
||||
LK btrl %r10d, PM_ACTIVE(%r11)
|
||||
|
||||
VMX_HOST_RESTORE(%r10)
|
||||
VMX_HOST_RESTORE
|
||||
ret
|
||||
END(vmx_enter_guest)
|
||||
|
||||
@ -226,7 +222,7 @@ ENTRY(vmx_exit_guest)
|
||||
movl PCPU(CPUID), %r10d
|
||||
LK btrl %r10d, PM_ACTIVE(%r11)
|
||||
|
||||
VMX_HOST_RESTORE(%r10)
|
||||
VMX_HOST_RESTORE
|
||||
|
||||
/*
|
||||
* This will return to the caller of 'vmx_enter_guest()' with a return
|
||||
|
Loading…
Reference in New Issue
Block a user