VirtualBox

Changeset 93133 in vbox for trunk


Ignore:
Timestamp:
Jan 6, 2022 1:09:49 PM (3 years ago)
Author:
vboxsync
Message:

VMM,{HMVMXR0.cpp,VMXTemplate.cpp.h}: Make use of the VMX template code in HM, getting rid of the temporary code duplication, bugref:10136 [build fix]

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h

    r93132 r93133  
    19861986 * Enables VMCS shadowing for the given VMCS info. object.
    19871987 *
     1988 * @param   pVCpu       The cross context virtual CPU structure.
    19881989 * @param   pVmcsInfo   The VMCS info. object.
    19891990 *
    19901991 * @remarks No-long-jump zone!!!
    19911992 */
    1992 static void vmxHCEnableVmcsShadowing(PVMXVMCSINFO pVmcsInfo)
     1993static void vmxHCEnableVmcsShadowing(PCVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    19931994{
    19941995    uint32_t uProcCtls2 = pVmcsInfo->u32ProcCtls2;
     
    20092010 * Disables VMCS shadowing for the given VMCS info. object.
    20102011 *
     2012 * @param   pVCpu       The cross context virtual CPU structure.
    20112013 * @param   pVmcsInfo   The VMCS info. object.
    20122014 *
    20132015 * @remarks No-long-jump zone!!!
    20142016 */
    2015 static void vmxHCDisableVmcsShadowing(PVMXVMCSINFO pVmcsInfo)
     2017static void vmxHCDisableVmcsShadowing(PCVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    20162018{
    20172019    /*
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r93132 r93133  
    521521
    522522
     523/**
     524 * Wrapper around VMXWriteVmcs16 taking a pVCpu parameter so VCC doesn't complain about
     525 * unreferenced local parameters in the template code...
     526 */
     527DECL_FORCE_INLINE(int) hmR0VmxWriteVmcs16(PCVMCPUCC pVCpu, uint32_t uFieldEnc, uint16_t u16Val)
     528{
     529    RT_NOREF(pVCpu);
     530    return VMXWriteVmcs16(uFieldEnc, u16Val);
     531}
     532
     533
     534/**
     535 * Wrapper around VMXWriteVmcs32 taking a pVCpu parameter so VCC doesn't complain about
     536 * unreferenced local parameters in the template code...
     537 */
     538DECL_FORCE_INLINE(int) hmR0VmxWriteVmcs32(PCVMCPUCC pVCpu, uint32_t uFieldEnc, uint32_t u32Val)
     539{
     540    RT_NOREF(pVCpu);
     541    return VMXWriteVmcs32(uFieldEnc, u32Val);
     542}
     543
     544
     545/**
     546 * Wrapper around VMXWriteVmcs64 taking a pVCpu parameter so VCC doesn't complain about
     547 * unreferenced local parameters in the template code...
     548 */
     549DECL_FORCE_INLINE(int) hmR0VmxWriteVmcs64(PCVMCPUCC pVCpu, uint32_t uFieldEnc, uint64_t u64Val)
     550{
     551    RT_NOREF(pVCpu);
     552    return VMXWriteVmcs64(uFieldEnc, u64Val);
     553}
     554
     555
     556/**
     557 * Wrapper around VMXReadVmcs16 taking a pVCpu parameter so VCC doesn't complain about
     558 * unreferenced local parameters in the template code...
     559 */
     560DECL_FORCE_INLINE(int) hmR0VmxReadVmcs16(PCVMCPUCC pVCpu, uint32_t uFieldEnc, uint16_t *pu16Val)
     561{
     562    RT_NOREF(pVCpu);
     563    return VMXReadVmcs16(uFieldEnc, pu16Val);
     564}
     565
     566
     567/**
     568 * Wrapper around VMXReadVmcs32 taking a pVCpu parameter so VCC doesn't complain about
     569 * unreferenced local parameters in the template code...
     570 */
     571DECL_FORCE_INLINE(int) hmR0VmxReadVmcs32(PCVMCPUCC pVCpu, uint32_t uFieldEnc, uint32_t *pu32Val)
     572{
     573    RT_NOREF(pVCpu);
     574    return VMXReadVmcs32(uFieldEnc, pu32Val);
     575}
     576
     577
     578/**
     579 * Wrapper around VMXReadVmcs64 taking a pVCpu parameter so VCC doesn't complain about
     580 * unreferenced local parameters in the template code...
     581 */
     582DECL_FORCE_INLINE(int) hmR0VmxReadVmcs64(PCVMCPUCC pVCpu, uint32_t uFieldEnc, uint64_t *pu64Val)
     583{
     584    RT_NOREF(pVCpu);
     585    return VMXReadVmcs64(uFieldEnc, pu64Val);
     586}
     587
     588
    523589/*
    524590 * Instantiate the code we share with the NEM darwin backend.
     
    532598#define VM_IS_VMX_LBR(a_pVM)                (a_pVM)->hmr0.s.vmx.fLbr
    533599
    534 #define VMX_VMCS_WRITE_16(a_pVCpu, a_FieldEnc, a_Val) VMXWriteVmcs16((a_FieldEnc), (a_Val))
    535 #define VMX_VMCS_WRITE_32(a_pVCpu, a_FieldEnc, a_Val) VMXWriteVmcs32((a_FieldEnc), (a_Val))
    536 #define VMX_VMCS_WRITE_64(a_pVCpu, a_FieldEnc, a_Val) VMXWriteVmcs64((a_FieldEnc), (a_Val))
    537 #define VMX_VMCS_WRITE_NW(a_pVCpu, a_FieldEnc, a_Val) VMXWriteVmcsNw((a_FieldEnc), (a_Val))
    538 
    539 #define VMX_VMCS_READ_16(a_pVCpu, a_FieldEnc, a_pVal) VMXReadVmcs16((a_FieldEnc), (a_pVal))
    540 #define VMX_VMCS_READ_32(a_pVCpu, a_FieldEnc, a_pVal) VMXReadVmcs32((a_FieldEnc), (a_pVal))
    541 #define VMX_VMCS_READ_64(a_pVCpu, a_FieldEnc, a_pVal) VMXReadVmcs64((a_FieldEnc), (a_pVal))
    542 #define VMX_VMCS_READ_NW(a_pVCpu, a_FieldEnc, a_pVal) VMXReadVmcsNw((a_FieldEnc), (a_pVal))
     600#define VMX_VMCS_WRITE_16(a_pVCpu, a_FieldEnc, a_Val) hmR0VmxWriteVmcs16((a_pVCpu), (a_FieldEnc), (a_Val))
     601#define VMX_VMCS_WRITE_32(a_pVCpu, a_FieldEnc, a_Val) hmR0VmxWriteVmcs32((a_pVCpu), (a_FieldEnc), (a_Val))
     602#define VMX_VMCS_WRITE_64(a_pVCpu, a_FieldEnc, a_Val) hmR0VmxWriteVmcs64((a_pVCpu), (a_FieldEnc), (a_Val))
     603#define VMX_VMCS_WRITE_NW(a_pVCpu, a_FieldEnc, a_Val) hmR0VmxWriteVmcs64((a_pVCpu), (a_FieldEnc), (a_Val))
     604
     605#define VMX_VMCS_READ_16(a_pVCpu, a_FieldEnc, a_pVal) hmR0VmxReadVmcs16((a_pVCpu), (a_FieldEnc), (a_pVal))
     606#define VMX_VMCS_READ_32(a_pVCpu, a_FieldEnc, a_pVal) hmR0VmxReadVmcs32((a_pVCpu), (a_FieldEnc), (a_pVal))
     607#define VMX_VMCS_READ_64(a_pVCpu, a_FieldEnc, a_pVal) hmR0VmxReadVmcs64((a_pVCpu), (a_FieldEnc), (a_pVal))
     608#define VMX_VMCS_READ_NW(a_pVCpu, a_FieldEnc, a_pVal) hmR0VmxReadVmcs64((a_pVCpu), (a_FieldEnc), (a_pVal))
    543609
    544610#include "../VMMAll/VMXAllTemplate.cpp.h"
     
    36653731                    pVCpu->hm.s.vmx.fCopiedNstGstToShadowVmcs = true;
    36663732                }
    3667                 vmxHCEnableVmcsShadowing(pVmcsInfo);
     3733                vmxHCEnableVmcsShadowing(pVCpu, pVmcsInfo);
    36683734            }
    36693735            else
    3670                 vmxHCDisableVmcsShadowing(pVmcsInfo);
     3736                vmxHCDisableVmcsShadowing(pVCpu, pVmcsInfo);
    36713737        }
    36723738#else
     
    60216087     * Check and process force flag actions, some of which might require us to go back to ring-3.
    60226088     */
    6023     VBOXSTRICTRC rcStrict = vmxHCCheckForceFlags(pVCpu, pVmxTransient, fStepping);
     6089    VBOXSTRICTRC rcStrict = vmxHCCheckForceFlags(pVCpu, pVmxTransient->fIsNestedGuest, fStepping);
    60246090    if (rcStrict == VINF_SUCCESS)
    60256091    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette