From owner-svn-src-head@FreeBSD.ORG Fri Apr 11 20:15:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D589565; Fri, 11 Apr 2014 20:15:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 69AA51841; Fri, 11 Apr 2014 20:15:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3BKFsee026235; Fri, 11 Apr 2014 20:15:54 GMT (envelope-from neel@svn.freebsd.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3BKFrT0026232; Fri, 11 Apr 2014 20:15:53 GMT (envelope-from neel@svn.freebsd.org) Message-Id: <201404112015.s3BKFrT0026232@svn.freebsd.org> From: Neel Natu Date: Fri, 11 Apr 2014 20:15:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264353 - head/sys/amd64/vmm/intel X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Apr 2014 20:15:54 -0000 Author: neel Date: Fri Apr 11 20:15:53 2014 New Revision: 264353 URL: http://svnweb.freebsd.org/changeset/base/264353 Log: 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@ Modified: head/sys/amd64/vmm/intel/vmx.h head/sys/amd64/vmm/intel/vmx_genassym.c head/sys/amd64/vmm/intel/vmx_support.S Modified: head/sys/amd64/vmm/intel/vmx.h ============================================================================== --- head/sys/amd64/vmm/intel/vmx.h Fri Apr 11 19:27:35 2014 (r264352) +++ head/sys/amd64/vmm/intel/vmx.h Fri Apr 11 20:15:53 2014 (r264353) @@ -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 */ Modified: head/sys/amd64/vmm/intel/vmx_genassym.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx_genassym.c Fri Apr 11 19:27:35 2014 (r264352) +++ head/sys/amd64/vmm/intel/vmx_genassym.c Fri Apr 11 20:15:53 2014 (r264353) @@ -65,7 +65,6 @@ ASSYM(VMXCTX_HOST_R12, offsetof(struct v 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)); Modified: head/sys/amd64/vmm/intel/vmx_support.S ============================================================================== --- head/sys/amd64/vmm/intel/vmx_support.S Fri Apr 11 19:27:35 2014 (r264352) +++ head/sys/amd64/vmm/intel/vmx_support.S Fri Apr 11 20:15:53 2014 (r264353) @@ -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