- Timestamp:
- Oct 19, 2022 9:12:57 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 154207
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp
r97220 r97231 184 184 { 185 185 return pVCpu->cpum.s.Hyper.dr[7]; 186 } 187 188 189 /** 190 * Checks that the special cookie stored in unused reserved RFLAGS bits 191 * 192 * @retval true if cookie is ok. 193 * @retval false if cookie is not ok. 194 * @param pVM The cross context VM structure. 195 * @param pVCpu The cross context virtual CPU structure. 196 */ 197 VMM_INT_DECL(bool) CPUMAssertGuestRFlagsCookie(PVM pVM, PVMCPU pVCpu) 198 { 199 AssertLogRelMsgReturn( (pVCpu->cpum.s.Guest.rflags.uBoth & ~(uint64_t)(X86_EFL_LIVE_MASK | X86_EFL_RA1_MASK)) 200 == pVM->cpum.s.fReservedRFlagsCookie 201 && (pVCpu->cpum.s.Guest.rflags.uBoth & X86_EFL_RA1_MASK) == X86_EFL_RA1_MASK, 202 ("rflags=%#RX64 vs fReservedRFlagsCookie=%#RX64\n", 203 pVCpu->cpum.s.Guest.rflags.uBoth, pVM->cpum.s.fReservedRFlagsCookie), 204 false); 205 return true; 186 206 } 187 207 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp
r97208 r97231 8024 8024 || (pVCpu->cpum.GstCtx.ax & 0xf) >= 10) 8025 8025 { 8026 iemAImpl_add_u16(&pVCpu->cpum.GstCtx.ax, 0x106, &pVCpu->cpum.GstCtx.eflags.u 32);8026 iemAImpl_add_u16(&pVCpu->cpum.GstCtx.ax, 0x106, &pVCpu->cpum.GstCtx.eflags.uBoth); 8027 8027 pVCpu->cpum.GstCtx.eflags.Bits.u1AF = 1; 8028 8028 pVCpu->cpum.GstCtx.eflags.Bits.u1CF = 1; … … 8069 8069 || (pVCpu->cpum.GstCtx.ax & 0xf) >= 10) 8070 8070 { 8071 iemAImpl_sub_u16(&pVCpu->cpum.GstCtx.ax, 0x106, &pVCpu->cpum.GstCtx.eflags.u 32);8071 iemAImpl_sub_u16(&pVCpu->cpum.GstCtx.ax, 0x106, &pVCpu->cpum.GstCtx.eflags.uBoth); 8072 8072 pVCpu->cpum.GstCtx.eflags.Bits.u1AF = 1; 8073 8073 pVCpu->cpum.GstCtx.eflags.Bits.u1CF = 1; -
trunk/src/VBox/VMM/VMMAll/VMXAllTemplate.cpp.h
r97223 r97231 1805 1805 Use 32-bit VMWRITE. */ 1806 1806 uint32_t fEFlags = pVCpu->cpum.GstCtx.eflags.u; 1807 Assert( fEFlags &X86_EFL_RA1_MASK);1808 Assert (!(fEFlags & ~(X86_EFL_1 | X86_EFL_LIVE_MASK)));1807 Assert((fEFlags & X86_EFL_RA1_MASK) == X86_EFL_RA1_MASK); 1808 AssertMsg(!(fEFlags & ~(X86_EFL_LIVE_MASK | X86_EFL_RA1_MASK)), ("%#x\n", fEFlags)); 1809 1809 1810 1810 #ifndef IN_NEM_DARWIN -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r97219 r97231 145 145 #include <iprt/mem.h> 146 146 #include <iprt/mp.h> 147 #include <iprt/rand.h> 147 148 #include <iprt/string.h> 148 149 … … 2205 2206 2206 2207 /* 2208 * Generate the RFLAGS cookie. 2209 */ 2210 pVM->cpum.s.fReservedRFlagsCookie = RTRandU64() & ~(CPUMX86EFLAGS_HW_MASK_64 | CPUMX86EFLAGS_INT_MASK_64); 2211 2212 /* 2207 2213 * Init the VMX/SVM state. 2208 2214 * … … 2220 2226 Assert(pVM->apCpusR3[0]->cpum.s.Guest.hwvirt.enmHwvirt == CPUMHWVIRT_NONE); 2221 2227 2228 /* 2229 * Initialize the general guest CPU state. 2230 */ 2222 2231 CPUMR3Reset(pVM); 2232 2223 2233 return VINF_SUCCESS; 2224 2234 } … … 2303 2313 pCtx->eip = 0x0000fff0; 2304 2314 pCtx->edx = 0x00000600; /* P6 processor */ 2305 pCtx->eflags.Bits.u1Reserved0 = 1; 2315 2316 Assert((pVM->cpum.s.fReservedRFlagsCookie & (X86_EFL_LIVE_MASK | X86_EFL_RAZ_LO_MASK | X86_EFL_RA1_MASK)) == 0); 2317 pCtx->rflags.uBoth = pVM->cpum.s.fReservedRFlagsCookie | X86_EFL_RA1_MASK; 2306 2318 2307 2319 pCtx->cs.Sel = 0xf000; … … 2495 2507 for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++) 2496 2508 { 2497 PVMCPU pVCpu = pVM->apCpusR3[idCpu]; 2498 2509 PVMCPU const pVCpu = pVM->apCpusR3[idCpu]; 2510 PCPUMCTX const pGstCtx = &pVCpu->cpum.s.Guest; 2511 2512 /** @todo ditch this the next time we change the saved state. */ 2499 2513 SSMR3PutStructEx(pSSM, &DummyHyperCtx, sizeof(DummyHyperCtx), 0, g_aCpumCtxFields, NULL); 2500 2514 2501 PCPUMCTX pGstCtx = &pVCpu->cpum.s.Guest; 2515 uint64_t const fSavedRFlags = pGstCtx->rflags.uBoth; 2516 pGstCtx->rflags.uBoth &= CPUMX86EFLAGS_HW_MASK_64; /* Temporarily clear the non-hardware bits in RFLAGS while saving. */ 2502 2517 SSMR3PutStructEx(pSSM, pGstCtx, sizeof(*pGstCtx), 0, g_aCpumCtxFields, NULL); 2518 pGstCtx->rflags.uBoth = fSavedRFlags; 2519 2503 2520 SSMR3PutStructEx(pSSM, &pGstCtx->XState.x87, sizeof(pGstCtx->XState.x87), 0, g_aCpumX87Fields, NULL); 2504 2521 if (pGstCtx->fXStateMask != 0) … … 2922 2939 AssertRCReturn(rc, rc); 2923 2940 2941 /* Deal with the reusing of reserved RFLAGS bits. */ 2942 pGstCtx->rflags.uBoth |= pVM->cpum.s.fReservedRFlagsCookie; 2943 2924 2944 /* REM and other may have cleared must-be-one fields in DR6 and 2925 2945 DR7, fix these. */ -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r97178 r97231 2210 2210 fFFDone = false; 2211 2211 2212 #ifdef VBOX_STRICT 2213 CPUMAssertGuestRFlagsCookie(pVM, pVCpu); 2214 #endif 2215 2212 2216 /* 2213 2217 * Now what to do? -
trunk/src/VBox/VMM/include/CPUMInternal.h
r97213 r97231 382 382 uint8_t abPadding1[1]; 383 383 384 /** Random value we store in the reserved RFLAGS bits we don't use ourselves so 385 * we can detect corruption. */ 386 uint64_t fReservedRFlagsCookie; 387 384 388 /** Align to 64-byte boundary. */ 385 uint8_t abPadding2[ 20+4];389 uint8_t abPadding2[16]; 386 390 387 391 /** Host CPU feature information. -
trunk/src/VBox/VMM/include/IEMMc.h
r97153 r97231 334 334 #define IEM_MC_REF_GREG_I64(a_pi64Dst, a_iGReg) (a_pi64Dst) = (int64_t *)iemGRegRefU64(pVCpu, (a_iGReg)) 335 335 #define IEM_MC_REF_GREG_I64_CONST(a_pi64Dst, a_iGReg) (a_pi64Dst) = (int64_t const *)iemGRegRefU64(pVCpu, (a_iGReg)) 336 /** @note Not for IOPL or IF testing or modification. */ 337 #define IEM_MC_REF_EFLAGS(a_pEFlags) (a_pEFlags) = &pVCpu->cpum.GstCtx.eflags.u 336 /** @note Not for IOPL or IF testing or modification. 337 * @note Must preserve any undefined bits, see CPUMX86EFLAGS! */ 338 #define IEM_MC_REF_EFLAGS(a_pEFlags) (a_pEFlags) = &pVCpu->cpum.GstCtx.eflags.uBoth 338 339 #define IEM_MC_REF_MXCSR(a_pfMxcsr) (a_pfMxcsr) = &pVCpu->cpum.GstCtx.XState.x87.MXCSR 339 340
Note:
See TracChangeset
for help on using the changeset viewer.