Changeset 20291 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 4, 2009 3:00:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r20234 r20291 1683 1683 1684 1684 Assert(pVM->hwaccm.s.fNestedPaging); 1685 Log (("Nested page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode));1685 LogFlow(("Nested page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, uFaultAddress, errCode)); 1686 1686 /* Exit qualification contains the linear address of the page fault. */ 1687 1687 TRPMAssertTrap(pVCpu, X86_XCPT_PF, TRPM_TRAP); 1688 1688 TRPMSetErrorCode(pVCpu, errCode); 1689 1689 TRPMSetFaultAddress(pVCpu, uFaultAddress); 1690 1691 #if 0 1692 /* Shortcut for APIC TPR reads and writes; 32 bits guests only */ 1693 if ( (uFaultAddress & 0xfff) == 0x080 1694 && pVM->hwaccm.s.fHasIoApic 1695 && !(errCode & X86_TRAP_PF_P) /* not present */ 1696 && !CPUMIsGuestInLongModeEx(pCtx)) 1697 { 1698 RTGCPHYS GCPhysApicBase; 1699 PDMApicGetBase(pVM, &GCPhysApicBase); /* @todo cache this */ 1700 GCPhysApicBase &= PAGE_BASE_GC_MASK; 1701 1702 if (uFaultAddress == GCPhysApicBase + 0x80) 1703 { 1704 Log(("Replace TPR access at %RGv\n", pCtx->rip)); 1705 #if 0 1706 DISCPUSTATE Cpu; 1707 unsigned cbOp; 1708 rc = EMInterpretDisasOne(pVM, pVCpu, CPUMCTX2CORE(pCtx), &Cpu, &cbOp); 1709 AssertRC(rc); 1710 if ( rc == VINF_SUCCESS 1711 && Cpu.pCurInstr->opcode == OP_MOV 1712 && (cbOp == 5 || cbOp == 6)) 1713 { 1714 uint8_t szInstr[15]; 1715 if ( (errCode & X86_TRAP_PF_RW) 1716 && Cpu.param1.disp32 == (uint32_t)uFaultAddress 1717 && Cpu.param2.flags == USE_REG_GEN32) 1718 { 1719 /* 0xF0, 0x0F, 0x22, 0xC0 = mov cr8, eax */ 1720 szInstr[0] = 0xF0; 1721 szInstr[1] = 0x0F; 1722 szInstr[2] = 0x22; 1723 szInstr[3] = 0xC0 | Cpu.param2.base.reg_gen; 1724 for (unsigned i = 4; i < cbOp; i++) 1725 szInstr[i] = 0x90; /* nop */ 1726 1727 rc = PGMPhysSimpleWriteGCPtr(pVCpu, pCtx->rip, szInstr, cbOp); 1728 AssertRC(rc); 1729 1730 pVM->hwaccm.s.svm.fTPRPatching = true; 1731 Log(("Acceptable write candidate!\n")); 1732 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x); 1733 goto ResumeExecution; 1734 } 1735 else 1736 if ( Cpu.param2.disp32 == (uint32_t)uFaultAddress 1737 && Cpu.param1.flags == USE_REG_GEN32) 1738 { 1739 /* 0xF0, 0x0F, 0x20, 0xC0 = mov eax, cr8 */ 1740 szInstr[0] = 0xF0; 1741 szInstr[1] = 0x0F; 1742 szInstr[2] = 0x20; 1743 szInstr[3] = 0xC0 | Cpu.param1.base.reg_gen; 1744 for (unsigned i = 4; i < cbOp; i++) 1745 szInstr[i] = 0x90; /* nop */ 1746 1747 rc = PGMPhysSimpleWriteGCPtr(pVCpu, pCtx->rip, szInstr, cbOp); 1748 AssertRC(rc); 1749 1750 pVM->hwaccm.s.svm.fTPRPatching = true; 1751 Log(("Acceptable read candidate!\n")); 1752 STAM_PROFILE_ADV_STOP(&pVCpu->hwaccm.s.StatExit1, x); 1753 goto ResumeExecution; 1754 } 1755 } 1756 #endif 1757 } 1758 } 1759 #endif 1690 1760 1691 1761 /* Handle the pagefault trap for the nested shadow table. */
Note:
See TracChangeset
for help on using the changeset viewer.