VirtualBox

Changeset 1502 in vbox for trunk


Ignore:
Timestamp:
Mar 15, 2007 10:00:42 AM (18 years ago)
Author:
vboxsync
Message:

Syncing of TSS virtual interrupt redirection bitmap added.

Location:
trunk/src/VBox/VMM
Files:
3 edited

Legend:

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

    r1501 r1502  
    108108    AssertRelease((RT_OFFSETOF(VM, selm.s.Tss)       & PAGE_OFFSET_MASK) <= PAGE_SIZE - sizeof(pVM->selm.s.Tss));
    109109    AssertRelease((RT_OFFSETOF(VM, selm.s.TssTrap08) & PAGE_OFFSET_MASK) <= PAGE_SIZE - sizeof(pVM->selm.s.TssTrap08));
     110    AssertRelease(sizeof(pVM->selm.s.Tss.redirBitmap) == 0x20);
    110111
    111112    /*
     
    170171    STAM_REG(pVM, &pVM->selm.s.StatGCWriteGuestLDT,            STAMTYPE_COUNTER, "/SELM/GC/Write/Guest/LDT",     STAMUNIT_OCCURENCES,     "The number of writes to the Guest LDT was detected.");
    171172    STAM_REG(pVM, &pVM->selm.s.StatGCWriteGuestTSSHandled,     STAMTYPE_COUNTER, "/SELM/GC/Write/Guest/TSSInt",  STAMUNIT_OCCURENCES,     "The number of handled writes to the Guest TSS.");
     173    STAM_REG(pVM, &pVM->selm.s.StatGCWriteGuestTSSRedir,       STAMTYPE_COUNTER, "/SELM/GC/Write/Guest/TSSRedir",STAMUNIT_OCCURENCES,     "The number of handled redir bitmap writes to the Guest TSS.");
    172174    STAM_REG(pVM, &pVM->selm.s.StatGCWriteGuestTSSHandledChanged,STAMTYPE_COUNTER, "/SELM/GC/Write/Guest/TSSIntChg", STAMUNIT_OCCURENCES, "The number of handled writes to the Guest TSS where the R0 stack changed.");
    173175    STAM_REG(pVM, &pVM->selm.s.StatGCWriteGuestTSSUnhandled,   STAMTYPE_COUNTER, "/SELM/GC/Write/Guest/TSSEmu",  STAMUNIT_OCCURENCES,     "The number of unhandled writes to the Guest TSS.");
     
    14891491            /* feeling very lazy; reading too much */
    14901492            VBOXTSS tss;
    1491             rc = PGMPhysReadGCPtr(pVM, &tss, GCPtrTss, sizeof(VBOXTSS));
     1493            rc = PGMPhysReadGCPtr(pVM, &tss, GCPtrTss, RT_OFFSETOF(VBOXTSS, offIoBitmap) + sizeof(tss.offIoBitmap));
    14921494            if (VBOX_SUCCESS(rc))
    14931495            {
     
    15041506                /* Update our TSS structure for the guest's ring 1 stack */
    15051507                SELMSetRing1Stack(pVM, tss.ss0 | 1, tss.esp0);
     1508
     1509                /* Should we sync the virtual interrupt redirection bitmap as well? */
     1510                if (CPUMGetGuestCR4(pVM) & X86_CR4_VME)
     1511                {
     1512                    uint32_t offRedirBitmap = tss.offIoBitmap - sizeof(tss.redirBitmap);
     1513                   
     1514                    /** @todo not sure how the partial case is handled; probably not allowed */
     1515                    if (offRedirBitmap + sizeof(tss.redirBitmap) <= cbTss)
     1516                    {
     1517                        rc = PGMPhysReadGCPtr(pVM, &pVM->selm.s.Tss.redirBitmap, GCPtrTss + offRedirBitmap, sizeof(tss.redirBitmap));
     1518                        AssertRC(rc);
     1519                    }
     1520                }
    15061521            }
    15071522            else
     
    15091524                /* Note: the ring 0 stack selector and base address are updated on demand in this case. */
    15101525
    1511                 /* Note: handle these dependencies better! */
     1526                /** @todo handle these dependencies better! */
    15121527                TRPMR3SetGuestTrapHandler(pVM, 0x2E, TRPM_INVALID_HANDLER);
    15131528                TRPMR3SetGuestTrapHandler(pVM, 0x80, TRPM_INVALID_HANDLER);
  • trunk/src/VBox/VMM/SELMInternal.h

    r1480 r1502  
    150150    STAMPROFILE             StatTSSSync;
    151151
    152     /** GC: The number of handled write to the Guest's GDT. */
     152    /** GC: The number of handled writes to the Guest's GDT. */
    153153    STAMCOUNTER             StatGCWriteGuestGDTHandled;
    154154    /** GC: The number of unhandled write to the Guest's GDT. */
    155155    STAMCOUNTER             StatGCWriteGuestGDTUnhandled;
    156     /** GC: The number of times write to Guest's LDT was detected. */
     156    /** GC: The number of times writes to Guest's LDT was detected. */
    157157    STAMCOUNTER             StatGCWriteGuestLDT;
    158     /** GC: The number of handled write to the Guest's TSS. */
     158    /** GC: The number of handled writes to the Guest's TSS. */
    159159    STAMCOUNTER             StatGCWriteGuestTSSHandled;
    160     /** GC: The number of handled write to the Guest's TSS where we detected a change. */
     160    /** GC: The number of handled writes to the Guest's TSS where we detected a change. */
    161161    STAMCOUNTER             StatGCWriteGuestTSSHandledChanged;
    162     /** GC: The number of unhandled write to the Guest's TSS. */
     162    /** GC: The number of handled redir writes to the Guest's TSS where we detected a change. */
     163    STAMCOUNTER             StatGCWriteGuestTSSRedir;
     164    /** GC: The number of unhandled writes to the Guest's TSS. */
    163165    STAMCOUNTER             StatGCWriteGuestTSSUnhandled;
    164166    /** The number of times we had to relocate our hypervisor selectors. */
  • trunk/src/VBox/VMM/VMMGC/SELMGC.cpp

    r1444 r1502  
    284284            STAM_COUNTER_INC(&pVM->selm.s.StatGCWriteGuestTSSHandledChanged);
    285285        }
     286        if (CPUMGetGuestCR4(pVM) & X86_CR4_VME)
     287        {
     288            uint32_t offRedirBitmap = pGuestTSS->offIoBitmap - sizeof(pVM->selm.s.Tss.redirBitmap);
     289
     290            /** @todo not sure how the partial case is handled; probably not allowed */
     291            if (offRedirBitmap + sizeof(pVM->selm.s.Tss.redirBitmap) <= pVM->selm.s.cbGuestTss)
     292            {
     293                /** @todo check if fault was in this range and, if so, only update the changed part. */
     294                for (uint32_t i=0;i<sizeof(pVM->selm.s.Tss.redirBitmap)/8;i++)
     295                {
     296                    rc = MMGCRamRead(pVM, &pVM->selm.s.Tss.redirBitmap[i*8], (uint8_t *)pGuestTSS + offRedirBitmap + i*8, 8);
     297                    AssertRC(rc);
     298                }
     299                STAM_COUNTER_INC(&pVM->selm.s.StatGCWriteGuestTSSRedir);
     300            }
     301
     302        }
    286303        STAM_COUNTER_INC(&pVM->selm.s.StatGCWriteGuestTSSHandled);
    287304    }
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