Changeset 87493 in vbox
- Timestamp:
- Jan 30, 2021 1:57:34 AM (4 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 5 edited
-
VMMR0/HMSVMR0.cpp (modified) (4 diffs)
-
VMMR3/HM.cpp (modified) (10 diffs)
-
include/HMInternal.h (modified) (2 diffs)
-
include/HMInternal.mac (modified) (2 diffs)
-
testcase/tstVMStructSize.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r87487 r87493 6352 6352 else 6353 6353 { 6354 PDISCPUSTATE pDis = &pVCpu->hm .s.DisState;6354 PDISCPUSTATE pDis = &pVCpu->hmr0.s.svm.DisState; 6355 6355 int rc = EMInterpretDisasCurrent(pVCpu->CTX_SUFF(pVM), pVCpu, pDis, &cbInstr); 6356 6356 if ( rc == VINF_SUCCESS … … 7050 7050 else 7051 7051 { 7052 PDISCPUSTATE pDis = &pVCpu->hm .s.DisState;7052 PDISCPUSTATE pDis = &pVCpu->hmr0.s.svm.DisState; 7053 7053 int rc = EMInterpretDisasCurrent(pVCpu->CTX_SUFF(pVM), pVCpu, pDis, &cbInstr); 7054 7054 if ( rc == VINF_SUCCESS … … 7094 7094 else 7095 7095 { 7096 PDISCPUSTATE pDis = &pVCpu->hm .s.DisState;7096 PDISCPUSTATE pDis = &pVCpu->hmr0.s.svm.DisState; 7097 7097 int rc = EMInterpretDisasCurrent(pVCpu->CTX_SUFF(pVM), pVCpu, pDis, &cbInstr); 7098 7098 if ( rc == VINF_SUCCESS … … 7407 7407 if (!(pCtx->cr0 & X86_CR0_NE)) 7408 7408 { 7409 PVMCC pVM = pVCpu->CTX_SUFF(pVM);7410 PDISSTATE pDis = &pVCpu->hm .s.DisState;7409 PVMCC pVM = pVCpu->CTX_SUFF(pVM); 7410 PDISSTATE pDis = &pVCpu->hmr0.s.svm.DisState; 7411 7411 unsigned cbInstr; 7412 7412 int rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbInstr); -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r87491 r87493 2272 2272 */ 2273 2273 DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, "hmR3ReplaceTprInstr"); 2274 PDISCPUSTATE pDis = &pVCpu->hm.s.DisState;2274 DISCPUSTATE Dis; 2275 2275 uint32_t cbOp; 2276 int rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);2276 int rc = EMInterpretDisasCurrent(pVM, pVCpu, &Dis, &cbOp); 2277 2277 AssertRC(rc); 2278 2278 if ( rc == VINF_SUCCESS 2279 && pDis->pCurInstr->uOpcode == OP_MOV2279 && Dis.pCurInstr->uOpcode == OP_MOV 2280 2280 && cbOp >= 3) 2281 2281 { … … 2287 2287 pPatch->cbOp = cbOp; 2288 2288 2289 if ( pDis->Param1.fUse == DISUSE_DISPLACEMENT32)2289 if (Dis.Param1.fUse == DISUSE_DISPLACEMENT32) 2290 2290 { 2291 2291 /* write. */ 2292 if ( pDis->Param2.fUse == DISUSE_REG_GEN32)2292 if (Dis.Param2.fUse == DISUSE_REG_GEN32) 2293 2293 { 2294 2294 pPatch->enmType = HMTPRINSTR_WRITE_REG; 2295 pPatch->uSrcOperand = pDis->Param2.Base.idxGenReg;2296 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_REG %u\n", pDis->Param2.Base.idxGenReg));2295 pPatch->uSrcOperand = Dis.Param2.Base.idxGenReg; 2296 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_REG %u\n", Dis.Param2.Base.idxGenReg)); 2297 2297 } 2298 2298 else 2299 2299 { 2300 Assert( pDis->Param2.fUse == DISUSE_IMMEDIATE32);2300 Assert(Dis.Param2.fUse == DISUSE_IMMEDIATE32); 2301 2301 pPatch->enmType = HMTPRINSTR_WRITE_IMM; 2302 pPatch->uSrcOperand = pDis->Param2.uValue;2303 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_IMM %#llx\n", pDis->Param2.uValue));2302 pPatch->uSrcOperand = Dis.Param2.uValue; 2303 Log(("hmR3ReplaceTprInstr: HMTPRINSTR_WRITE_IMM %#llx\n", Dis.Param2.uValue)); 2304 2304 } 2305 2305 rc = PGMPhysSimpleWriteGCPtr(pVCpu, pCtx->rip, s_abVMMCall, sizeof(s_abVMMCall)); … … 2320 2320 * shr eax, 4 2321 2321 */ 2322 Assert( pDis->Param1.fUse == DISUSE_REG_GEN32);2323 2324 uint8_t const idxMmioReg = pDis->Param1.Base.idxGenReg;2322 Assert(Dis.Param1.fUse == DISUSE_REG_GEN32); 2323 2324 uint8_t const idxMmioReg = Dis.Param1.Base.idxGenReg; 2325 2325 uint8_t const cbOpMmio = cbOp; 2326 2326 uint64_t const uSavedRip = pCtx->rip; 2327 2327 2328 2328 pCtx->rip += cbOp; 2329 rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);2329 rc = EMInterpretDisasCurrent(pVM, pVCpu, &Dis, &cbOp); 2330 2330 DBGFR3_DISAS_INSTR_CUR_LOG(pVCpu, "Following read"); 2331 2331 pCtx->rip = uSavedRip; 2332 2332 2333 2333 if ( rc == VINF_SUCCESS 2334 && pDis->pCurInstr->uOpcode == OP_SHR2335 && pDis->Param1.fUse == DISUSE_REG_GEN322336 && pDis->Param1.Base.idxGenReg == idxMmioReg2337 && pDis->Param2.fUse == DISUSE_IMMEDIATE82338 && pDis->Param2.uValue == 42334 && Dis.pCurInstr->uOpcode == OP_SHR 2335 && Dis.Param1.fUse == DISUSE_REG_GEN32 2336 && Dis.Param1.Base.idxGenReg == idxMmioReg 2337 && Dis.Param2.fUse == DISUSE_IMMEDIATE8 2338 && Dis.Param2.uValue == 4 2339 2339 && cbOpMmio + cbOp < sizeof(pVM->hm.s.aPatches[idx].aOpcode)) 2340 2340 { … … 2352 2352 abInstr[1] = 0x0f; 2353 2353 abInstr[2] = 0x20; 2354 abInstr[3] = 0xc0 | pDis->Param1.Base.idxGenReg;2354 abInstr[3] = 0xc0 | Dis.Param1.Base.idxGenReg; 2355 2355 for (unsigned i = 4; i < pPatch->cbOp; i++) 2356 2356 abInstr[i] = 0x90; /* nop */ … … 2448 2448 * Disassemble the instruction and get cracking. 2449 2449 */ 2450 PDISCPUSTATE pDis = &pVCpu->hm.s.DisState;2450 DISCPUSTATE Dis; 2451 2451 uint32_t cbOp; 2452 int rc = EMInterpretDisasCurrent(pVM, pVCpu, pDis, &cbOp);2452 int rc = EMInterpretDisasCurrent(pVM, pVCpu, &Dis, &cbOp); 2453 2453 AssertRC(rc); 2454 2454 if ( rc == VINF_SUCCESS 2455 && pDis->pCurInstr->uOpcode == OP_MOV2455 && Dis.pCurInstr->uOpcode == OP_MOV 2456 2456 && cbOp >= 5) 2457 2457 { … … 2465 2465 pPatch->enmType = HMTPRINSTR_JUMP_REPLACEMENT; 2466 2466 2467 if ( pDis->Param1.fUse == DISUSE_DISPLACEMENT32)2467 if (Dis.Param1.fUse == DISUSE_DISPLACEMENT32) 2468 2468 { 2469 2469 /* … … 2484 2484 * jmp return_address [E9 return_address] 2485 2485 */ 2486 bool fUsesEax = ( pDis->Param2.fUse == DISUSE_REG_GEN32 && pDis->Param2.Base.idxGenReg == DISGREG_EAX);2486 bool fUsesEax = (Dis.Param2.fUse == DISUSE_REG_GEN32 && Dis.Param2.Base.idxGenReg == DISGREG_EAX); 2487 2487 2488 2488 aPatch[off++] = 0x51; /* push ecx */ … … 2492 2492 aPatch[off++] = 0x31; /* xor edx, edx */ 2493 2493 aPatch[off++] = 0xd2; 2494 if ( pDis->Param2.fUse == DISUSE_REG_GEN32)2494 if (Dis.Param2.fUse == DISUSE_REG_GEN32) 2495 2495 { 2496 2496 if (!fUsesEax) 2497 2497 { 2498 2498 aPatch[off++] = 0x89; /* mov eax, src_reg */ 2499 aPatch[off++] = MAKE_MODRM(3, pDis->Param2.Base.idxGenReg, DISGREG_EAX);2499 aPatch[off++] = MAKE_MODRM(3, Dis.Param2.Base.idxGenReg, DISGREG_EAX); 2500 2500 } 2501 2501 } 2502 2502 else 2503 2503 { 2504 Assert( pDis->Param2.fUse == DISUSE_IMMEDIATE32);2504 Assert(Dis.Param2.fUse == DISUSE_IMMEDIATE32); 2505 2505 aPatch[off++] = 0xb8; /* mov eax, immediate */ 2506 *(uint32_t *)&aPatch[off] = pDis->Param2.uValue;2506 *(uint32_t *)&aPatch[off] = Dis.Param2.uValue; 2507 2507 off += sizeof(uint32_t); 2508 2508 } … … 2534 2534 * jmp return_address [E9 return_address] 2535 2535 */ 2536 Assert( pDis->Param1.fUse == DISUSE_REG_GEN32);2537 2538 if ( pDis->Param1.Base.idxGenReg != DISGREG_ECX)2536 Assert(Dis.Param1.fUse == DISUSE_REG_GEN32); 2537 2538 if (Dis.Param1.Base.idxGenReg != DISGREG_ECX) 2539 2539 aPatch[off++] = 0x51; /* push ecx */ 2540 if ( pDis->Param1.Base.idxGenReg != DISGREG_EDX )2540 if (Dis.Param1.Base.idxGenReg != DISGREG_EDX ) 2541 2541 aPatch[off++] = 0x52; /* push edx */ 2542 if ( pDis->Param1.Base.idxGenReg != DISGREG_EAX)2542 if (Dis.Param1.Base.idxGenReg != DISGREG_EAX) 2543 2543 aPatch[off++] = 0x50; /* push eax */ 2544 2544 … … 2553 2553 aPatch[off++] = 0x32; 2554 2554 2555 if ( pDis->Param1.Base.idxGenReg != DISGREG_EAX)2555 if (Dis.Param1.Base.idxGenReg != DISGREG_EAX) 2556 2556 { 2557 2557 aPatch[off++] = 0x89; /* mov dst_reg, eax */ 2558 aPatch[off++] = MAKE_MODRM(3, DISGREG_EAX, pDis->Param1.Base.idxGenReg);2558 aPatch[off++] = MAKE_MODRM(3, DISGREG_EAX, Dis.Param1.Base.idxGenReg); 2559 2559 } 2560 2560 2561 if ( pDis->Param1.Base.idxGenReg != DISGREG_EAX)2561 if (Dis.Param1.Base.idxGenReg != DISGREG_EAX) 2562 2562 aPatch[off++] = 0x58; /* pop eax */ 2563 if ( pDis->Param1.Base.idxGenReg != DISGREG_EDX )2563 if (Dis.Param1.Base.idxGenReg != DISGREG_EDX ) 2564 2564 aPatch[off++] = 0x5a; /* pop edx */ 2565 if ( pDis->Param1.Base.idxGenReg != DISGREG_ECX)2565 if (Dis.Param1.Base.idxGenReg != DISGREG_ECX) 2566 2566 aPatch[off++] = 0x59; /* pop ecx */ 2567 2567 } -
trunk/src/VBox/VMM/include/HMInternal.h
r87491 r87493 1099 1099 * VMCPU_FF_HM_UPDATE_PAE_PDPES is set). */ 1100 1100 X86PDPE aPdpes[4]; 1101 1102 /** For saving stack space, the disassembler state is allocated here instead of1103 * on the stack. */1104 DISCPUSTATE DisState;1105 1101 1106 1102 /* These two comes because they are accessed from assembly and we don't … … 1355 1351 /** Ring 0 handlers for VT-x. */ 1356 1352 PFNHMSVMVMRUN pfnVMRun; 1353 1354 /** For saving stack space, the disassembler state is allocated here 1355 * instead of on the stack. */ 1356 DISCPUSTATE DisState; 1357 1357 } svm; 1358 1358 } HM_UNION_NM(u); -
trunk/src/VBox/VMM/include/HMInternal.mac
r87491 r87493 193 193 .aPdpes resq 4 194 194 195 .DisState resb 0d8h196 197 195 .StatVmxWriteHostRip resq 1 198 196 .StatVmxWriteHostRsp resq 1 … … 223 221 struc HMR0CPUSVM 224 222 .pfnVMRun RTR0PTR_RES 1 223 224 .DisState resb 0d8h 225 225 endstruc 226 226 -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r87469 r87493 384 384 CHECK_MEMBER_ALIGNMENT(HMCPU, Event, 8); 385 385 CHECK_MEMBER_ALIGNMENT(HMCPU, Event.u64IntInfo, 8); 386 CHECK_MEMBER_ALIGNMENT(HM CPU,DisState, 8);386 CHECK_MEMBER_ALIGNMENT(HMR0PERVCPU, svm.DisState, 8); 387 387 CHECK_MEMBER_ALIGNMENT(HMCPU, StatEntry, 8); 388 388
Note:
See TracChangeset
for help on using the changeset viewer.

