Changeset 47748 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Aug 15, 2013 10:41:44 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r47744 r47748 2020 2020 /** Generated by the breakpoint instruction. */ 2021 2021 #define IEM_XCPT_FLAGS_BP_INSTR RT_BIT_32(5) 2022 /** Generated by a DRx instruction breakpoint and RF should be cleared. */ 2023 #define IEM_XCPT_FLAGS_DRx_INSTR_BP RT_BIT_32(6) 2022 2024 /** @} */ 2023 2025 … … 2421 2423 } 2422 2424 2425 /* Calc the flag image to push. */ 2426 uint32_t fEfl = IEMMISC_GET_EFL(pIemCpu, pCtx); 2427 if (fFlags & (IEM_XCPT_FLAGS_DRx_INSTR_BP | IEM_XCPT_FLAGS_T_SOFT_INT)) 2428 fEfl &= ~X86_EFL_RF; 2429 else if (!IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu)) 2430 fEfl |= X86_EFL_RF; /* Vagueness is all I've found on this so far... */ /** @todo Automatically pushing EFLAGS.RF. */ 2431 2432 /* From V8086 mode only go to CPL 0. */ 2423 2433 uint8_t const uNewCpl = DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CONF 2424 2434 ? pIemCpu->uCpl : DescCS.Legacy.Gen.u2Dpl; 2425 uint32_t fEfl = IEMMISC_GET_EFL(pIemCpu, pCtx);2426 if ( !(fFlags & IEM_XCPT_FLAGS_T_SOFT_INT)2427 && (u8Vector != X86_XCPT_DE || (fFlags & IEM_XCPT_FLAGS_T_EXT_INT))2428 && !IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu))2429 fEfl |= X86_EFL_RF; /* Vagueness is all I've found on this so far... */ /** @todo Automatically pushing EFLAGS.RF. */2430 2431 /* From V8086 mode only go to CPL 0. */2432 2435 if ((fEfl & X86_EFL_VM) && uNewCpl != 0) /** @todo When exactly is this raised? */ 2433 2436 { … … 2783 2786 */ 2784 2787 uint64_t uNewRsp; 2785 uint32_t fEfl = IEMMISC_GET_EFL(pIemCpu, pCtx);2786 2788 uint8_t const uNewCpl = DescCS.Legacy.Gen.u4Type & X86_SEL_TYPE_CONF 2787 2789 ? pIemCpu->uCpl : DescCS.Legacy.Gen.u2Dpl; … … 2796 2798 uNewRsp = pCtx->rsp; 2797 2799 uNewRsp &= ~(uint64_t)0xf; 2800 2801 /* 2802 * Calc the flag image to push. 2803 */ 2804 uint32_t fEfl = IEMMISC_GET_EFL(pIemCpu, pCtx); 2805 if (fFlags & (IEM_XCPT_FLAGS_DRx_INSTR_BP | IEM_XCPT_FLAGS_T_SOFT_INT)) 2806 fEfl &= ~X86_EFL_RF; 2807 else if (!IEM_FULL_VERIFICATION_REM_ENABLED(pIemCpu)) 2808 fEfl |= X86_EFL_RF; /* Vagueness is all I've found on this so far... */ /** @todo Automatically pushing EFLAGS.RF. */ 2798 2809 2799 2810 /* … … 9121 9132 && VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) 9122 9133 && EMGetInhibitInterruptsPC(pVCpu) == pOrgCtx->rip) 9123 || ( pOrgCtx->rip <pDebugCtx->rip9124 && (pDebugCtx->rip - pOrgCtx->rip) < 15)9125 && iLoops < 32);9134 || ( pOrgCtx->rip != pDebugCtx->rip 9135 && pIemCpu->uInjectCpl != UINT8_MAX 9136 && iLoops < 8) ); 9126 9137 } 9127 9138 #endif … … 9450 9461 9451 9462 9463 #ifdef LOG_ENABLED 9464 /** 9465 * Logs the current instruction. 9466 * @param pVCpu The cross context virtual CPU structure of the caller. 9467 * @param pCtx The current CPU context. 9468 * @param fSameCtx Set if we have the same context information as the VMM, 9469 * clear if we may have already executed an instruction in 9470 * our debug context. When clear, we assume IEMCPU holds 9471 * valid CPU mode info. 9472 */ 9473 static void iemLogCurInstr(PVMCPU pVCpu, PCPUMCTX pCtx, bool fSameCtx) 9474 { 9475 # ifdef IN_RING3 9476 if (LogIs2Enabled()) 9477 { 9478 char szInstr[256]; 9479 uint32_t cbInstr = 0; 9480 if (fSameCtx) 9481 DBGFR3DisasInstrEx(pVCpu->pVMR3->pUVM, pVCpu->idCpu, 0, 0, 9482 DBGF_DISAS_FLAGS_CURRENT_GUEST | DBGF_DISAS_FLAGS_DEFAULT_MODE, 9483 szInstr, sizeof(szInstr), &cbInstr); 9484 else 9485 { 9486 uint32_t fFlags = 0; 9487 switch (pVCpu->iem.s.enmCpuMode) 9488 { 9489 case IEMMODE_64BIT: fFlags |= DBGF_DISAS_FLAGS_64BIT_MODE; break; 9490 case IEMMODE_32BIT: fFlags |= DBGF_DISAS_FLAGS_32BIT_MODE; break; 9491 case IEMMODE_16BIT: 9492 if (!(pCtx->cr0 & X86_CR0_PE) || pCtx->eflags.Bits.u1VM) 9493 fFlags |= DBGF_DISAS_FLAGS_16BIT_REAL_MODE; 9494 else 9495 fFlags |= DBGF_DISAS_FLAGS_16BIT_MODE; 9496 break; 9497 } 9498 DBGFR3DisasInstrEx(pVCpu->pVMR3->pUVM, pVCpu->idCpu, pCtx->cs.Sel, pCtx->rip, fFlags, 9499 szInstr, sizeof(szInstr), &cbInstr); 9500 } 9501 9502 Log2(("****\n" 9503 " eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n" 9504 " eip=%08x esp=%08x ebp=%08x iopl=%d\n" 9505 " cs=%04x ss=%04x ds=%04x es=%04x fs=%04x gs=%04x efl=%08x\n" 9506 " fsw=%04x fcw=%04x ftw=%02x mxcsr=%04x/%04x\n" 9507 " %s\n" 9508 , 9509 pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi, 9510 pCtx->eip, pCtx->esp, pCtx->ebp, pCtx->eflags.Bits.u2IOPL, 9511 pCtx->cs.Sel, pCtx->ss.Sel, pCtx->ds.Sel, pCtx->es.Sel, 9512 pCtx->fs.Sel, pCtx->gs.Sel, pCtx->eflags.u, 9513 pCtx->fpu.FSW, pCtx->fpu.FCW, pCtx->fpu.FTW, pCtx->fpu.MXCSR, pCtx->fpu.MXCSR_MASK, 9514 szInstr)); 9515 9516 if (LogIs3Enabled()) 9517 DBGFR3Info(pVCpu->pVMR3->pUVM, "cpumguest", "verbose", NULL); 9518 } 9519 else 9520 # endif 9521 LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x\n", 9522 pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->rsp, pCtx->eflags.u)); 9523 } 9524 #endif 9525 9526 9452 9527 /** 9453 9528 * Makes status code addjustments (pass up from I/O and access handler) … … 9541 9616 if (rcStrict == VINF_SUCCESS) 9542 9617 { 9618 # ifdef LOG_ENABLED 9619 iemLogCurInstr(IEMCPU_TO_VMCPU(pIemCpu), pIemCpu->CTX_SUFF(pCtx), false); 9620 # endif 9543 9621 b; IEM_OPCODE_GET_NEXT_U8(&b); 9544 9622 rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); … … 9602 9680 #ifdef LOG_ENABLED 9603 9681 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 9604 # ifdef IN_RING3 9605 if (LogIs2Enabled()) 9606 { 9607 char szInstr[256]; 9608 uint32_t cbInstr = 0; 9609 DBGFR3DisasInstrEx(pVCpu->pVMR3->pUVM, pVCpu->idCpu, 0, 0, 9610 DBGF_DISAS_FLAGS_CURRENT_GUEST | DBGF_DISAS_FLAGS_DEFAULT_MODE, 9611 szInstr, sizeof(szInstr), &cbInstr); 9612 9613 Log2(("**** " 9614 " eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n" 9615 " eip=%08x esp=%08x ebp=%08x iopl=%d\n" 9616 " cs=%04x ss=%04x ds=%04x es=%04x fs=%04x gs=%04x efl=%08x\n" 9617 " fsw=%04x fcw=%04x ftw=%02x mxcsr=%04x/%04x\n" 9618 " %s\n" 9619 , 9620 pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi, 9621 pCtx->eip, pCtx->esp, pCtx->ebp, pCtx->eflags.Bits.u2IOPL, 9622 pCtx->cs.Sel, pCtx->ss.Sel, pCtx->ds.Sel, pCtx->es.Sel, 9623 pCtx->fs.Sel, pCtx->gs.Sel, pCtx->eflags.u, 9624 pCtx->fpu.FSW, pCtx->fpu.FCW, pCtx->fpu.FTW, pCtx->fpu.MXCSR, pCtx->fpu.MXCSR_MASK, 9625 szInstr)); 9626 9627 if (LogIs3Enabled()) 9628 DBGFR3Info(pVCpu->pVMR3->pUVM, "cpumguest", "verbose", NULL); 9629 } 9630 else 9631 # endif 9632 LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x\n", 9633 pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->rsp, pCtx->eflags.u)); 9682 iemLogCurInstr(pVCpu, pCtx, true); 9634 9683 #endif 9635 9684 … … 9762 9811 { 9763 9812 PIEMCPU pIemCpu = &pVCpu->iem.s; 9764 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx);9765 9813 9766 9814 /* … … 9768 9816 */ 9769 9817 #if !defined(IEM_VERIFICATION_MODE_FULL) || !defined(IN_RING3) 9818 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 9770 9819 # ifdef IEM_VERIFICATION_MODE_FULL 9771 9820 pIemCpu->uInjectCpl = UINT8_MAX; … … 9786 9835 #else 9787 9836 iemExecVerificationModeSetup(pIemCpu); 9837 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 9788 9838 #endif 9789 9839 … … 9792 9842 */ 9793 9843 #ifdef LOG_ENABLED 9794 # ifdef IN_RING3 9795 if (LogIs2Enabled()) 9796 { 9797 char szInstr[256]; 9798 uint32_t cbInstr = 0; 9799 DBGFR3DisasInstrEx(pVCpu->pVMR3->pUVM, pVCpu->idCpu, 0, 0, 9800 DBGF_DISAS_FLAGS_CURRENT_GUEST | DBGF_DISAS_FLAGS_DEFAULT_MODE, 9801 szInstr, sizeof(szInstr), &cbInstr); 9802 9803 Log2(("**** " 9804 " eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n" 9805 " eip=%08x esp=%08x ebp=%08x iopl=%d\n" 9806 " cs=%04x ss=%04x ds=%04x es=%04x fs=%04x gs=%04x efl=%08x\n" 9807 " fsw=%04x fcw=%04x ftw=%02x mxcsr=%04x/%04x\n" 9808 " %s\n" 9809 , 9810 pCtx->eax, pCtx->ebx, pCtx->ecx, pCtx->edx, pCtx->esi, pCtx->edi, 9811 pCtx->eip, pCtx->esp, pCtx->ebp, pCtx->eflags.Bits.u2IOPL, 9812 pCtx->cs.Sel, pCtx->ss.Sel, pCtx->ds.Sel, pCtx->es.Sel, 9813 pCtx->fs.Sel, pCtx->gs.Sel, pCtx->eflags.u, 9814 pCtx->fpu.FSW, pCtx->fpu.FCW, pCtx->fpu.FTW, pCtx->fpu.MXCSR, pCtx->fpu.MXCSR_MASK, 9815 szInstr)); 9816 9817 if (LogIs3Enabled()) 9818 DBGFR3Info(pVCpu->pVMR3->pUVM, "cpumguest", "verbose", NULL); 9819 } 9820 else 9821 # endif 9822 LogFlow(("IEMExecOne: cs:rip=%04x:%08RX64 ss:rsp=%04x:%08RX64 EFL=%06x\n", 9823 pCtx->cs.Sel, pCtx->rip, pCtx->ss.Sel, pCtx->rsp, pCtx->eflags.u)); 9844 iemLogCurInstr(pVCpu, pCtx, true); 9824 9845 #endif 9825 9846
Note:
See TracChangeset
for help on using the changeset viewer.