VirtualBox

Changeset 1089 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Feb 28, 2007 8:42:35 AM (18 years ago)
Author:
vboxsync
Message:

Fixed broken return path in generic trap handler for v86 code

Location:
trunk/src/VBox/VMM/VMMGC
Files:
2 edited

Legend:

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

    r988 r1089  
    223223    AssertMsg(     rc != VINF_SUCCESS
    224224              ||   (   pRegFrame->eflags.Bits.u1IF
    225                     && pRegFrame->eflags.Bits.u2IOPL < (unsigned)(pRegFrame->ss & X86_SEL_RPL))
     225                    && ( pRegFrame->eflags.Bits.u2IOPL < (unsigned)(pRegFrame->ss & X86_SEL_RPL) || pRegFrame->eflags.Bits.u1VM))
    226226              , ("rc = %VGv\neflags=%RX32 ss=%RTsel IOPL=%d\n", rc, pRegFrame->eflags.u32, pRegFrame->ss, pRegFrame->eflags.Bits.u2IOPL));
    227227    return rc;
     
    338338    PVM pVM = TRPM2VM(pTrpm);
    339339
    340     LogFlow(("TRPMGCTrap06Handler %VGv\n", pRegFrame->eip));
     340    LogFlow(("TRPMGCTrap06Handler %VGv eflags=%x\n", pRegFrame->eip, pRegFrame->eflags.u32));
    341341
    342342    if (    (pRegFrame->ss & X86_SEL_RPL) == 1
     
    696696
    697697    STAM_PROFILE_ADV_START(&pVM->trpm.s.StatTrap0dDisasm, a);
     698
     699    /* We always set IOPL to zero which makes e.g. pushf fault in V86 mode. The guest might use IOPL=3 and therefor not expect a #GP.
     700     * Simply fall back to the recompiler to emulate this instruction.
     701     */
     702    if (pRegFrame->eflags.Bits.u1VM)
     703    {
     704        STAM_PROFILE_ADV_STOP(&pVM->trpm.s.StatTrap0dDisasm, a);
     705        return trpmGCExitTrap(pVM, VINF_EM_RAW_EMULATE_INSTR, pRegFrame);
     706    }
     707
    698708    /*
    699709     * Decode the instruction.
     
    706716             pRegFrame->cs, pRegFrame->eip, pRegFrame->ss & X86_SEL_RPL, rc));
    707717        STAM_PROFILE_ADV_STOP(&pVM->trpm.s.StatTrap0dDisasm, a);
    708         return trpmGCExitTrap(pVM, VINF_EM_RAW_GUEST_TRAP, pRegFrame);
     718        return trpmGCExitTrap(pVM, VINF_EM_RAW_EMULATE_INSTR, pRegFrame);
    709719    }
    710720
  • trunk/src/VBox/VMM/VMMGC/TRPMGCHandlersA.asm

    r848 r1089  
    497497
    498498    mov     eax, dword [esp + CPUMCTXCORE.es]
    499     mov     [esp + 0ch + ESPOFF], eax           ; es
     499    mov     [esp + 1ch + ESPOFF], eax           ; es
    500500    mov     eax, dword [esp + CPUMCTXCORE.ds]
    501     mov     [esp + 10h + ESPOFF], eax           ; ds
     501    mov     [esp + 20h + ESPOFF], eax           ; ds
    502502    mov     eax, dword [esp + CPUMCTXCORE.fs]
    503     mov     [esp + 14h + ESPOFF], eax           ; fs
     503    mov     [esp + 24h + ESPOFF], eax           ; fs
    504504    mov     eax, dword [esp + CPUMCTXCORE.gs]
    505     mov     [esp + 18h + ESPOFF], eax           ; gs
     505    mov     [esp + 28h + ESPOFF], eax           ; gs
    506506
    507507    mov     eax, [esp + CPUMCTXCORE.eip]
     
    914914    mov     edi, [esp + CPUMCTXCORE.edi]
    915915
     916    ; In V86 mode DS, ES, FS & GS are restored by the iret
     917    test    dword [esp + CPUMCTXCORE.eflags], X86_EFL_VM
     918    jnz     short ti_SkipSelRegs
     919
    916920    mov     eax, [esp + CPUMCTXCORE.gs]
    917921    TRPM_NP_GP_HANDLER NAME(trpmGCTrapInGeneric), TRPM_TRAP_IN_MOV_GS | TRPM_TRAP_IN_HYPER
     
    927931    mov     ds, eax
    928932
     933ti_SkipSelRegs:
    929934    ; finally restore our scratch register eax
    930935    mov     eax, [esp + CPUMCTXCORE.eax]
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