Date: Wed, 28 Aug 2019 23:40:57 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351591 - in head/sys/amd64/vmm: . amd Message-ID: <201908282340.x7SNevUY082420@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Aug 28 23:40:57 2019 New Revision: 351591 URL: https://svnweb.freebsd.org/changeset/base/351591 Log: Use get_pcpu() to fetch the current CPU's pcpu pointer. This avoids encoding knowledge about how pcpu objects are allocated and is also a few instructions shorter. MFC after: 2 weeks Modified: head/sys/amd64/vmm/amd/svm.c head/sys/amd64/vmm/vmm_host.h Modified: head/sys/amd64/vmm/amd/svm.c ============================================================================== --- head/sys/amd64/vmm/amd/svm.c Wed Aug 28 23:31:58 2019 (r351590) +++ head/sys/amd64/vmm/amd/svm.c Wed Aug 28 23:40:57 2019 (r351591) @@ -102,9 +102,6 @@ SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_ static MALLOC_DEFINE(M_SVM, "svm", "svm"); static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); -/* Per-CPU context area. */ -extern struct pcpu __pcpu[]; - static uint32_t svm_feature = ~0U; /* AMD SVM features. */ SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RDTUN, &svm_feature, 0, "SVM features advertised by CPUID.8000000AH:EDX"); @@ -2054,7 +2051,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t /* Launch Virtual Machine. */ VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip); svm_dr_enter_guest(gctx); - svm_launch(vmcb_pa, gctx, &__pcpu[curcpu]); + svm_launch(vmcb_pa, gctx, get_pcpu()); svm_dr_leave_guest(gctx); CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); Modified: head/sys/amd64/vmm/vmm_host.h ============================================================================== --- head/sys/amd64/vmm/vmm_host.h Wed Aug 28 23:31:58 2019 (r351590) +++ head/sys/amd64/vmm/vmm_host.h Wed Aug 28 23:40:57 2019 (r351591) @@ -72,14 +72,11 @@ vmm_get_host_gdtrbase(void) return ((uint64_t)&gdt[NGDT * curcpu]); } -struct pcpu; -extern struct pcpu __pcpu[]; - static __inline uint64_t vmm_get_host_gsbase(void) { - return ((uint64_t)&__pcpu[curcpu]); + return ((uint64_t)get_pcpu()); } #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908282340.x7SNevUY082420>