Changeset 1450 in vbox for trunk/src/VBox
- Timestamp:
- Mar 13, 2007 4:13:50 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 19500
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/SELM.cpp
r1423 r1450 99 99 * Assert alignment and sizes. 100 100 */ 101 AssertRelease(!(RT_OFFSETOF(VM, selm.s) & 31)); 102 /** @note What was the reason for this assertion? 103 AssertRelease(!(RT_OFFSETOF(VM, selm.s.aHyperSel[SELM_HYPER_SEL_TSS]) & 15)); */ 104 AssertRelease(sizeof(pVM->selm.s) <= sizeof(pVM->selm.padding)); 101 AssertCompileMemberAlignment(VM, selm.s, 32); AssertRelease(!(RT_OFFSETOF(VM, selm.s) & 31)); 102 AssertCompileMemberAlignment(VM, selm.s.Tss, 16); AssertRelease(!(RT_OFFSETOF(VM, selm.s.Tss) & 15)); 103 AssertCompile(sizeof(pVM->selm.s) <= sizeof(pVM->selm.padding)); AssertRelease(sizeof(pVM->selm.s) <= sizeof(pVM->selm.padding)); 105 104 106 105 /* … … 230 229 231 230 /** 232 * S ave hypervisor GDT selectors in our shadow table231 * Setup the hypervisor GDT selectors in our shadow table 233 232 * 234 233 * @param pVM The VM handle. 235 234 */ 236 static void selmR3S aveHyperGDTSelectors(PVM pVM)235 static void selmR3SetupHyperGDTSelectors(PVM pVM) 237 236 { 238 237 PVBOXDESC paGdt = pVM->selm.s.paGdtHC; … … 352 351 CPUMSetHyperTR(pVM, pVM->selm.s.aHyperSel[SELM_HYPER_SEL_TSS]); 353 352 354 selmR3S aveHyperGDTSelectors(pVM);353 selmR3SetupHyperGDTSelectors(pVM); 355 354 356 355 /** @todo SELM must be called when any of the CR3s changes during a cpu mode change. */ … … 737 736 } 738 737 739 740 #if 0 /* obsolete */741 /**742 * Sets up the virtualization of a guest GDT.743 *744 * @returns VBox status code.745 * @param pVM The VM to operate on.746 * @param paGDTEs Pointer to GDT array.747 * @param cGDTEs Number of entries in the GDT array.748 */749 SELMR3DECL(int) SELMR3GdtSetup(PVM pVM, PCVBOXDESC paGDTEs, unsigned cGDTEs)750 {751 /*752 * Enumerate the array.753 */754 PCVBOXDESC pGDTESrc = paGDTEs;755 PVBOXDESC pGDTEDst = pVM->selm.s.paGdtHC;756 for (unsigned iGDT = 0; iGDT < cGDTEs; iGDT++, pGDTEDst++, pGDTESrc++)757 {758 /* ASSUME no clashes for now - lazy bird!!! */759 if (pGDTESrc->Gen.u1Present)760 {761 pGDTEDst->Gen = pGDTESrc->Gen;762 /* mark non ring-3 selectors as not present. */763 if (pGDTEDst->Gen.u2Dpl != 3)764 pGDTEDst->Gen.u1Present = 0;765 }766 else767 {768 /* zero it. */769 pGDTEDst->au32[0] = 0;770 pGDTEDst->au32[1] = 0;771 }772 }773 774 return VINF_SUCCESS;775 }776 #endif777 738 778 739 /** … … 907 868 Log(("Internal SELM GDT conflict: use non-present entries\n")); 908 869 STAM_COUNTER_INC(&pVM->selm.s.StatScanForHyperSels); 909 while (pGDTE > pGDTEStart && iGDT < SELM_HYPER_SEL_MAX)870 while (pGDTE > pGDTEStart) 910 871 { 911 872 /* We can reuse non-present entries */ … … 916 877 Log(("SELM: Found unused GDT %04X\n", aHyperSel[iGDT])); 917 878 iGDT++; 879 if (iGDT >= SELM_HYPER_SEL_MAX) 880 break; 918 881 } 919 882 … … 999 962 1000 963 STAM_COUNTER_INC(&pVM->selm.s.StatHyperSelsChanged); 1001 /** Relocate (switcher and selector data needs to update their selectors) */ 964 965 /* 966 * Do the relocation callbacks to let everyone update their hyper selector dependencies. 967 * (SELMR3Relocate will call selmR3SetupHyperGDTSelectors() for us.) 968 */ 1002 969 VMR3Relocate(pVM, 0); 1003 970 } 1004 else 1005 if (cbEffLimit >= SELM_HYPER_DEFAULT_BASE) 971 else if (cbEffLimit >= SELM_HYPER_DEFAULT_BASE) 1006 972 /* We overwrote all entries above, so we have to save them again. */ 1007 selmR3S aveHyperGDTSelectors(pVM);973 selmR3SetupHyperGDTSelectors(pVM); 1008 974 1009 975 /* … … 1233 1199 AssertMsg(!off, ("LDT is not aligned on entry size! GCPtrLdt=%08x\n", GCPtrLdt)); 1234 1200 1235 /* * @noteDo not skip the first selector; unlike the GDT, a zero LDT selector is perfectly valid. */1201 /* Note: Do not skip the first selector; unlike the GDT, a zero LDT selector is perfectly valid. */ 1236 1202 unsigned cbLeft = cbLdt + 1; 1237 1203 PVBOXDESC pLDTE = pShadowLDT; … … 1515 1481 { 1516 1482 #ifdef DEBUG 1517 1518 1519 1520 1521 1522 1523 1483 uint32_t ssr0, espr0; 1484 1485 SELMGetRing1Stack(pVM, &ssr0, &espr0); 1486 ssr0 &= ~1; 1487 1488 if (ssr0 != tss.ss0 || espr0 != tss.esp0) 1489 Log(("SELMR3SyncTSS: Updating TSS ring 0 stack to %04X:%08X\n", tss.ss0, tss.esp0)); 1524 1490 Log(("offIoBitmap=%#x\n", tss.offIoBitmap)); 1525 1491 #endif 1526 1492 /* Update our TSS structure for the guest's ring 1 stack */ 1527 1493 SELMSetRing1Stack(pVM, tss.ss0 | 1, tss.esp0); 1528 1494 } 1529 1495 else 1530 1531 /* * @notethe ring 0 stack selector and base address are updated on demand in this case. */1532 1533 /* * @todohandle these dependencies better! */1496 { 1497 /* Note: the ring 0 stack selector and base address are updated on demand in this case. */ 1498 1499 /* Note: handle these dependencies better! */ 1534 1500 TRPMR3SetGuestTrapHandler(pVM, 0x2E, TRPM_INVALID_HANDLER); 1535 1501 TRPMR3SetGuestTrapHandler(pVM, 0x80, TRPM_INVALID_HANDLER); 1536 1502 pVM->selm.s.fSyncTSSRing0Stack = true; 1537 1503 } 1538 1504 VM_FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS); 1539 1505 }
Note:
See TracChangeset
for help on using the changeset viewer.