VirtualBox

Changeset 42165 in vbox for trunk/include/VBox/vmm


Ignore:
Timestamp:
Jul 16, 2012 1:36:01 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
79144
Message:

CPUMIsGuestIn64BitCode/CPUMIsGuestIn64BitCodeEx changes together with some early lazily loading of hidden selectors (raw-mode).

Location:
trunk/include/VBox/vmm
Files:
3 edited

Legend:

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

    r42025 r42165  
    170170VMMDECL(bool)       CPUMGetGuestCpuIdFeature(PVM pVM, CPUMCPUIDFEATURE enmFeature);
    171171VMMDECL(void)       CPUMSetGuestCtx(PVMCPU pVCpu, const PCPUMCTX pCtx);
     172VMM_INT_DECL(void)  CPUMGuestLazyLoadHiddenCsAndSs(PVMCPU pVCpu);
     173VMM_INT_DECL(void)  CPUMGuestLazyLoadHiddenSelectorReg(PVMCPU pVCpu, PCPUMSELREG pSReg);
    172174/** @} */
    173175
     
    178180VMMDECL(bool)       CPUMIsGuestIn16BitCode(PVMCPU pVCpu);
    179181VMMDECL(bool)       CPUMIsGuestIn32BitCode(PVMCPU pVCpu);
     182VMMDECL(bool)       CPUMIsGuestIn64BitCode(PVMCPU pVCpu);
    180183VMMDECL(bool)       CPUMIsGuestNXEnabled(PVMCPU pVCpu);
    181184VMMDECL(bool)       CPUMIsGuestPageSizeExtEnabled(PVMCPU pVCpu);
     
    236239}
    237240
     241VMM_INT_DECL(bool) CPUMIsGuestIn64BitCodeSlow(PCPUMCTX pCtx);
     242
    238243/**
    239244 * Tests if the guest is running in 64 bits mode or not.
    240245 *
    241246 * @returns true if in 64 bits protected mode, otherwise false.
    242  * @param   pVM     The VM handle.
     247 * @param   pVCpu   The current virtual CPU.
    243248 * @param   pCtx    Current CPU context
    244249 */
    245 DECLINLINE(bool)    CPUMIsGuestIn64BitCode(PVMCPU pVCpu, PCCPUMCTXCORE pCtx)
    246 {
    247     if (!CPUMIsGuestInLongMode(pVCpu))
    248         return false;
    249 
    250     return pCtx->cs.Attr.n.u1Long;
    251 }
    252 
    253 /**
    254  * Tests if the guest is running in 64 bits mode or not.
    255  *
    256  * @returns true if in 64 bits protected mode, otherwise false.
    257  * @param   pVM     The VM handle.
    258  * @param   pCtx    Current CPU context
    259  */
    260 DECLINLINE(bool)    CPUMIsGuestIn64BitCodeEx(PCCPUMCTX pCtx)
     250DECLINLINE(bool)    CPUMIsGuestIn64BitCodeEx(PCPUMCTX pCtx)
    261251{
    262252    if (!(pCtx->msrEFER & MSR_K6_EFER_LMA))
    263253        return false;
    264 
     254    if (!CPUMSELREG_ARE_HIDDEN_PARTS_VALID(&pCtx->cs))
     255        return CPUMIsGuestIn64BitCodeSlow(pCtx);
    265256    return pCtx->cs.Attr.n.u1Long;
    266257}
  • trunk/include/VBox/vmm/cpumctx.h

    r41908 r42165  
    7878#define CPUMSELREG_FLAGS_STALE      UINT16_C(0x0002)
    7979/** @} */
     80
     81/** Checks if the hidden parts of the selector register are valid. */
     82#define CPUMSELREG_ARE_HIDDEN_PARTS_VALID(a_pSelReg) (   ((a_pSelReg)->fFlags & CPUMSELREG_FLAGS_VALID) \
     83                                                      && (a_pSelReg)->ValidSel == (a_pSelReg)->Sel )
    8084
    8185/** Old type used for the hidden register part.
  • trunk/include/VBox/vmm/selm.h

    r41727 r42165  
    8383VMMDECL(DISCPUMODE) SELMGetCpuModeFromSelector(PVMCPU pVCpu, X86EFLAGS eflags, RTSEL Sel, PCCPUMSELREGHID pHiddenSel);
    8484VMMDECL(int)        SELMGetLDTFromSel(PVM pVM, RTSEL SelLdt, PRTGCPTR ppvLdt, unsigned *pcbLimit);
     85#ifdef VBOX_WITH_RAW_MODE
     86VMM_INT_DECL(void)  SELMLoadHiddenSelectorReg(PVMCPU pVCpu, PCCPUMCTX pCtx, PCPUMSELREG pSReg);
     87#endif
    8588
    8689
Note: See TracChangeset for help on using the changeset viewer.

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