- Timestamp:
- Jun 12, 2008 12:33:17 PM (17 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/EM.cpp
r9341 r9658 1508 1508 { 1509 1509 rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid, pCtx->eip), 1510 SELMIsSelector32Bit(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) ? PATMFL_CODE32 : 0);1510 (SELMGetSelectorType(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) ? PATMFL_CODE32 : 0); 1511 1511 if (VBOX_SUCCESS(rc)) 1512 1512 { … … 1759 1759 { 1760 1760 int rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid, pCtx->eip), 1761 SELMIsSelector32Bit(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) ? PATMFL_CODE32 : 0);1761 (SELMGetSelectorType(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) ? PATMFL_CODE32 : 0); 1762 1762 if (VBOX_SUCCESS(rc)) 1763 1763 { … … 1866 1866 if ( (pCtx->ss & X86_SEL_RPL) == 0 1867 1867 && !pCtx->eflags.Bits.u1VM 1868 && SELM IsSelector32Bit(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid))1868 && SELMGetSelectorType(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) 1869 1869 { 1870 1870 uint32_t size; … … 2109 2109 case VINF_PATM_HC_MMIO_PATCH_READ: 2110 2110 rc = PATMR3InstallPatch(pVM, SELMToFlat(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid, pCtx->eip), 2111 PATMFL_MMIO_ACCESS | ( SELMIsSelector32Bit(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) ? PATMFL_CODE32 : 0));2111 PATMFL_MMIO_ACCESS | ((SELMGetSelectorType(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) ? PATMFL_CODE32 : 0)); 2112 2112 if (VBOX_FAILURE(rc)) 2113 2113 rc = emR3RawExecuteInstruction(pVM, "MMIO"); -
trunk/src/VBox/VMM/PATM/CSAM.cpp
r9412 r9658 2118 2118 fakeflags.u32 = 0; 2119 2119 2120 bool fCode32 = SELMIsSelector32Bit(pVM, fakeflags, Sel, pHiddenSel); 2121 2122 //assuming 32 bits code for now 2123 Assert(fCode32); NOREF(fCode32); 2120 /* Assuming 32 bits code for now. */ 2121 Assert(SELMGetSelectorType(pVM, fakeflags, Sel, pHiddenSel) == CPUMODE_32BIT); 2124 2122 2125 2123 pInstrGC = SELMToFlat(pVM, fakeflags, Sel, pHiddenSel, pInstrGC); -
trunk/src/VBox/VMM/PATM/VMMGC/PATMGC.cpp
r9290 r9658 510 510 } 511 511 512 cpu.mode = SELM IsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, 0) ? CPUMODE_32BIT : CPUMODE_16BIT;512 cpu.mode = SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, 0); 513 513 if(cpu.mode != CPUMODE_32BIT) 514 514 { -
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r9656 r9658 167 167 EMDECL(int) EMInterpretDisasOneEx(PVM pVM, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, unsigned *pcbInstr) 168 168 { 169 int rc = DISCoreOneEx(GCPtrInstr, SELM IsSelector32Bit(pVM, pCtxCore->eflags, pCtxCore->cs, (PCPUMSELREGHID)&pCtxCore->csHid) ? CPUMODE_32BIT : CPUMODE_16BIT,169 int rc = DISCoreOneEx(GCPtrInstr, SELMGetSelectorType(pVM, pCtxCore->eflags, pCtxCore->cs, (PCPUMSELREGHID)&pCtxCore->csHid), 170 170 #ifdef IN_GC 171 171 NULL, NULL, … … 209 209 uint32_t cbOp; 210 210 DISCPUSTATE Cpu; 211 Cpu.mode = SELM IsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid) ? CPUMODE_32BIT : CPUMODE_16BIT;211 Cpu.mode = SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid); 212 212 rc = emDisCoreOne(pVM, &Cpu, (RTGCUINTPTR)pbCode, &cbOp); 213 213 if (VBOX_SUCCESS(rc)) … … 631 631 632 632 /* Read stack value first */ 633 if (SELM IsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->ss, &pRegFrame->ssHid) == false)633 if (SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->ss, &pRegFrame->ssHid) == CPUMODE_16BIT) 634 634 return VERR_EM_INTERPRETER; /* No legacy 16 bits stuff here, please. */ 635 635 -
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r9282 r9658 302 302 { 303 303 cTransfers = pRegFrame->ecx; 304 if ( !SELMIsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid))304 if (SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid) == CPUMODE_16BIT) 305 305 cTransfers &= 0xffff; 306 306 … … 543 543 { 544 544 cTransfers = pRegFrame->ecx; 545 if ( !SELMIsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid))545 if (SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid) == CPUMODE_16BIT) 546 546 cTransfers &= 0xffff; 547 547 … … 1310 1310 cTransfers = pRegFrame->ecx; 1311 1311 1312 if ( !SELMIsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid))1312 if (SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid) == CPUMODE_16BIT) 1313 1313 cTransfers &= 0xffff; 1314 1314 … … 1465 1465 { 1466 1466 cTransfers = pRegFrame->ecx; 1467 if ( !SELMIsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid))1467 if (SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid) == CPUMODE_16BIT) 1468 1468 cTransfers &= 0xffff; 1469 1469 -
trunk/src/VBox/VMM/VMMAll/SELMAll.cpp
r9656 r9658 536 536 537 537 /** 538 * Checks if a selector is 32-bit or 16-bit. 539 * 540 * @returns True if it is 32-bit. 541 * @returns False if it is 16-bit. 538 * Return the selector type 539 * 540 * @returns DISCPUMODE according to the selector type (16, 32 or 64 bits) 542 541 * @param pVM VM Handle. 543 542 * @param Sel The selector. 544 543 */ 545 static bool selmIsSelector32Bit(PVM pVM, RTSEL Sel)544 static DISCPUMODE selmGetSelectorType(PVM pVM, RTSEL Sel) 546 545 { 547 546 Assert(!CPUMAreHiddenSelRegsValid(pVM)); … … 557 556 Desc = paLDT[Sel >> X86_SEL_SHIFT]; 558 557 } 559 return Desc.Gen.u1DefBig; 560 } 561 562 563 /** 564 * Checks if a selector is 32-bit or 16-bit. 565 * 566 * @returns True if it is 32-bit. 567 * @returns False if it is 16-bit. 558 return (Desc.Gen.u1DefBig) ? CPUMODE_32BIT : CPUMODE_16BIT; 559 } 560 561 562 /** 563 * Return the selector type 564 * 565 * @returns DISCPUMODE according to the selector type (16, 32 or 64 bits) 568 566 * @param pVM VM Handle. 569 567 * @param eflags Current eflags register … … 571 569 * @param pHiddenSel The hidden selector register. 572 570 */ 573 SELMDECL( bool) SELMIsSelector32Bit(PVM pVM, X86EFLAGS eflags, RTSEL Sel, CPUMSELREGHID *pHiddenSel)571 SELMDECL(DISCPUMODE) SELMGetSelectorType(PVM pVM, X86EFLAGS eflags, RTSEL Sel, CPUMSELREGHID *pHiddenSel) 574 572 { 575 573 if (!CPUMAreHiddenSelRegsValid(pVM)) … … 580 578 if ( CPUMIsGuestInRealMode(pVM) 581 579 || eflags.Bits.u1VM) 582 return false; 583 584 return selmIsSelector32Bit(pVM, Sel); 585 } 586 return pHiddenSel->Attr.n.u1DefBig; 587 } 588 580 return CPUMODE_16BIT; 581 582 return selmGetSelectorType(pVM, Sel); 583 } 584 if ( CPUMIsGuestInLongMode(pVM) 585 && pHiddenSel->Attr.n.u1Long) 586 return CPUMODE_64BIT; 587 588 /* Else compatibility or 32 bits mode. */ 589 return (pHiddenSel->Attr.n.u1DefBig) ? CPUMODE_32BIT : CPUMODE_16BIT; 590 591 } 589 592 590 593 /** -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r9457 r9658 1876 1876 static int SVMR0InterpretInvpg(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uASID) 1877 1877 { 1878 Assert(!CPUMIsGuestInLongMode(pVM)); /** @todo */ 1878 1879 /* 1879 1880 * Only allow 32-bit code. 1880 1881 */ 1881 if (SELM IsSelector32Bit(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid))1882 if (SELMGetSelectorType(pVM, pRegFrame->eflags, pRegFrame->cs, &pRegFrame->csHid) == CPUMODE_16BIT) 1882 1883 { 1883 1884 RTGCPTR pbCode; … … 1952 1953 Assert(pVM->hwaccm.s.fNestedPaging); 1953 1954 1955 Assert(!CPUMIsGuestInLongMode(pVM)); /** @todo */ 1956 1954 1957 /* Skip it if a TLB flush is already pending. */ 1955 1958 if (!fFlushPending) … … 1972 1975 * Only allow 32-bit code. 1973 1976 */ 1974 if (SELM IsSelector32Bit(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid))1977 if (SELMGetSelectorType(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid)) 1975 1978 { 1976 1979 RTGCPTR pbCode;
Note:
See TracChangeset
for help on using the changeset viewer.