VirtualBox

Changeset 1450 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 13, 2007 4:13:50 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
19500
Message:

r=bird

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/SELM.cpp

    r1423 r1450  
    9999     * Assert alignment and sizes.
    100100     */
    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));
    105104
    106105    /*
     
    230229
    231230/**
    232  * Save hypervisor GDT selectors in our shadow table
     231 * Setup the hypervisor GDT selectors in our shadow table
    233232 *
    234233 * @param   pVM     The VM handle.
    235234 */
    236 static void selmR3SaveHyperGDTSelectors(PVM pVM)
     235static void selmR3SetupHyperGDTSelectors(PVM pVM)
    237236{
    238237    PVBOXDESC paGdt = pVM->selm.s.paGdtHC;
     
    352351    CPUMSetHyperTR(pVM, pVM->selm.s.aHyperSel[SELM_HYPER_SEL_TSS]);
    353352
    354     selmR3SaveHyperGDTSelectors(pVM);
     353    selmR3SetupHyperGDTSelectors(pVM);
    355354
    356355/** @todo SELM must be called when any of the CR3s changes during a cpu mode change. */
     
    737736}
    738737
    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         else
    767         {
    768             /* zero it. */
    769             pGDTEDst->au32[0] = 0;
    770             pGDTEDst->au32[1] = 0;
    771         }
    772     }
    773 
    774     return VINF_SUCCESS;
    775 }
    776 #endif
    777738
    778739/**
     
    907868            Log(("Internal SELM GDT conflict: use non-present entries\n"));
    908869            STAM_COUNTER_INC(&pVM->selm.s.StatScanForHyperSels);
    909             while (pGDTE > pGDTEStart && iGDT < SELM_HYPER_SEL_MAX)
     870            while (pGDTE > pGDTEStart)
    910871            {
    911872                /* We can reuse non-present entries */
     
    916877                    Log(("SELM: Found unused GDT %04X\n", aHyperSel[iGDT]));
    917878                    iGDT++;
     879                    if (iGDT >= SELM_HYPER_SEL_MAX)
     880                        break;
    918881                }
    919882
     
    999962
    1000963            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             */
    1002969            VMR3Relocate(pVM, 0);
    1003970        }
    1004         else
    1005         if (cbEffLimit >= SELM_HYPER_DEFAULT_BASE)
     971        else if (cbEffLimit >= SELM_HYPER_DEFAULT_BASE)
    1006972            /* We overwrote all entries above, so we have to save them again. */
    1007             selmR3SaveHyperGDTSelectors(pVM);
     973            selmR3SetupHyperGDTSelectors(pVM);
    1008974
    1009975        /*
     
    12331199        AssertMsg(!off, ("LDT is not aligned on entry size! GCPtrLdt=%08x\n", GCPtrLdt));
    12341200
    1235         /** @note Do 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. */
    12361202        unsigned    cbLeft = cbLdt + 1;
    12371203        PVBOXDESC   pLDTE = pShadowLDT;
     
    15151481            {
    15161482            #ifdef DEBUG
    1517                     uint32_t ssr0, espr0;
    1518 
    1519                     SELMGetRing1Stack(pVM, &ssr0, &espr0);
    1520                     ssr0 &= ~1;
    1521 
    1522                     if (ssr0 != tss.ss0 || espr0 != tss.esp0)
    1523                         Log(("SELMR3SyncTSS: Updating TSS ring 0 stack to %04X:%08X\n", tss.ss0, tss.esp0));
     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));
    15241490                Log(("offIoBitmap=%#x\n", tss.offIoBitmap));
    15251491            #endif
    15261492                /* Update our TSS structure for the guest's ring 1 stack */
    1527                     SELMSetRing1Stack(pVM, tss.ss0 | 1, tss.esp0);
     1493                SELMSetRing1Stack(pVM, tss.ss0 | 1, tss.esp0);
    15281494            }
    15291495            else
    1530                 {
    1531                 /** @note the ring 0 stack selector and base address are updated on demand in this case. */
    1532 
    1533                 /** @todo handle 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! */
    15341500                TRPMR3SetGuestTrapHandler(pVM, 0x2E, TRPM_INVALID_HANDLER);
    15351501                TRPMR3SetGuestTrapHandler(pVM, 0x80, TRPM_INVALID_HANDLER);
    15361502                pVM->selm.s.fSyncTSSRing0Stack = true;
    1537                 }
     1503            }
    15381504            VM_FF_CLEAR(pVM, VM_FF_SELM_SYNC_TSS);
    15391505        }
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