Changeset 97694 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Nov 28, 2022 10:08:14 PM (2 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r97662 r97694 175 175 176 176 /** 177 * Slow path of iemInitDecoder() and iemInitExec() that checks what kind of 178 * breakpoints are enabled. 179 * 180 * @param pVCpu The cross context virtual CPU structure of the 181 * calling thread. 182 */ 183 void iemInitPendingBreakpointsSlow(PVMCPUCC pVCpu) 184 { 185 /* 186 * Process guest breakpoints. 187 */ 188 #define PROCESS_ONE_BP(a_fDr7, a_iBp) do { \ 189 if (a_fDr7 & X86_DR7_L_G(a_iBp)) \ 190 { \ 191 switch (X86_DR7_GET_RW(a_fDr7, a_iBp)) \ 192 { \ 193 case X86_DR7_RW_EO: \ 194 pVCpu->iem.s.fPendingInstructionBreakpoints = true; \ 195 break; \ 196 case X86_DR7_RW_WO: \ 197 case X86_DR7_RW_RW: \ 198 pVCpu->iem.s.fPendingDataBreakpoints = true; \ 199 break; \ 200 case X86_DR7_RW_IO: \ 201 pVCpu->iem.s.fPendingIoBreakpoints = true; \ 202 break; \ 203 } \ 204 } \ 205 } while (0) 206 uint32_t const fGstDr7 = (uint32_t)pVCpu->cpum.GstCtx.dr[7]; 207 if (fGstDr7 & X86_DR7_ENABLED_MASK) 208 { 209 PROCESS_ONE_BP(fGstDr7, 0); 210 PROCESS_ONE_BP(fGstDr7, 1); 211 PROCESS_ONE_BP(fGstDr7, 2); 212 PROCESS_ONE_BP(fGstDr7, 3); 213 } 214 215 /* 216 * Process hypervisor breakpoints. 217 */ 218 uint32_t const fHyperDr7 = DBGFBpGetDR7(pVCpu->CTX_SUFF(pVM)); 219 if (fHyperDr7 & X86_DR7_ENABLED_MASK) 220 { 221 PROCESS_ONE_BP(fHyperDr7, 0); 222 PROCESS_ONE_BP(fHyperDr7, 1); 223 PROCESS_ONE_BP(fHyperDr7, 2); 224 PROCESS_ONE_BP(fHyperDr7, 3); 225 } 226 } 227 228 229 /** 177 230 * Initializes the decoder state. 178 231 * … … 240 293 pVCpu->iem.s.fBypassHandlers = fBypassHandlers; 241 294 pVCpu->iem.s.fDisregardLock = fDisregardLock; 295 pVCpu->iem.s.fPendingInstructionBreakpoints = false; 296 pVCpu->iem.s.fPendingDataBreakpoints = false; 297 pVCpu->iem.s.fPendingIoBreakpoints = false; 298 if (RT_LIKELY( !(pVCpu->cpum.GstCtx.dr[7] & X86_DR7_ENABLED_MASK) 299 && pVCpu->CTX_SUFF(pVM)->dbgf.ro.cEnabledHwBreakpoints == 0)) 300 { /* likely */ } 301 else 302 iemInitPendingBreakpointsSlow(pVCpu); 242 303 243 304 #ifdef DBGFTRACE_ENABLED … … 304 365 if (pVCpu->iem.s.pbInstrBuf) 305 366 { 306 uint64_t off = (pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT ? pVCpu->cpum.GstCtx.rip : pVCpu->cpum.GstCtx.eip + (uint32_t)pVCpu->cpum.GstCtx.cs.u64Base) 367 uint64_t off = (pVCpu->iem.s.enmCpuMode == IEMMODE_64BIT 368 ? pVCpu->cpum.GstCtx.rip 369 : pVCpu->cpum.GstCtx.eip + (uint32_t)pVCpu->cpum.GstCtx.cs.u64Base) 307 370 - pVCpu->iem.s.uInstrBufPc; 308 371 if (off < pVCpu->iem.s.cbInstrBufTotal) … … 421 484 { 422 485 Log(("iemInitDecoderAndPrefetchOpcodes: %RGv - rc=%Rrc\n", GCPtrPC, rc)); 423 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT486 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 424 487 if (Walk.fFailed & PGM_WALKFAIL_EPT) 425 488 IEM_VMX_VMEXIT_EPT_RET(pVCpu, &Walk, IEM_ACCESS_INSTRUCTION, IEM_SLAT_FAIL_LINEAR_TO_PHYS_ADDR, 0 /* cbInstr */); 426 # endif489 # endif 427 490 return iemRaisePageFault(pVCpu, GCPtrPC, 1, IEM_ACCESS_INSTRUCTION, rc); 428 491 } … … 431 494 { 432 495 Log(("iemInitDecoderAndPrefetchOpcodes: %RGv - supervisor page\n", GCPtrPC)); 433 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT496 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 434 497 if (Walk.fFailed & PGM_WALKFAIL_EPT) 435 498 IEM_VMX_VMEXIT_EPT_RET(pVCpu, &Walk, IEM_ACCESS_INSTRUCTION, IEM_SLAT_FAIL_LINEAR_TO_PAGE_TABLE, 0 /* cbInstr */); 436 # endif499 # endif 437 500 return iemRaisePageFault(pVCpu, GCPtrPC, 1, IEM_ACCESS_INSTRUCTION, VERR_ACCESS_DENIED); 438 501 } … … 441 504 { 442 505 Log(("iemInitDecoderAndPrefetchOpcodes: %RGv - NX\n", GCPtrPC)); 443 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT506 # ifdef VBOX_WITH_NESTED_HWVIRT_VMX_EPT 444 507 if (Walk.fFailed & PGM_WALKFAIL_EPT) 445 508 IEM_VMX_VMEXIT_EPT_RET(pVCpu, &Walk, IEM_ACCESS_INSTRUCTION, IEM_SLAT_FAIL_LINEAR_TO_PAGE_TABLE, 0 /* cbInstr */); 446 # endif509 # endif 447 510 return iemRaisePageFault(pVCpu, GCPtrPC, 1, IEM_ACCESS_INSTRUCTION, VERR_ACCESS_DENIED); 448 511 } … … 719 782 void iemOpcodeFetchBytesJmp(PVMCPUCC pVCpu, size_t cbDst, void *pvDst) IEM_NOEXCEPT_MAY_LONGJMP 720 783 { 721 # ifdef IN_RING3784 # ifdef IN_RING3 722 785 for (;;) 723 786 { … … 768 831 if (RT_LIKELY((uint32_t)GCPtrFirst <= pVCpu->cpum.GstCtx.cs.u32Limit)) 769 832 { /* likely */ } 770 else /** @todo For CPUs older than the 386, we should not generate \#GP here but wrap around! */833 else /** @todo For CPUs older than the 386, we should not necessarily generate \#GP here but wrap around! */ 771 834 iemRaiseSelectorBoundsJmp(pVCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 772 835 cbMaxRead = pVCpu->cpum.GstCtx.cs.u32Limit - (uint32_t)GCPtrFirst + 1; … … 9795 9858 IEM_TRY_SETJMP(pVCpu, rcStrict) 9796 9859 { 9797 uint8_t b; IEM_OPCODE_GET_ NEXT_U8(&b);9860 uint8_t b; IEM_OPCODE_GET_FIRST_U8(&b); 9798 9861 rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); 9799 9862 } … … 9804 9867 IEM_CATCH_LONGJMP_END(pVCpu); 9805 9868 #else 9806 uint8_t b; IEM_OPCODE_GET_ NEXT_U8(&b);9869 uint8_t b; IEM_OPCODE_GET_FIRST_U8(&b); 9807 9870 VBOXSTRICTRC rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); 9808 9871 #endif … … 9855 9918 IEM_TRY_SETJMP_AGAIN(pVCpu, rcStrict) 9856 9919 { 9857 uint8_t b; IEM_OPCODE_GET_ NEXT_U8(&b);9920 uint8_t b; IEM_OPCODE_GET_FIRST_U8(&b); 9858 9921 rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); 9859 9922 } … … 9864 9927 IEM_CATCH_LONGJMP_END(pVCpu); 9865 9928 #else 9866 IEM_OPCODE_GET_ NEXT_U8(&b);9929 IEM_OPCODE_GET_FIRST_U8(&b); 9867 9930 rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); 9868 9931 #endif … … 10145 10208 * Do the decoding and emulation. 10146 10209 */ 10147 uint8_t b; IEM_OPCODE_GET_ NEXT_U8(&b);10210 uint8_t b; IEM_OPCODE_GET_FIRST_U8(&b); 10148 10211 rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); 10149 10212 #ifdef VBOX_STRICT … … 10313 10376 uint32_t const cPotentialExits = pVCpu->iem.s.cPotentialExits; 10314 10377 10315 uint8_t b; IEM_OPCODE_GET_ NEXT_U8(&b);10378 uint8_t b; IEM_OPCODE_GET_FIRST_U8(&b); 10316 10379 rcStrict = FNIEMOP_CALL(g_apfnOneByteMap[b]); 10317 10380 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp
r97642 r97694 6627 6627 AssertRCSuccessReturn(rc, RT_SUCCESS_NP(rc) ? VERR_IEM_IPE_1 : rc); 6628 6628 6629 /* 6630 * Re-init hardware breakpoint summary if it was DR7 that got changed. 6631 */ 6632 if (iDrReg == 7) 6633 { 6634 pVCpu->iem.s.fPendingInstructionBreakpoints = false; 6635 pVCpu->iem.s.fPendingDataBreakpoints = false; 6636 pVCpu->iem.s.fPendingIoBreakpoints = false; 6637 iemInitPendingBreakpointsSlow(pVCpu); 6638 } 6639 6629 6640 return iemRegAddToRipAndFinishingClearingRF(pVCpu, cbInstr); 6630 6641 } -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp
r97370 r97694 33 33 #define VMCPU_INCL_CPUM_GST_CTX 34 34 #include <VBox/vmm/iem.h> 35 #include <VBox/vmm/apic.h> 35 36 #include <VBox/vmm/cpum.h> 36 #include <VBox/vmm/apic.h> 37 #include <VBox/vmm/pgm.h> 37 #include <VBox/vmm/dbgf.h> 38 38 #include <VBox/vmm/em.h> 39 39 #include <VBox/vmm/hm.h> 40 #include <VBox/vmm/pgm.h> 40 41 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM 41 42 # include <VBox/vmm/hm_svm.h> … … 55 56 #include "IEMInline.h" 56 57 58 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM /* Almost the whole file. */ 59 57 60 58 61 /********************************************************************************************************************************* 59 62 * Defined Constants And Macros * 60 63 *********************************************************************************************************************************/ 61 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM62 64 /** 63 65 * Check the common SVM instruction preconditions. -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp
r97583 r97694 33 33 #define VMCPU_INCL_CPUM_GST_CTX 34 34 #include <VBox/vmm/iem.h> 35 #include <VBox/vmm/apic.h> 35 36 #include <VBox/vmm/cpum.h> 36 #include <VBox/vmm/apic.h> 37 #include <VBox/vmm/dbgf.h> 38 #include <VBox/vmm/em.h> 39 #include <VBox/vmm/gim.h> 40 #include <VBox/vmm/hm.h> 37 41 #include <VBox/vmm/pgm.h> 38 #include <VBox/vmm/em.h>39 #include <VBox/vmm/hm.h>40 #include <VBox/vmm/gim.h>41 42 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX 42 43 # include <VBox/vmm/hmvmxinline.h>
Note:
See TracChangeset
for help on using the changeset viewer.