- Timestamp:
- Jul 3, 2009 2:38:58 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/EMHandleRCTmpl.h
r21196 r21208 126 126 PATMFL_MMIO_ACCESS | ((SELMGetCpuModeFromSelector(pVM, pCtx->eflags, pCtx->cs, &pCtx->csHid) == CPUMODE_32BIT) ? PATMFL_CODE32 : 0)); 127 127 if (RT_FAILURE(rc)) 128 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "MMIO");128 rc = emR3ExecuteInstruction(pVM, pVCpu, "MMIO"); 129 129 break; 130 130 131 131 case VINF_PATM_HC_MMIO_PATCH_WRITE: 132 132 AssertFailed(); /* not yet implemented. */ 133 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "MMIO");133 rc = emR3ExecuteInstruction(pVM, pVCpu, "MMIO"); 134 134 break; 135 135 #endif /* EMHANDLERC_WITH_PATM */ … … 200 200 case VINF_IOM_HC_IOPORT_READ: 201 201 case VINF_IOM_HC_IOPORT_WRITE: 202 rc = emR3 RawExecuteIOInstruction(pVM, pVCpu);202 rc = emR3ExecuteIOInstruction(pVM, pVCpu); 203 203 break; 204 204 … … 209 209 case VINF_IOM_HC_MMIO_WRITE: 210 210 case VINF_IOM_HC_MMIO_READ_WRITE: 211 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "MMIO");211 rc = emR3ExecuteInstruction(pVM, pVCpu, "MMIO"); 212 212 break; 213 213 … … 226 226 */ 227 227 case VINF_EM_RAW_EMULATE_INSTR_LDT_FAULT: 228 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "LDT FAULT: ");228 rc = emR3ExecuteInstruction(pVM, pVCpu, "LDT FAULT: "); 229 229 break; 230 230 case VINF_EM_RAW_EMULATE_INSTR_GDT_FAULT: 231 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "GDT FAULT: ");231 rc = emR3ExecuteInstruction(pVM, pVCpu, "GDT FAULT: "); 232 232 break; 233 233 case VINF_EM_RAW_EMULATE_INSTR_IDT_FAULT: 234 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "IDT FAULT: ");234 rc = emR3ExecuteInstruction(pVM, pVCpu, "IDT FAULT: "); 235 235 break; 236 236 case VINF_EM_RAW_EMULATE_INSTR_TSS_FAULT: 237 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "TSS FAULT: ");237 rc = emR3ExecuteInstruction(pVM, pVCpu, "TSS FAULT: "); 238 238 break; 239 239 case VINF_EM_RAW_EMULATE_INSTR_PD_FAULT: 240 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "PD FAULT: ");240 rc = emR3ExecuteInstruction(pVM, pVCpu, "PD FAULT: "); 241 241 break; 242 242 case VINF_EM_RAW_EMULATE_INSTR_HLT: … … 248 248 #ifdef EMHANDLERC_WITH_PATM 249 249 case VINF_PATM_PENDING_IRQ_AFTER_IRET: 250 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "EMUL: ", VINF_PATM_PENDING_IRQ_AFTER_IRET);250 rc = emR3ExecuteInstruction(pVM, pVCpu, "EMUL: ", VINF_PATM_PENDING_IRQ_AFTER_IRET); 251 251 break; 252 252 … … 256 256 #endif 257 257 case VINF_EM_RAW_EMULATE_INSTR: 258 rc = emR3 RawExecuteInstruction(pVM, pVCpu, "EMUL: ");258 rc = emR3ExecuteInstruction(pVM, pVCpu, "EMUL: "); 259 259 break; 260 260 -
trunk/src/VBox/VMM/EMHwaccm.cpp
r21196 r21208 78 78 * Internal Functions * 79 79 *******************************************************************************/ 80 DECLINLINE(int) emR3 RawExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC = VINF_SUCCESS);81 static int emR3 RawExecuteIOInstruction(PVM pVM, PVMCPU pVCpu);80 DECLINLINE(int) emR3ExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC = VINF_SUCCESS); 81 static int emR3ExecuteIOInstruction(PVM pVM, PVMCPU pVCpu); 82 82 static int emR3HwaccmForcedActions(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx); 83 83 … … 181 181 */ 182 182 #ifdef LOG_ENABLED 183 static int emR3 RawExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC, const char *pszPrefix)183 static int emR3ExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC, const char *pszPrefix) 184 184 #else 185 static int emR3 RawExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC)185 static int emR3ExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC) 186 186 #endif 187 187 { … … 277 277 * @param rcGC GC return code 278 278 */ 279 DECLINLINE(int) emR3 RawExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC)279 DECLINLINE(int) emR3ExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC) 280 280 { 281 281 #ifdef LOG_ENABLED 282 return emR3 RawExecuteInstructionWorker(pVM, pVCpu, rcGC, pszPrefix);282 return emR3ExecuteInstructionWorker(pVM, pVCpu, rcGC, pszPrefix); 283 283 #else 284 return emR3 RawExecuteInstructionWorker(pVM, pVCpu, rcGC);284 return emR3ExecuteInstructionWorker(pVM, pVCpu, rcGC); 285 285 #endif 286 286 } … … 293 293 * @param pVCpu VMCPU handle. 294 294 */ 295 static int emR3 RawExecuteIOInstruction(PVM pVM, PVMCPU pVCpu)295 static int emR3ExecuteIOInstruction(PVM pVM, PVMCPU pVCpu) 296 296 { 297 297 int rc; … … 378 378 } 379 379 STAM_PROFILE_STOP(&pVCpu->em.s.StatIOEmu, a); 380 return emR3 RawExecuteInstruction(pVM, pVCpu, "IO: ");380 return emR3ExecuteInstruction(pVM, pVCpu, "IO: "); 381 381 } 382 382 -
trunk/src/VBox/VMM/EMRaw.cpp
r21196 r21208 80 80 *******************************************************************************/ 81 81 static int emR3RawForcedActions(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx); 82 DECLINLINE(int) emR3 RawExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC = VINF_SUCCESS);82 DECLINLINE(int) emR3ExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC = VINF_SUCCESS); 83 83 static int emR3RawGuestTrap(PVM pVM, PVMCPU pVCpu); 84 84 static int emR3PatchTrap(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, int gcret); 85 85 static int emR3SingleStepExecRem(PVM pVM, uint32_t cIterations); 86 86 static int emR3RawPrivileged(PVM pVM, PVMCPU pVCpu); 87 static int emR3 RawExecuteIOInstruction(PVM pVM, PVMCPU pVCpu);87 static int emR3ExecuteIOInstruction(PVM pVM, PVMCPU pVCpu); 88 88 static int emR3RawRingSwitch(PVM pVM, PVMCPU pVCpu); 89 89 … … 323 323 */ 324 324 #ifdef LOG_ENABLED 325 static int emR3 RawExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC, const char *pszPrefix)325 static int emR3ExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC, const char *pszPrefix) 326 326 #else 327 static int emR3 RawExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC)327 static int emR3ExecuteInstructionWorker(PVM pVM, PVMCPU pVCpu, int rcGC) 328 328 #endif 329 329 { … … 358 358 if (PATMIsPatchGCAddr(pVM, pCtx->eip)) 359 359 { 360 Log(("emR3 RawExecuteInstruction: In patch block. eip=%RRv\n", (RTRCPTR)pCtx->eip));360 Log(("emR3ExecuteInstruction: In patch block. eip=%RRv\n", (RTRCPTR)pCtx->eip)); 361 361 362 362 RTGCPTR pNewEip; … … 369 369 */ 370 370 case VINF_SUCCESS: 371 Log(("emR3 RawExecuteInstruction: Executing instruction starting at new address %RGv IF=%d VMIF=%x\n",371 Log(("emR3ExecuteInstruction: Executing instruction starting at new address %RGv IF=%d VMIF=%x\n", 372 372 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 373 373 pCtx->eip = pNewEip; … … 380 380 */ 381 381 Log(("PATCH: IF=1 -> emulate last instruction as it can't be interrupted!!\n")); 382 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHIR");382 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHIR"); 383 383 } 384 384 else if (rcGC == VINF_PATM_PENDING_IRQ_AFTER_IRET) 385 385 { 386 386 /* special case: iret, that sets IF, detected a pending irq/event */ 387 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHIRET");387 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHIRET"); 388 388 } 389 389 return VINF_EM_RESCHEDULE_REM; … … 393 393 */ 394 394 case VINF_PATCH_EMULATE_INSTR: 395 Log(("emR3 RawExecuteInstruction: Emulate patched instruction at %RGv IF=%d VMIF=%x\n",395 Log(("emR3ExecuteInstruction: Emulate patched instruction at %RGv IF=%d VMIF=%x\n", 396 396 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 397 397 pCtx->eip = pNewEip; 398 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHIR");398 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHIR"); 399 399 400 400 /* … … 402 402 */ 403 403 case VERR_PATCH_DISABLED: 404 Log(("emR3 RawExecuteInstruction: Disabled patch -> new eip %RGv IF=%d VMIF=%x\n",404 Log(("emR3ExecuteInstruction: Disabled patch -> new eip %RGv IF=%d VMIF=%x\n", 405 405 pNewEip, pCtx->eflags.Bits.u1IF, pVCpu->em.s.pPatmGCState->uVMFlags)); 406 406 pCtx->eip = pNewEip; … … 411 411 */ 412 412 Log(("PATCH: IF=1 -> emulate last instruction as it can't be interrupted!!\n")); 413 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHIR");413 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHIR"); 414 414 } 415 415 return VINF_EM_RESCHEDULE_REM; … … 486 486 * @param rcGC GC return code 487 487 */ 488 DECLINLINE(int) emR3 RawExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC)488 DECLINLINE(int) emR3ExecuteInstruction(PVM pVM, PVMCPU pVCpu, const char *pszPrefix, int rcGC) 489 489 { 490 490 #ifdef LOG_ENABLED 491 return emR3 RawExecuteInstructionWorker(pVM, pVCpu, rcGC, pszPrefix);491 return emR3ExecuteInstructionWorker(pVM, pVCpu, rcGC, pszPrefix); 492 492 #else 493 return emR3 RawExecuteInstructionWorker(pVM, pVCpu, rcGC);493 return emR3ExecuteInstructionWorker(pVM, pVCpu, rcGC); 494 494 #endif 495 495 } … … 502 502 * @param pVCpu VMCPU handle. 503 503 */ 504 static int emR3 RawExecuteIOInstruction(PVM pVM, PVMCPU pVCpu)504 static int emR3ExecuteIOInstruction(PVM pVM, PVMCPU pVCpu) 505 505 { 506 506 int rc; … … 586 586 } 587 587 STAM_PROFILE_STOP(&pVCpu->em.s.StatIOEmu, a); 588 return emR3 RawExecuteInstruction(pVM, pVCpu, "IO: ");588 return emR3ExecuteInstruction(pVM, pVCpu, "IO: "); 589 589 } 590 590 … … 702 702 return rc; 703 703 } 704 return emR3 RawExecuteInstruction(pVM, pVCpu, "Monitor: ");704 return emR3ExecuteInstruction(pVM, pVCpu, "Monitor: "); 705 705 } 706 706 } … … 724 724 rc = TRPMResetTrap(pVCpu); 725 725 AssertRC(rc); 726 return emR3 RawExecuteInstruction(pVM, pVCpu, "IO Guest Trap: ");726 return emR3ExecuteInstruction(pVM, pVCpu, "IO Guest Trap: "); 727 727 } 728 728 } … … 809 809 810 810 /* go to the REM to emulate a single instruction */ 811 return emR3 RawExecuteInstruction(pVM, pVCpu, "RSWITCH: ");811 return emR3ExecuteInstruction(pVM, pVCpu, "RSWITCH: "); 812 812 } 813 813 … … 947 947 /* Note: possibly because a reschedule is required (e.g. iret to V86 code) */ 948 948 949 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHIR");949 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHIR"); 950 950 /* Interrupts are enabled; just go back to the original instruction. 951 951 return VINF_SUCCESS; */ … … 962 962 pCtx->eip = pNewEip; 963 963 AssertRelease(pCtx->eip); 964 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHEMUL: ");964 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHEMUL: "); 965 965 966 966 /* … … 979 979 */ 980 980 Log(("PATCH: IF=1 -> emulate last instruction as it can't be interrupted!!\n")); 981 return emR3 RawExecuteInstruction(pVM, pVCpu, "PATCHIR");981 return emR3ExecuteInstruction(pVM, pVCpu, "PATCHIR"); 982 982 } 983 983 return VINF_EM_RESCHEDULE_REM; … … 1242 1242 return emR3PatchTrap(pVM, pVCpu, pCtx, VINF_PATM_PATCH_TRAP_GP); 1243 1243 1244 return emR3 RawExecuteInstruction(pVM, pVCpu, "PRIV");1244 return emR3ExecuteInstruction(pVM, pVCpu, "PRIV"); 1245 1245 } 1246 1246 -
trunk/src/VBox/VMM/HWACCMInternal.h
r21001 r21208 168 168 uint64_t u; 169 169 } VMX_CAPABILITY; 170 171 typedef enum 172 { 173 HWACCMPENDINGIO_INVALID = 0, 174 HWACCMPENDINGIO_PORT_READ, 175 HWACCMPENDINGIO_PORT_WRITE, 176 HWACCMPENDINGIO_STRING_READ, 177 HWACCMPENDINGIO_STRING_WRITE, 178 /** The usual 32-bit paranoia. */ 179 HWACCMPENDINGIO_32BIT_HACK = 0x7fffffff 180 } HWACCMPENDINGIO; 170 181 171 182 /** … … 582 593 uint64_t cr0; 583 594 } EmulateIoBlock; 595 596 struct 597 { 598 /* Pending IO operation type. */ 599 HWACCMPENDINGIO enmType; 600 uint32_t uPadding; 601 union 602 { 603 struct 604 { 605 RTGCPTR rip; 606 unsigned uPort; 607 unsigned uAndVal; 608 unsigned cbSize; 609 } Read; 610 struct 611 { 612 RTGCPTR rip; 613 unsigned uPort; 614 unsigned uValue; 615 unsigned cbSize; 616 } Write; 617 uint64_t aRaw[4]; 618 } Port; 619 } PendingIO; 584 620 585 621 /** Currenty shadow paging mode. */ -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r20981 r21208 1218 1218 1219 1219 return 0; 1220 } 1221 1222 /** 1223 * Save a pending IO read. 1224 * 1225 * @param pVCpu The VMCPU to operate on. 1226 * @param GCPtrRIP Address of IO instruction 1227 * @param uPort Port address 1228 * @param uAndVal And mask for saving the result in eax 1229 * @param cbSize Read size 1230 */ 1231 VMMR0DECL(void) HWACCMR0SavePendingIOPortRead(PVMCPU pVCpu, RTGCPTR GCPtrRIP, unsigned uPort, unsigned uAndVal, unsigned cbSize) 1232 { 1233 pVCpu->hwaccm.s.PendingIO.enmType = HWACCMPENDINGIO_PORT_READ; 1234 pVCpu->hwaccm.s.PendingIO.Port.Read.rip = GCPtrRIP; 1235 pVCpu->hwaccm.s.PendingIO.Port.Read.uPort = uPort; 1236 pVCpu->hwaccm.s.PendingIO.Port.Read.uAndVal = uAndVal; 1237 pVCpu->hwaccm.s.PendingIO.Port.Read.cbSize = cbSize; 1238 return; 1239 } 1240 1241 /** 1242 * Save a pending IO write. 1243 * 1244 * @param pVCpu The VMCPU to operate on. 1245 * @param GCPtrRIP Address of IO instruction 1246 * @param uPort Port address 1247 * @param uValue Value to write 1248 * @param cbSize Read size 1249 */ 1250 VMMR0DECL(void) HWACCMR0SavePendingIOPortWrite(PVMCPU pVCpu, RTGCPTR GCPtrRIP, unsigned uPort, unsigned uValue, unsigned cbSize) 1251 { 1252 pVCpu->hwaccm.s.PendingIO.enmType = HWACCMPENDINGIO_PORT_WRITE; 1253 pVCpu->hwaccm.s.PendingIO.Port.Write.rip = GCPtrRIP; 1254 pVCpu->hwaccm.s.PendingIO.Port.Write.uPort = uPort; 1255 pVCpu->hwaccm.s.PendingIO.Port.Write.uValue = uValue; 1256 pVCpu->hwaccm.s.PendingIO.Port.Write.cbSize = cbSize; 1257 return; 1220 1258 } 1221 1259 -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r21196 r21208 2108 2108 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOWrite); 2109 2109 rc = IOMIOPortWrite(pVM, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize); 2110 if (rc == VINF_IOM_HC_IOPORT_WRITE) 2111 HWACCMR0SavePendingIOPortWrite(pVCpu, pCtx->rip, IoExitInfo.n.u16Port, pCtx->eax & uAndVal, uIOSize); 2110 2112 } 2111 2113 else … … 2121 2123 Log2(("IOMIOPortRead %RGv %x %x size=%d\n", (RTGCPTR)pCtx->rip, IoExitInfo.n.u16Port, u32Val & uAndVal, uIOSize)); 2122 2124 } 2125 else 2126 if (rc == VINF_IOM_HC_IOPORT_READ) 2127 HWACCMR0SavePendingIOPortRead(pVCpu, pCtx->rip, IoExitInfo.n.u16Port, uAndVal, uIOSize); 2123 2128 } 2124 2129 } -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r21196 r21208 3391 3391 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitIOWrite); 3392 3392 rc = IOMIOPortWrite(pVM, uPort, pCtx->eax & uAndVal, cbSize); 3393 if (rc == VINF_IOM_HC_IOPORT_WRITE) 3394 HWACCMR0SavePendingIOPortWrite(pVCpu, pCtx->rip, uPort, pCtx->eax & uAndVal, cbSize); 3393 3395 } 3394 3396 else … … 3403 3405 pCtx->eax = (pCtx->eax & ~uAndVal) | (u32Val & uAndVal); 3404 3406 } 3407 else 3408 if (rc == VINF_IOM_HC_IOPORT_READ) 3409 HWACCMR0SavePendingIOPortRead(pVCpu, pCtx->rip, uPort, uAndVal, cbSize); 3405 3410 } 3406 3411 }
Note:
See TracChangeset
for help on using the changeset viewer.