VirtualBox

Changeset 1977 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 6, 2007 6:19:08 PM (18 years ago)
Author:
vboxsync
Message:

Need to emulate RDTSC for ring-3 as well.

File:
1 edited

Legend:

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

    r1886 r1977  
    312312     * Both PATM are using INT3s, let them have a go first.
    313313     */
    314     if (    (pRegFrame->ss & X86_SEL_RPL) == 1 
     314    if (    (pRegFrame->ss & X86_SEL_RPL) == 1
    315315        &&  !pRegFrame->eflags.Bits.u1VM)
    316316    {
     
    379379        Assert(rc == VINF_EM_RAW_GUEST_TRAP);
    380380    }
    381     else 
     381    else
    382382        /* Never generate a raw trap here; it might be a monitor instruction, that requires emulation. */
    383383        rc = VINF_EM_RAW_EMULATE_INSTR;
     
    513513 * @param   pRegFrame   Pointer to the register frame for the trap.
    514514 * @param   pCpu        The opcode info.
    515  * @param   PC          Program counter.
     515 * @param   PC          The program counter corresponding to cs:eip in pRegFrame.
    516516 */
    517517static int trpmGCTrap0dHandlerRing0(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR PC)
     
    611611 * @param   pRegFrame   Pointer to the register frame for the trap.
    612612 * @param   pCpu        The opcode info.
    613  */
    614 static int trpmGCTrap0dHandlerRing3(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu)
     613 * @param   PC          The program counter corresponding to cs:eip in pRegFrame.
     614 */
     615static int trpmGCTrap0dHandlerRing3(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR PC)
    615616{
    616617    int rc;
     
    674675            pVM->trpm.s.uActiveVector = ~0;
    675676            return trpmGCExitTrap(pVM, VINF_EM_RAW_RING_SWITCH, pRegFrame);
     677
     678        /*
     679         * Read TSC
     680         */
     681        case OP_RDTSC:
     682        {
     683            uint32_t cbIgnored;
     684            rc = EMInterpretInstructionCPU(pVM, pCpu, pRegFrame, PC, &cbIgnored);
     685            if (VBOX_SUCCESS(rc))
     686                pRegFrame->eip += pCpu->opsize;
     687            else if (rc != VERR_EM_INTERPRETER)
     688                AssertReleaseMsgFailed(("rc=%Vrc\n", rc));    /* Can't happen with RDTSC. */
     689            return trpmGCExitTrap(pVM, rc, pRegFrame);
     690        }
    676691    }
    677692
     
    758773     */
    759774    if (!pRegFrame->eflags.Bits.u1VM)
    760         return trpmGCTrap0dHandlerRing3(pVM, pRegFrame, &Cpu);
    761    
    762     /* 
     775        return trpmGCTrap0dHandlerRing3(pVM, pRegFrame, &Cpu, PC);
     776
     777    /*
    763778     * Deal with v86 code.
    764779     */
     
    10171032    {
    10181033        /*
    1019          * Check that there is still some stack left, if not we'll flag 
     1034         * Check that there is still some stack left, if not we'll flag
    10201035         * a guru meditation (the alternative is a triple fault).
    10211036         */
     
    10291044        /*
    10301045         * Just zero the register containing the selector in question.
    1031          * We'll deal with the actual stale or troublesome selector value in 
     1046         * We'll deal with the actual stale or troublesome selector value in
    10321047         * the outermost trap frame.
    10331048         */
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