VirtualBox

Changeset 72462 in vbox for trunk


Ignore:
Timestamp:
Jun 6, 2018 2:24:04 PM (7 years ago)
Author:
vboxsync
Message:

EM,IEM,HM: Consolidated VMMHypercallsDisable/VMMHypercallsEnable into EMSetHypercallInstructionsEnabled and made the information available thru EMAreHypercallInstructionsEnabled(). Adjusted the vmmcall implementation so it works without HM. bugref:9044

Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/em.h

    r72327 r72462  
    177177VMMDECL(void)                   EMSetInhibitInterruptsPC(PVMCPU pVCpu, RTGCUINTPTR PC);
    178178VMMDECL(RTGCUINTPTR)            EMGetInhibitInterruptsPC(PVMCPU pVCpu);
     179VMMDECL(void)                   EMSetHypercallInstructionsEnabled(PVMCPU pVCpu, bool fEnabled);
     180VMMDECL(bool)                   EMAreHypercallInstructionsEnabled(PVMCPU pVCpu);
     181
    179182VMM_INT_DECL(int)               EMInterpretDisasCurrent(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pCpu, unsigned *pcbInstr);
    180183VMM_INT_DECL(int)               EMInterpretDisasOneEx(PVM pVM, PVMCPU pVCpu, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore,
  • trunk/include/VBox/vmm/hm.h

    r71529 r72462  
    150150VMM_INT_DECL(int)               HMAmdIsSubjectToErratum170(uint32_t *pu32Family, uint32_t *pu32Model, uint32_t *pu32Stepping);
    151151VMM_INT_DECL(bool)              HMSetSingleInstruction(PVM pVM, PVMCPU pVCpu, bool fEnable);
    152 VMM_INT_DECL(void)              HMHypercallsEnable(PVMCPU pVCpu);
    153 VMM_INT_DECL(void)              HMHypercallsDisable(PVMCPU pVCpu);
    154152/** @} */
    155153
     
    165163                                                         uint8_t cAddrSizeBits, uint8_t iEffSeg, bool fRep, bool fStrIo,
    166164                                                         PSVMIOIOEXITINFO pIoExitInfo);
    167 VMM_INT_DECL(VBOXSTRICTRC)      HMSvmVmmcall(PVMCPU pVCpu, PCPUMCTX pCtx, bool *pfRipUpdated);
     165VMM_INT_DECL(int)               HMHCSvmMaybeMovTprHypercall(PVMCPU pVCpu, PCPUMCTX pCtx);
    168166/** @} */
    169167
  • trunk/include/VBox/vmm/vmm.h

    r72300 r72462  
    287287VMM_INT_DECL(void)          VMMTrashVolatileXMMRegs(void);
    288288VMM_INT_DECL(int)           VMMPatchHypercall(PVM pVM, void *pvBuf, size_t cbBuf, size_t *pcbWritten);
    289 VMM_INT_DECL(void)          VMMHypercallsEnable(PVMCPU pVCpu);
    290 VMM_INT_DECL(void)          VMMHypercallsDisable(PVMCPU pVCpu);
    291289
    292290
  • trunk/src/VBox/VMM/VMMAll/EMAll.cpp

    r72208 r72462  
    170170{
    171171    return pVCpu->em.s.GCPtrInhibitInterrupts;
     172}
     173
     174
     175/**
     176 * Enables / disable hypercall instructions.
     177 *
     178 * This interface is used by GIM to tell the execution monitors whether the
     179 * hypercall instruction (VMMCALL & VMCALL) are allowed or should \#UD.
     180 *
     181 * @param   pVCpu       The cross context virtual CPU structure this applies to.
     182 * @param   fEnabled    Whether hypercall instructions are enabled (true) or not.
     183 */
     184VMMDECL(void) EMSetHypercallInstructionsEnabled(PVMCPU pVCpu, bool fEnabled)
     185{
     186    pVCpu->em.s.fHypercallEnabled = fEnabled;
     187}
     188
     189
     190/**
     191 * Checks if hypercall instructions (VMMCALL & VMCALL) are enabled or not.
     192 *
     193 * @returns true if enabled, false if not.
     194 * @param   pVCpu   The cross context virtual CPU structure.
     195 *
     196 * @note    If this call becomes a performance factor, we can make the data
     197 *          field available thru a read-only view in VMCPU.  See VM::cpum.ro.
     198 */
     199VMMDECL(bool) EMAreHypercallInstructionsEnabled(PVMCPU pVCpu)
     200{
     201    return pVCpu->em.s.fHypercallEnabled;
    172202}
    173203
  • trunk/src/VBox/VMM/VMMAll/GIMAllHv.cpp

    r72190 r72462  
    3030#include <VBox/vmm/pgm.h>
    3131#include <VBox/vmm/apic.h>
     32#include <VBox/vmm/em.h>
    3233#include "GIMHvInternal.h"
    3334#include "GIMInternal.h"
     
    793794
    794795            /*
    795              * Notify VMM that hypercalls are now disabled/enabled.
     796             * Update EM on hypercall instruction enabled state.
    796797             */
    797             for (VMCPUID i = 0; i < pVM->cCpus; i++)
    798             {
    799                 if (uRawValue)
    800                     VMMHypercallsEnable(&pVM->aCpus[i]);
    801                 else
    802                     VMMHypercallsDisable(&pVM->aCpus[i]);
    803             }
     798            if (uRawValue)
     799                for (VMCPUID i = 0; i < pVM->cCpus; i++)
     800                    EMSetHypercallInstructionsEnabled(&pVM->aCpus[i], true);
     801            else
     802                for (VMCPUID i = 0; i < pVM->cCpus; i++)
     803                    EMSetHypercallInstructionsEnabled(&pVM->aCpus[i], false);
    804804
    805805            return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/HMAll.cpp

    r72343 r72462  
    516516
    517517/**
    518  * Notifies HM that paravirtualized hypercalls are now enabled.
    519  *
    520  * @param   pVCpu   The cross context virtual CPU structure.
    521  */
    522 VMM_INT_DECL(void) HMHypercallsEnable(PVMCPU pVCpu)
    523 {
    524     pVCpu->hm.s.fHypercallsEnabled = true;
    525 }
    526 
    527 
    528 /**
    529  * Notifies HM that paravirtualized hypercalls are now disabled.
    530  *
    531  * @param   pVCpu   The cross context virtual CPU structure.
    532  */
    533 VMM_INT_DECL(void) HMHypercallsDisable(PVMCPU pVCpu)
    534 {
    535     pVCpu->hm.s.fHypercallsEnabled = false;
    536 }
    537 
    538 
    539 /**
    540518 * Notifies HM that GIM provider wants to trap \#UD.
    541519 *
  • trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp

    r72079 r72462  
    3232
    3333#ifndef IN_RC
     34
    3435/**
    3536 * Emulates a simple MOV TPR (CR8) instruction.
     
    4344 *
    4445 * @returns VBox status code.
    45  * @retval VINF_SUCCESS if the access was handled successfully.
     46 * @retval VINF_SUCCESS if the access was handled successfully, RIP + RFLAGS updated.
    4647 * @retval VERR_NOT_FOUND if no patch record for this RIP could be found.
    4748 * @retval VERR_SVM_UNEXPECTED_PATCH_TYPE if the found patch type is invalid.
     
    4950 * @param   pVCpu               The cross context virtual CPU structure.
    5051 * @param   pCtx                Pointer to the guest-CPU context.
    51  * @param   pfUpdateRipAndRF    Whether the guest RIP/EIP has been updated as
    52  *                              part of the TPR patch operation.
    53  */
    54 static int hmSvmEmulateMovTpr(PVMCPU pVCpu, PCPUMCTX pCtx, bool *pfUpdateRipAndRF)
     52 */
     53int hmSvmEmulateMovTpr(PVMCPU pVCpu, PCPUMCTX pCtx)
    5554{
    5655    Log4(("Emulated VMMCall TPR access replacement at RIP=%RGv\n", pCtx->rip));
     
    6059     * and the new RIP may be a patched instruction which needs emulation as well.
    6160     */
    62     bool fUpdateRipAndRF = false;
    63     bool fPatchFound     = false;
     61    bool fPatchFound = false;
    6462    PVM  pVM = pVCpu->CTX_SUFF(pVM);
    6563    for (;;)
    6664    {
    67         bool    fPending;
    68         uint8_t u8Tpr;
    69 
    7065        PHMTPRPATCH pPatch = (PHMTPRPATCH)RTAvloU32Get(&pVM->hm.s.PatchTree, (AVLOU32KEY)pCtx->eip);
    7166        if (!pPatch)
    7267            break;
    73 
    7468        fPatchFound = true;
     69
     70        uint8_t u8Tpr;
    7571        switch (pPatch->enmType)
    7672        {
    7773            case HMTPRINSTR_READ:
    7874            {
    79                 int rc = APICGetTpr(pVCpu, &u8Tpr, &fPending, NULL /* pu8PendingIrq */);
     75                bool fPending;
     76                int  rc = APICGetTpr(pVCpu, &u8Tpr, &fPending, NULL /* pu8PendingIrq */);
    8077                AssertRC(rc);
    8178
     
    8481                pCtx->rip += pPatch->cbOp;
    8582                pCtx->eflags.Bits.u1RF = 0;
    86                 fUpdateRipAndRF = true;
    8783                break;
    8884            }
     
    107103                pCtx->rip += pPatch->cbOp;
    108104                pCtx->eflags.Bits.u1RF = 0;
    109                 fUpdateRipAndRF = true;
    110105                break;
    111106            }
     
    115110                AssertMsgFailed(("Unexpected patch type %d\n", pPatch->enmType));
    116111                pVCpu->hm.s.u32HMError = pPatch->enmType;
    117                 *pfUpdateRipAndRF = fUpdateRipAndRF;
    118112                return VERR_SVM_UNEXPECTED_PATCH_TYPE;
    119113            }
     
    121115    }
    122116
    123     *pfUpdateRipAndRF = fUpdateRipAndRF;
    124     if (fPatchFound)
    125         return VINF_SUCCESS;
    126     return VERR_NOT_FOUND;
     117    return fPatchFound ? VINF_SUCCESS : VERR_NOT_FOUND;
    127118}
    128119
     
    224215    return uTicks + pVmcbNstGstCache->u64TSCOffset;
    225216}
    226 #endif /* !IN_RC */
    227 
    228 
    229 /**
    230  * Performs the operations necessary that are part of the vmmcall instruction
    231  * execution in the guest.
    232  *
    233  * @returns Strict VBox status code (i.e. informational status codes too).
    234  * @retval  VINF_SUCCESS on successful handling, no \#UD needs to be thrown,
    235  *          update RIP and eflags.RF depending on @a pfUpdatedRipAndRF and
    236  *          continue guest execution.
    237  * @retval  VINF_GIM_HYPERCALL_CONTINUING continue hypercall without updating
    238  *          RIP.
    239  * @retval  VINF_GIM_R3_HYPERCALL re-start the hypercall from ring-3.
     217
     218
     219/**
     220 * Interface used by IEM to handle patched TPR accesses.
     221 *
     222 * @returns VBox status code
     223 * @retval  VINF_SUCCESS if hypercall was handled, RIP + RFLAGS all dealt with.
     224 * @retval  VERR_NOT_FOUND if hypercall was _not_ handled.
     225 * @retval  VERR_SVM_UNEXPECTED_PATCH_TYPE on IPE.
    240226 *
    241227 * @param   pVCpu               The cross context virtual CPU structure.
    242228 * @param   pCtx                Pointer to the guest-CPU context.
    243  * @param   pfUpdatedRipAndRF   Whether the guest RIP/EIP has been updated as
    244  *                              part of handling the VMMCALL operation.
    245  */
    246 VMM_INT_DECL(VBOXSTRICTRC) HMSvmVmmcall(PVMCPU pVCpu, PCPUMCTX pCtx, bool *pfUpdatedRipAndRF)
    247 {
    248 #ifndef IN_RC
    249     /*
    250      * TPR patched instruction emulation for 32-bit guests.
    251      */
     229 */
     230VMM_INT_DECL(int) HMHCSvmMaybeMovTprHypercall(PVMCPU pVCpu, PCPUMCTX pCtx)
     231{
    252232    PVM pVM = pVCpu->CTX_SUFF(pVM);
    253233    if (pVM->hm.s.fTprPatchingAllowed)
    254234    {
    255         int rc = hmSvmEmulateMovTpr(pVCpu, pCtx, pfUpdatedRipAndRF);
     235        int rc = hmSvmEmulateMovTpr(pVCpu, pCtx);
    256236        if (RT_SUCCESS(rc))
    257237            return VINF_SUCCESS;
    258 
    259         if (rc != VERR_NOT_FOUND)
    260         {
    261             Log(("hmSvmExitVmmCall: hmSvmEmulateMovTpr returns %Rrc\n", rc));
    262             return rc;
    263         }
    264     }
    265 #endif
    266 
    267     /*
    268      * Paravirtualized hypercalls.
    269      */
    270     *pfUpdatedRipAndRF = false;
    271     if (pVCpu->hm.s.fHypercallsEnabled)
    272         return GIMHypercall(pVCpu, pCtx);
    273 
    274     return VERR_NOT_AVAILABLE;
    275 }
    276 
     238        return rc;
     239    }
     240    return VERR_NOT_FOUND;
     241}
     242
     243#endif /* !IN_RC */
    277244
    278245/**
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h

    r72451 r72462  
    10901090
    10911091/**
     1092 * Common code for iemCImpl_vmmcall and iemCImpl_vmcall (latter in IEMAllCImplVmxInstr.cpp.h).
     1093 */
     1094IEM_CIMPL_DEF_0(iemCImpl_Hypercall)
     1095{
     1096    if (EMAreHypercallInstructionsEnabled(pVCpu))
     1097    {
     1098        VBOXSTRICTRC rcStrict = GIMHypercall(pVCpu, IEM_GET_CTX(pVCpu));
     1099        if (RT_SUCCESS(rcStrict))
     1100        {
     1101            if (rcStrict == VINF_SUCCESS)
     1102                iemRegAddToRipAndClearRF(pVCpu, cbInstr);
     1103            if (   rcStrict == VINF_SUCCESS
     1104                || rcStrict == VINF_GIM_HYPERCALL_CONTINUING)
     1105                return VINF_SUCCESS;
     1106            AssertMsgReturn(rcStrict == VINF_GIM_R3_HYPERCALL, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IEM_IPE_4);
     1107            return rcStrict;
     1108        }
     1109        AssertMsgReturn(   rcStrict == VERR_GIM_HYPERCALL_ACCESS_DENIED
     1110                        || rcStrict == VERR_GIM_HYPERCALLS_NOT_AVAILABLE
     1111                        || rcStrict == VERR_GIM_NOT_ENABLED
     1112                        || rcStrict == VERR_GIM_HYPERCALL_MEMORY_READ_FAILED
     1113                        || rcStrict == VERR_GIM_HYPERCALL_MEMORY_WRITE_FAILED,
     1114                        ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IEM_IPE_4);
     1115
     1116        /* Raise #UD on all failures. */
     1117    }
     1118    return iemRaiseUndefinedOpcode(pVCpu);
     1119}
     1120
     1121/**
    10921122 * Implements 'VMMCALL'.
    10931123 */
    10941124IEM_CIMPL_DEF_0(iemCImpl_vmmcall)
    10951125{
    1096     PCPUMCTX pCtx = IEM_GET_CTX(pVCpu);
    10971126    if (IEM_IS_SVM_CTRL_INTERCEPT_SET(pVCpu, SVM_CTRL_INTERCEPT_VMMCALL))
    10981127    {
     
    11011130    }
    11021131
    1103     bool fUpdatedRipAndRF;
    1104     VBOXSTRICTRC rcStrict = HMSvmVmmcall(pVCpu, pCtx, &fUpdatedRipAndRF);
    1105     if (RT_SUCCESS(rcStrict))
    1106     {
    1107         if (!fUpdatedRipAndRF)
    1108             iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    1109         return rcStrict;
    1110     }
    1111 
    1112     return iemRaiseUndefinedOpcode(pVCpu);
     1132#ifndef IN_RC
     1133    /* This is a little bit more complicated than the VT-x version because HM/SVM may
     1134       patch MOV CR8 instructions too speed up APIC.TPR access for 32-bit windows guests. */
     1135    if (VM_IS_HM_ENABLED(pVCpu->CTX_SUFF(pVM)))
     1136    {
     1137        int rc = HMHCSvmMaybeMovTprHypercall(pVCpu, IEM_GET_CTX(pVCpu));
     1138        if (RT_SUCCESS(rc))
     1139        {
     1140            Log(("vmmcall: MovTrp\n"));
     1141            return VINF_SUCCESS;
     1142        }
     1143    }
     1144#endif
     1145
     1146    /* Join forces with vmcall. */
     1147    return IEM_CIMPL_CALL_0(iemCImpl_Hypercall);
    11131148}
    11141149
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h

    r72453 r72462  
    2222IEM_CIMPL_DEF_0(iemCImpl_vmcall)
    2323{
    24     if (true /*EMAreHypercallsEnabled(pVCpu)*/)
    25     {
    26         VBOXSTRICTRC rcStrict = GIMHypercall(pVCpu, IEM_GET_CTX(pVCpu));
    27         if (RT_SUCCESS(rcStrict))
    28         {
    29             if (rcStrict == VINF_SUCCESS)
    30                 iemRegAddToRipAndClearRF(pVCpu, cbInstr);
    31             if (   rcStrict == VINF_SUCCESS
    32                 || rcStrict == VINF_GIM_HYPERCALL_CONTINUING)
    33                 return VINF_SUCCESS;
    34             AssertMsgReturn(rcStrict == VINF_GIM_R3_HYPERCALL, ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IEM_IPE_4);
    35             return rcStrict;
    36         }
    37         AssertMsgReturn(   rcStrict == VERR_GIM_HYPERCALL_ACCESS_DENIED
    38                         || rcStrict == VERR_GIM_HYPERCALLS_NOT_AVAILABLE
    39                         || rcStrict == VERR_GIM_NOT_ENABLED
    40                         || rcStrict == VERR_GIM_HYPERCALL_MEMORY_READ_FAILED
    41                         || rcStrict == VERR_GIM_HYPERCALL_MEMORY_WRITE_FAILED,
    42                         ("%Rrc\n", VBOXSTRICTRC_VAL(rcStrict)), VERR_IEM_IPE_4);
     24    /** @todo intercept. */
    4325
    44         /* Raise #UD on all failures. */
    45     }
    46     return iemRaiseUndefinedOpcode(pVCpu);
     26    /* Join forces with vmmcall. */
     27    return IEM_CIMPL_CALL_0(iemCImpl_Hypercall);
    4728}
    4829
  • trunk/src/VBox/VMM/VMMAll/VMMAll.cpp

    r70948 r72462  
    448448}
    449449
    450 
    451 /**
    452  * Notifies VMM that paravirtualized hypercalls are now enabled.
    453  *
    454  * @param   pVCpu   The cross context virtual CPU structure.
    455  */
    456 VMM_INT_DECL(void) VMMHypercallsEnable(PVMCPU pVCpu)
    457 {
    458     /* If there is anything to do for raw-mode, do it here. */
    459 /** @todo NEM: Hypercalls. */
    460 #ifndef IN_RC
    461     if (HMIsEnabled(pVCpu->CTX_SUFF(pVM)))
    462         HMHypercallsEnable(pVCpu);
    463 #else
    464     RT_NOREF_PV(pVCpu);
    465 #endif
    466 }
    467 
    468 
    469 /**
    470  * Notifies VMM that paravirtualized hypercalls are now disabled.
    471  *
    472  * @param   pVCpu   The cross context virtual CPU structure.
    473  */
    474 VMM_INT_DECL(void) VMMHypercallsDisable(PVMCPU pVCpu)
    475 {
    476     /* If there is anything to do for raw-mode, do it here. */
    477 /** @todo NEM: Hypercalls. */
    478 #ifndef IN_RC
    479     if (HMIsEnabled(pVCpu->CTX_SUFF(pVM)))
    480         HMHypercallsDisable(pVCpu);
    481 #else
    482     RT_NOREF_PV(pVCpu);
    483 #endif
    484 }
    485 
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r72440 r72462  
    71697169}
    71707170
     7171/**
     7172 * Performs the operations necessary that are part of the vmmcall instruction
     7173 * execution in the guest.
     7174 *
     7175 * @returns Strict VBox status code (i.e. informational status codes too).
     7176 * @retval  VINF_SUCCESS on successful handling, no \#UD needs to be thrown,
     7177 *          update RIP and eflags.RF depending on @a pfUpdatedRipAndRF and
     7178 *          continue guest execution.
     7179 * @retval  VINF_GIM_HYPERCALL_CONTINUING continue hypercall without updating
     7180 *          RIP.
     7181 * @retval  VINF_GIM_R3_HYPERCALL re-start the hypercall from ring-3.
     7182 *
     7183 * @param   pVCpu               The cross context virtual CPU structure.
     7184 * @param   pCtx                Pointer to the guest-CPU context.
     7185 * @param   pfUpdatedRipAndRF   Whether the guest RIP/EIP has been updated as
     7186 *                              part of handling the VMMCALL operation.
     7187 *
     7188 * @todo    r=bird: merge this with hmR0SvmExitVmmCall and fix todos.
     7189 */
     7190static VBOXSTRICTRC hmR0SvmVmmcall(PVMCPU pVCpu, PCPUMCTX pCtx, bool *pfUpdatedRipAndRF)
     7191{
     7192    /*
     7193     * TPR patched instruction emulation for 32-bit guests.
     7194     */
     7195    PVM pVM = pVCpu->CTX_SUFF(pVM);
     7196    if (pVM->hm.s.fTprPatchingAllowed)
     7197    {
     7198        int rc = hmSvmEmulateMovTpr(pVCpu, pCtx);
     7199        if (RT_SUCCESS(rc))
     7200        {
     7201            *pfUpdatedRipAndRF = true;
     7202            return VINF_SUCCESS;
     7203        }
     7204
     7205        if (rc != VERR_NOT_FOUND)
     7206        {
     7207            Log(("hmSvmExitVmmCall: hmSvmEmulateMovTpr returns %Rrc\n", rc));
     7208            *pfUpdatedRipAndRF = false;
     7209            return rc;
     7210        }
     7211    }
     7212
     7213    /*
     7214     * Paravirtualized hypercalls.
     7215     */
     7216    *pfUpdatedRipAndRF = false; /** @todo r=bird: This is misleading/wrong, see GIMHypercall returncode docs.  */
     7217    if (EMAreHypercallInstructionsEnabled(pVCpu))
     7218        return GIMHypercall(pVCpu, pCtx);
     7219
     7220    return VERR_NOT_AVAILABLE;
     7221}
     7222
     7223
    71717224
    71727225/**
     
    71797232
    71807233    bool fRipUpdated;
    7181     VBOXSTRICTRC rcStrict = HMSvmVmmcall(pVCpu, pCtx, &fRipUpdated);
     7234    VBOXSTRICTRC rcStrict = hmR0SvmVmmcall(pVCpu, pCtx, &fRipUpdated);
    71827235    if (RT_SUCCESS(rcStrict))
    71837236    {
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r72390 r72462  
    1195811958
    1195911959    VBOXSTRICTRC rcStrict = VERR_VMX_IPE_3;
    11960     if (pVCpu->hm.s.fHypercallsEnabled)
     11960    if (EMAreHypercallInstructionsEnabled(pVCpu))
    1196111961    {
    1196211962#if 0
     
    1198011980            Assert(   rcStrict == VINF_GIM_R3_HYPERCALL
    1198111981                   || rcStrict == VINF_GIM_HYPERCALL_CONTINUING
    11982                    || RT_FAILURE(VBOXSTRICTRC_VAL(rcStrict)));
     11982                   || RT_FAILURE(rcStrict));
    1198311983
    1198411984        /* If the hypercall changes anything other than guest's general-purpose registers,
     
    1198911989
    1199011990    /* If hypercalls are disabled or the hypercall failed for some reason, raise #UD and continue. */
    11991     if (RT_FAILURE(VBOXSTRICTRC_VAL(rcStrict)))
     11991    if (RT_FAILURE(rcStrict))
    1199211992    {
    1199311993        hmR0VmxSetPendingXcptUD(pVCpu, pMixedCtx);
  • trunk/src/VBox/VMM/VMMR3/GIMHv.cpp

    r72460 r72462  
    2828#include <VBox/vmm/hm.h>
    2929#include <VBox/vmm/pdmapi.h>
     30#include <VBox/vmm/em.h>
    3031#include "GIMInternal.h"
    3132#include <VBox/vmm/vm.h>
     
    10441045        if (pVM->gim.s.u.Hv.u64GuestOsIdMsr)
    10451046            for (VMCPUID i = 0; i < pVM->cCpus; i++)
    1046                 VMMHypercallsEnable(&pVM->aCpus[i]);
     1047                EMSetHypercallInstructionsEnabled(&pVM->aCpus[i], true);
    10471048        else
    10481049            for (VMCPUID i = 0; i < pVM->cCpus; i++)
    1049                 VMMHypercallsDisable(&pVM->aCpus[i]);
     1050                EMSetHypercallInstructionsEnabled(&pVM->aCpus[i], false);
    10501051    }
    10511052    return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMR3/GIMKvm.cpp

    r71800 r72462  
    2626#include <VBox/vmm/pdmapi.h>
    2727#include <VBox/vmm/ssm.h>
     28#include <VBox/vmm/em.h>
    2829#include "GIMInternal.h"
    2930#include <VBox/vmm/vm.h>
     
    159160     */
    160161    for (VMCPUID i = 0; i < pVM->cCpus; i++)
    161         VMMHypercallsEnable(&pVM->aCpus[i]);
     162        EMSetHypercallInstructionsEnabled(&pVM->aCpus[i], true);
    162163
    163164    if (ASMIsAmdCpu())
  • trunk/src/VBox/VMM/include/EMInternal.h

    r70979 r72462  
    345345    bool                    fForceRAW;
    346346
    347     uint8_t                 u8Padding[3];
     347    /** Set if hypercall instruction VMMCALL (AMD) & VMCALL (Intel) are enabled.
     348     * GIM sets this and the execution managers queries it.  Not saved, as GIM
     349     * takes care of that bit too.  */
     350    bool                    fHypercallEnabled;
     351
     352    /** Explicit padding. */
     353    uint8_t                 abPadding[2];
    348354
    349355    /** The number of instructions we've executed in IEM since switching to the
  • trunk/src/VBox/VMM/include/HMInternal.h

    r72343 r72462  
    727727    /** Whether \#UD needs to be intercepted (required by certain GIM providers). */
    728728    bool                        fGIMTrapXcptUD;
    729     /** Whether paravirt. hypercalls are enabled. */
    730     bool                        fHypercallsEnabled;
    731     uint8_t                     u8Alignment0[2];
     729    uint8_t                     u8Alignment0[3];
    732730
    733731    /** World switch exit counter. */
     
    11571155#endif /* IN_RING0 */
    11581156
     1157int hmSvmEmulateMovTpr(PVMCPU pVCpu, PCPUMCTX pCtx);
     1158
    11591159/** @} */
    11601160
  • trunk/src/VBox/VMM/include/HMInternal.mac

    r69111 r72462  
    7979
    8080        .fGIMTrapXcptUD         resb    1
    81         .fHypercallsEnabled     resb    1
    8281        alignb 8
    8382
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