VirtualBox

Changeset 25556 in vbox for trunk/src/VBox/VMM/VMMGC


Ignore:
Timestamp:
Dec 22, 2009 12:19:11 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56233
Message:

Rewrote RDTSC #GP optimization as it's no longer safe to access the instruction opcode due to possibly stale code TLB entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp

    r25554 r25556  
    845845
    846846    /*
    847      * Optimize RDTSC traps.
    848      * Some guests (like Solaris) are using RDTSC all over the place and
    849      * will end up trapping a *lot* because of that.
    850      */
    851     if (   !pRegFrame->eflags.Bits.u1VM
    852         && ((uint8_t *)PC)[0] == 0x0f
    853         && ((uint8_t *)PC)[1] == 0x31)
    854     {
    855         STAM_PROFILE_STOP(&pVM->trpm.s.StatTrap0dDisasm, a);
    856         return trpmGCTrap0dHandlerRdTsc(pVM, pVCpu, pRegFrame);
    857     }
    858 
    859     /*
    860847     * Disassemble the instruction.
    861848     */
     
    870857    }
    871858    STAM_PROFILE_STOP(&pVM->trpm.s.StatTrap0dDisasm, a);
     859
     860    /*
     861     * Optimize RDTSC traps.
     862     * Some guests (like Solaris) are using RDTSC all over the place and
     863     * will end up trapping a *lot* because of that.
     864     *
     865     * Note: it's no longer safe to access the instruction opcode directly due to possible stale code TLB entries
     866     */
     867    if (Cpu.pCurInstr->opcode == OP_RDTSC)
     868    {
     869        STAM_PROFILE_STOP(&pVM->trpm.s.StatTrap0dDisasm, a);
     870        return trpmGCTrap0dHandlerRdTsc(pVM, pVCpu, pRegFrame);
     871    }
    872872
    873873    /*
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