VirtualBox

Changeset 4207

Show
Ignore:
Timestamp:
08/17/07 22:11:37 (1 year ago)
Author:
vboxsync
Message:

CPUMGetGuestMode

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/cpum.h

    r4071 r4207  
    684684CPUMDECL(uint32_t) CPUMGetGuestCPL(PVM pVM, PCPUMCTXCORE pCtxCore); 
    685685 
     686/** 
     687 * CPU modes. 
     688 */ 
     689typedef enum CPUMMODE 
     690{ 
     691    /** The usual invalid zero entry. */ 
     692    CPUMMODE_INVALID = 0, 
     693    /** Real mode. */ 
     694    CPUMMODE_REAL, 
     695    /** Protected mode (32-bit). */ 
     696    CPUMMODE_PROTECTED, 
     697    /** Long mode (64-bit). */ 
     698    CPUMMODE_LONG 
     699} CPUMMODE; 
     700 
     701/** 
     702 * Gets the current guest CPU mode. 
     703 * 
     704 * If paging mode is what you need, check out PGMGetGuestMode(). 
     705 * 
     706 * @returns The CPU mode. 
     707 * @param   pVM         The VM handle. 
     708 */ 
     709CPUMDECL(uint32_t) CPUMGetGuestMode(PVM pVM); 
     710 
    686711 
    687712#ifdef IN_RING3 
     
    749774/** 
    750775 * API for controlling a few of the CPU features found in CR4. 
    751  *  
     776 * 
    752777 * Currently only X86_CR4_TSD is accepted as input. 
    753  *  
     778 * 
    754779 * @returns VBox status code. 
    755  *  
     780 * 
    756781 * @param   pVM     The VM handle. 
    757782 * @param   fOr     The CR4 OR mask. 
  • trunk/include/VBox/pgm.h

    r4071 r4207  
    576576 * Gets the current guest paging mode. 
    577577 * 
     578 * If you just need the CPU mode (real/protected/long), use CPUMGetGuestMode(). 
     579 * 
    578580 * @returns The current paging mode. 
    579581 * @param   pVM             The VM handle. 
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r4071 r4207  
    15051505    return cpl; 
    15061506} 
     1507 
     1508 
     1509/** 
     1510 * Gets the current guest CPU mode. 
     1511 * 
     1512 * If paging mode is what you need, check out PGMGetGuestMode(). 
     1513 * 
     1514 * @returns The CPU mode. 
     1515 * @param   pVM         The VM handle. 
     1516 */ 
     1517CPUMDECL(uint32_t) CPUMGetGuestMode(PVM pVM) 
     1518{ 
     1519    CPUMMODE enmMode; 
     1520    if (!(pVM->cpum.s.Guest.cr0 & X86_CR0_PE)) 
     1521        enmMode = CPUMMODE_REAL; 
     1522    else //GUEST64 if (!(pVM->cpum.s.Guest.efer & MSR_K6_EFER_LMA) 
     1523        enmMode = CPUMMODE_PROTECTED; 
     1524//GUEST64     else 
     1525//GUEST64         enmMode = CPUMMODE_LONG; 
     1526 
     1527    return enmMode; 
     1528} 
     1529 
  • trunk/src/VBox/VMM/VMMAll/PGMAll.cpp

    r4071 r4207  
    13151315/** 
    13161316 * Gets the current guest paging mode. 
     1317 * 
     1318 * If you just need the CPU mode (real/protected/long), use CPUMGetGuestMode(). 
    13171319 * 
    13181320 * @returns The current paging mode. 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy