VirtualBox

Ignore:
Timestamp:
Aug 9, 2010 4:12:00 PM (14 years ago)
Author:
vboxsync
Message:

CPUMGetGuestCRx,CPUMGetGuestCR8: Do the PDM TPR querying in CPUM instead of EM so we don't need to duplicate code.

File:
1 edited

Legend:

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

    r31079 r31489  
    11551155
    11561156
     1157VMMDECL(uint64_t) CPUMGetGuestCR8(PVMCPU pVCpu)
     1158{
     1159    uint64_t u64;
     1160    int rc = CPUMGetGuestCRx(pVCpu, USE_REG_CR8, &u64);
     1161    if (RT_FAILURE(rc))
     1162        u64 = 0;
     1163    return u64;
     1164}
     1165
     1166
    11571167VMMDECL(void) CPUMGetGuestGDTR(PVMCPU pVCpu, PVBOXGDTR pGDTR)
    11581168{
     
    12271237
    12281238
    1229 ///@todo: crx should be an array
    12301239VMMDECL(int) CPUMGetGuestCRx(PVMCPU pVCpu, unsigned iReg, uint64_t *pValue)
    12311240{
     
    12351244            *pValue = pVCpu->cpum.s.Guest.cr0;
    12361245            break;
     1246
    12371247        case USE_REG_CR2:
    12381248            *pValue = pVCpu->cpum.s.Guest.cr2;
    12391249            break;
     1250
    12401251        case USE_REG_CR3:
    12411252            *pValue = pVCpu->cpum.s.Guest.cr3;
    12421253            break;
     1254
    12431255        case USE_REG_CR4:
    12441256            *pValue = pVCpu->cpum.s.Guest.cr4;
    12451257            break;
     1258
     1259        case USE_REG_CR8:
     1260        {
     1261            uint8_t u8Tpr;
     1262            int rc = PDMApicGetTPR(pVCpu, &u8Tpr, NULL /*pfPending*/);
     1263            if (RT_FAILURE(rc))
     1264            {
     1265                AssertMsg(rc == VERR_PDM_NO_APIC_INSTANCE, ("%Rrc\n", rc));
     1266                *pValue = 0;
     1267                return rc;
     1268            }
     1269            *pValue = u8Tpr >> 4; /* bits 7-4 contain the task priority that go in cr8, bits 3-0*/
     1270            break;
     1271        }
     1272
    12461273        default:
    12471274            return VERR_INVALID_PARAMETER;
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