Changeset 18927 in vbox for trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
- Timestamp:
- Apr 16, 2009 11:41:38 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMGC/TRPMGCHandlers.cpp
r18876 r18927 37 37 #include "TRPMInternal.h" 38 38 #include <VBox/vm.h> 39 #include <VBox/vmm.h> 39 40 #include <VBox/param.h> 40 41 … … 134 135 static int trpmGCExitTrap(PVM pVM, int rc, PCPUMCTXCORE pRegFrame) 135 136 { 137 PVMCPU pVCpu = VMMGetCpu0(pVM); 136 138 uint32_t uOldActiveVector = pVM->trpm.s.uActiveVector; 137 139 NOREF(uOldActiveVector); … … 166 168 if (VM_FF_ISSET(pVM, VM_FF_INHIBIT_INTERRUPTS)) 167 169 { 168 Log2(("VM_FF_INHIBIT_INTERRUPTS at %08RX32 successor %RGv\n", pRegFrame->eip, EMGetInhibitInterruptsPC(pVM )));169 if (pRegFrame->eip != EMGetInhibitInterruptsPC(pVM ))170 Log2(("VM_FF_INHIBIT_INTERRUPTS at %08RX32 successor %RGv\n", pRegFrame->eip, EMGetInhibitInterruptsPC(pVM, pVCpu))); 171 if (pRegFrame->eip != EMGetInhibitInterruptsPC(pVM, pVCpu)) 170 172 { 171 173 /** @note we intentionally don't clear VM_FF_INHIBIT_INTERRUPTS here if the eip is the same as the inhibited instr address. … … 227 229 else if (VM_FF_ISPENDING(pVM, VM_FF_PGM_SYNC_CR3 | VM_FF_PGM_SYNC_CR3_NON_GLOBAL)) 228 230 #if 1 229 rc = PGMSyncCR3(pVM, CPUMGetGuestCR0(pVM), CPUMGetGuestCR3(pVM), CPUMGetGuestCR4(pVM), VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3));231 rc = PGMSyncCR3(pVM, pVCpu, CPUMGetGuestCR0(pVCpu), CPUMGetGuestCR3(pVCpu), CPUMGetGuestCR4(pVCpu), VM_FF_ISSET(pVM, VM_FF_PGM_SYNC_CR3)); 230 232 #else 231 233 rc = VINF_PGM_SYNC_CR3; … … 258 260 { 259 261 RTGCUINTREG uDr6 = ASMGetAndClearDR6(); 260 PVM pVM = TRPM2VM(pTrpm); 262 PVM pVM = TRPM2VM(pTrpm); 263 PVMCPU pVCpu = VMMGetCpu0(pVM); 264 261 265 LogFlow(("TRPMGC01: cs:eip=%04x:%08x uDr6=%RTreg\n", pRegFrame->cs, pRegFrame->eip, uDr6)); 262 266 … … 268 272 { 269 273 AssertReleaseMsgFailed(("X86_DR6_BD isn't used, but it's set! dr7=%RTreg(%RTreg) dr6=%RTreg\n", 270 ASMGetDR7(), CPUMGetHyperDR7(pV M), uDr6));274 ASMGetDR7(), CPUMGetHyperDR7(pVCpu), uDr6)); 271 275 return VERR_NOT_IMPLEMENTED; 272 276 } … … 279 283 int rc = DBGFGCTrap01Handler(pVM, pRegFrame, uDr6); 280 284 if (rc == VINF_EM_RAW_GUEST_TRAP) 281 CPUMSetGuestDR6(pV M, uDr6);285 CPUMSetGuestDR6(pVCpu, uDr6); 282 286 283 287 rc = trpmGCExitTrap(pVM, rc, pRegFrame); … … 361 365 { 362 366 LogFlow(("TRPMGC06: %04x:%08x efl=%x\n", pRegFrame->cs, pRegFrame->eip, pRegFrame->eflags.u32)); 363 PVM pVM = TRPM2VM(pTrpm); 364 int rc; 365 366 if (CPUMGetGuestCPL(pVM, pRegFrame) == 0) 367 PVM pVM = TRPM2VM(pTrpm); 368 PVMCPU pVCpu = VMMGetCpu0(pVM); 369 int rc; 370 371 if (CPUMGetGuestCPL(pVCpu, pRegFrame) == 0) 367 372 { 368 373 /* … … 381 386 DISCPUSTATE Cpu; 382 387 uint32_t cbOp; 383 rc = EMInterpretDisasOneEx(pVM, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp);388 rc = EMInterpretDisasOneEx(pVM, pVCpu, (RTGCUINTPTR)PC, pRegFrame, &Cpu, &cbOp); 384 389 if (RT_FAILURE(rc)) 385 390 { … … 429 434 { 430 435 uint32_t cbIgnored; 431 rc = EMInterpretInstructionCPU(pVM, &Cpu, pRegFrame, PC, &cbIgnored);436 rc = EMInterpretInstructionCPU(pVM, pVCpu, &Cpu, pRegFrame, PC, &cbIgnored); 432 437 if (RT_LIKELY(RT_SUCCESS(rc))) 433 438 pRegFrame->eip += Cpu.opsize; … … 465 470 { 466 471 LogFlow(("TRPMGC07: %04x:%08x\n", pRegFrame->cs, pRegFrame->eip)); 467 PVM pVM = TRPM2VM(pTrpm); 468 469 int rc = CPUMHandleLazyFPU(pVM, VMMGetCpu(pVM)); 472 PVM pVM = TRPM2VM(pTrpm); 473 PVMCPU pVCpu = VMMGetCpu0(pVM); 474 475 int rc = CPUMHandleLazyFPU(pVCpu); 470 476 rc = trpmGCExitTrap(pVM, rc, pRegFrame); 471 477 Log6(("TRPMGC07: %Rrc (%04x:%08x)\n", rc, pRegFrame->cs, pRegFrame->eip)); … … 586 592 static int trpmGCTrap0dHandlerRing0(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR PC) 587 593 { 588 int rc; 594 int rc; 595 PVMCPU pVCpu = VMMGetCpu0(pVM); 589 596 590 597 /* … … 661 668 { 662 669 uint32_t cbIgnored; 663 rc = EMInterpretInstructionCPU(pVM, p Cpu, pRegFrame, PC, &cbIgnored);670 rc = EMInterpretInstructionCPU(pVM, pVCpu, pCpu, pRegFrame, PC, &cbIgnored); 664 671 if (RT_SUCCESS(rc)) 665 672 pRegFrame->eip += pCpu->opsize; … … 688 695 static int trpmGCTrap0dHandlerRing3(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu, RTGCPTR PC) 689 696 { 690 int rc; 697 int rc; 698 PVMCPU pVCpu = VMMGetCpu0(pVM); 691 699 692 700 Assert(!pRegFrame->eflags.Bits.u1VM); … … 740 748 { 741 749 uint32_t cbIgnored; 742 rc = EMInterpretInstructionCPU(pVM, p Cpu, pRegFrame, PC, &cbIgnored);750 rc = EMInterpretInstructionCPU(pVM, pVCpu, pCpu, pRegFrame, PC, &cbIgnored); 743 751 if (RT_SUCCESS(rc)) 744 752 pRegFrame->eip += pCpu->opsize; … … 754 762 case OP_CLI: 755 763 { 756 uint32_t efl = CPUMRawGetEFlags(pV M, pRegFrame);764 uint32_t efl = CPUMRawGetEFlags(pVCpu, pRegFrame); 757 765 if (X86_EFL_GET_IOPL(efl) >= (unsigned)(pRegFrame->ss & X86_SEL_RPL)) 758 766 { … … 783 791 DECLINLINE(int) trpmGCTrap0dHandlerRdTsc(PVM pVM, PCPUMCTXCORE pRegFrame) 784 792 { 793 PVMCPU pVCpu = VMMGetCpu0(pVM); 794 785 795 STAM_COUNTER_INC(&pVM->trpm.s.StatTrap0dRdTsc); 786 796 787 if (CPUMGetGuestCR4(pV M) & X86_CR4_TSD)797 if (CPUMGetGuestCR4(pVCpu) & X86_CR4_TSD) 788 798 return trpmGCExitTrap(pVM, VINF_EM_RAW_EMULATE_INSTR, pRegFrame); /* will trap (optimize later). */ 789 799 … … 809 819 static int trpmGCTrap0dHandler(PVM pVM, PTRPM pTrpm, PCPUMCTXCORE pRegFrame) 810 820 { 821 PVMCPU pVCpu = VMMGetCpu0(pVM); 822 811 823 LogFlow(("trpmGCTrap0dHandler: cs:eip=%RTsel:%08RX32 uErr=%RGv\n", pRegFrame->ss, pRegFrame->eip, pTrpm->uActiveErrorCode)); 812 824 … … 861 873 && (Cpu.pCurInstr->optype & OPTYPE_PORTIO)) 862 874 { 863 rc = EMInterpretPortIO(pVM, p RegFrame, &Cpu, cbOp);875 rc = EMInterpretPortIO(pVM, pVCpu, pRegFrame, &Cpu, cbOp); 864 876 return trpmGCExitTrap(pVM, rc, pRegFrame); 865 877 } … … 887 899 */ 888 900 X86EFLAGS eflags; 889 eflags.u32 = CPUMRawGetEFlags(pV M, pRegFrame); /* Get the correct value. */901 eflags.u32 = CPUMRawGetEFlags(pVCpu, pRegFrame); /* Get the correct value. */ 890 902 Log3(("TRPM #GP V86: cs:eip=%04x:%08x IOPL=%d efl=%08x\n", pRegFrame->cs, pRegFrame->eip, eflags.Bits.u2IOPL, eflags.u)); 891 903 if (eflags.Bits.u2IOPL != 3) … … 971 983 { 972 984 LogFlow(("TRPMGC0e: %04x:%08x err=%x cr2=%08x\n", pRegFrame->cs, pRegFrame->eip, (uint32_t)pTrpm->uActiveErrorCode, (uint32_t)pTrpm->uActiveCR2)); 973 PVM pVM = TRPM2VM(pTrpm); 985 PVM pVM = TRPM2VM(pTrpm); 986 PVMCPU pVCpu = VMMGetCpu0(pVM); 974 987 975 988 … … 977 990 * This is all PGM stuff. 978 991 */ 979 int rc = PGMTrap0eHandler(pVM, p Trpm->uActiveErrorCode, pRegFrame, (RTGCPTR)pTrpm->uActiveCR2);992 int rc = PGMTrap0eHandler(pVM, pVCpu, pTrpm->uActiveErrorCode, pRegFrame, (RTGCPTR)pTrpm->uActiveCR2); 980 993 switch (rc) 981 994 { … … 1235 1248 1236 1249 1237 CPUMSetGuestCtxCore( pVM, &CtxCore);1250 CPUMSetGuestCtxCore(VMMGetCpu0(pVM), &CtxCore); 1238 1251 TRPMGCHyperReturnToHost(pVM, rc); 1239 1252 }
Note:
See TracChangeset
for help on using the changeset viewer.