- Timestamp:
- Aug 11, 2012 8:15:47 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM/VMMRC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMRC/CPUMRC.cpp
r41965 r42771 23 23 #include <VBox/vmm/cpum.h> 24 24 #include <VBox/vmm/vmm.h> 25 #include <VBox/vmm/patm.h> 25 26 #include <VBox/vmm/trpm.h> 26 27 #include "CPUMInternal.h" … … 76 77 } 77 78 79 80 /** 81 * Called by TRPM and CPUM assembly code to make sure the guest state is 82 * ready for execution. 83 * 84 * @param pVM The VM handle. 85 */ 86 DECLASM(void) CPUMRCAssertPreExecutionSanity(PVM pVM) 87 { 88 /* 89 * Check some important assumptions before resuming guest execution. 90 */ 91 PVMCPU pVCpu = VMMGetCpu0(pVM); 92 PCCPUMCTX pCtx = &pVCpu->cpum.s.Guest; 93 uint8_t const uRawCpl = CPUMGetGuestCPL(pVCpu); 94 uint32_t const u32EFlags = CPUMRawGetEFlags(pVCpu); 95 bool const fPatch = PATMIsPatchGCAddr(pVM, pCtx->eip); 96 AssertMsg(pCtx->eflags.Bits.u1IF, ("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 97 AssertMsg(pCtx->eflags.Bits.u2IOPL < RT_MAX(uRawCpl, 1U), 98 ("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 99 if (!(u32EFlags & X86_EFL_VM)) 100 { 101 AssertMsg((u32EFlags & X86_EFL_IF) || fPatch,("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 102 AssertMsg((pCtx->cs.Sel & X86_SEL_RPL) > 0, ("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 103 AssertMsg((pCtx->ss.Sel & X86_SEL_RPL) > 0, ("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 104 } 105 AssertMsg(CPUMIsGuestInRawMode(pVCpu), ("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 106 Log2(("cs:eip=%04x:%08x ss:esp=%04x:%08x cpl=%u raw/efl=%#x/%#x%s\n", pCtx->cs.Sel, pCtx->eip, pCtx->ss.Sel, pCtx->esp, uRawCpl, u32EFlags, pCtx->eflags.u, fPatch ? " patch" : "")); 107 } -
trunk/src/VBox/VMM/VMMRC/CPUMRCA.asm
r41943 r42771 33 33 extern IMPNAME(g_VM) ; VMM GC Builtin import 34 34 extern NAME(cpumRCHandleNPAndGP) ; CPUMGC.cpp 35 extern NAME(CPUMRCAssertPreExecutionSanity) 36 35 37 36 38 ; … … 163 165 align 16 164 166 BEGINPROC_EXPORTED CPUMGCResumeGuest 167 %ifdef VBOX_STRICT 168 ; Call CPUM to check sanity. 169 push edx 170 mov edx, IMP(g_VM) 171 push edx 172 call NAME(CPUMRCAssertPreExecutionSanity) 173 add esp, 4 174 pop edx 175 %endif 176 165 177 ; Convert to CPUMCPU pointer 166 178 add edx, [edx + CPUM.offCPUMCPU0] … … 241 253 align 16 242 254 BEGINPROC_EXPORTED CPUMGCResumeGuestV86 255 %ifdef VBOX_STRICT 256 ; Call CPUM to check sanity. 257 push edx 258 mov edx, IMP(g_VM) 259 push edx 260 call NAME(CPUMRCAssertPreExecutionSanity) 261 add esp, 4 262 pop edx 263 %endif 264 243 265 ; Convert to CPUMCPU pointer 244 266 add edx, [edx + CPUM.offCPUMCPU0] -
trunk/src/VBox/VMM/VMMRC/TRPMRCHandlersA.asm
r41985 r42771 54 54 extern NAME(TRPMGCTrap0eHandler) 55 55 extern NAME(TRPMGCHyperTrap0eHandler) 56 extern NAME(CPUMRCAssertPreExecutionSanity) 56 57 57 58 … … 474 475 %endif 475 476 477 %ifdef VBOX_STRICT 478 ; Call CPUM to check sanity. 479 mov edx, IMP(g_VM) 480 push edx 481 call NAME(CPUMRCAssertPreExecutionSanity) 482 add esp, 4 483 %endif 484 476 485 ; enable WP 477 486 mov eax, cr0 ;; @todo try elimiate this read. … … 924 933 mov [esi + TRPMCPU.uPrevVector], edx 925 934 935 %ifdef VBOX_STRICT 936 ; Call CPUM to check sanity. 937 mov edx, IMP(g_VM) 938 push edx 939 call NAME(CPUMRCAssertPreExecutionSanity) 940 add esp, 4 941 %endif 942 926 943 ; enable WP 927 944 mov eax, cr0 ;; @todo try elimiate this read.
Note:
See TracChangeset
for help on using the changeset viewer.