- Timestamp:
- Jul 23, 2018 2:06:55 PM (7 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/PGMAll.cpp
r73280 r73324 519 519 # undef PGM_SHW_NAME 520 520 521 522 /* 523 * Shadow - NEM / None. 524 */ 525 # define PGM_SHW_TYPE PGM_TYPE_NONE 526 # define PGM_SHW_NAME(name) PGM_SHW_NAME_NONE(name) 527 # include "PGMAllShw.h" 528 529 /* Guest - real mode */ 530 # define PGM_GST_TYPE PGM_TYPE_REAL 531 # define PGM_GST_NAME(name) PGM_GST_NAME_REAL(name) 532 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_REAL(name) 533 # include "PGMGstDefs.h" 534 # include "PGMAllBth.h" 535 # undef PGM_BTH_NAME 536 # undef PGM_GST_TYPE 537 # undef PGM_GST_NAME 538 539 /* Guest - protected mode */ 540 # define PGM_GST_TYPE PGM_TYPE_PROT 541 # define PGM_GST_NAME(name) PGM_GST_NAME_PROT(name) 542 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_PROT(name) 543 # include "PGMGstDefs.h" 544 # include "PGMAllBth.h" 545 # undef PGM_BTH_NAME 546 # undef PGM_GST_TYPE 547 # undef PGM_GST_NAME 548 549 /* Guest - 32-bit mode */ 550 # define PGM_GST_TYPE PGM_TYPE_32BIT 551 # define PGM_GST_NAME(name) PGM_GST_NAME_32BIT(name) 552 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_32BIT(name) 553 # include "PGMGstDefs.h" 554 # include "PGMAllBth.h" 555 # undef PGM_BTH_NAME 556 # undef PGM_GST_TYPE 557 # undef PGM_GST_NAME 558 559 /* Guest - PAE mode */ 560 # define PGM_GST_TYPE PGM_TYPE_PAE 561 # define PGM_GST_NAME(name) PGM_GST_NAME_PAE(name) 562 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_PAE(name) 563 # include "PGMGstDefs.h" 564 # include "PGMAllBth.h" 565 # undef PGM_BTH_NAME 566 # undef PGM_GST_TYPE 567 # undef PGM_GST_NAME 568 569 # ifdef VBOX_WITH_64_BITS_GUESTS 570 /* Guest - AMD64 mode */ 571 # define PGM_GST_TYPE PGM_TYPE_AMD64 572 # define PGM_GST_NAME(name) PGM_GST_NAME_AMD64(name) 573 # define PGM_BTH_NAME(name) PGM_BTH_NAME_NONE_AMD64(name) 574 # include "PGMGstDefs.h" 575 # include "PGMAllBth.h" 576 # undef PGM_BTH_NAME 577 # undef PGM_GST_TYPE 578 # undef PGM_GST_NAME 579 # endif /* VBOX_WITH_64_BITS_GUESTS */ 580 581 # undef PGM_SHW_TYPE 582 # undef PGM_SHW_NAME 583 521 584 #endif /* !IN_RC */ 522 585 … … 667 730 # endif 668 731 }, 732 { 733 PGM_TYPE_NONE, 734 PGM_SHW_NAME_NONE(GetPage), 735 PGM_SHW_NAME_NONE(ModifyPage), 736 PGM_SHW_NAME_NONE(Enter), 737 PGM_SHW_NAME_NONE(Exit), 738 # ifdef IN_RING3 739 PGM_SHW_NAME_NONE(Relocate), 740 # endif 741 }, 669 742 #endif /* IN_RC */ 670 743 }; … … 711 784 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_32BIT, PGM_TYPE_NESTED_AMD64 - illegal */ 712 785 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_32BIT, PGM_TYPE_EPT - illegal */ 786 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_32BIT, PGM_TYPE_NONE - illegal */ 713 787 714 788 /* PAE shadow paging mode: */ … … 723 797 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_PAE, PGM_TYPE_NESTED_AMD64 - illegal */ 724 798 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_PAE, PGM_TYPE_EPT - illegal */ 799 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_PAE, PGM_TYPE_NONE - illegal */ 725 800 726 801 #ifndef IN_RC … … 740 815 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_NESTED_AMD64 - illegal */ 741 816 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_EPT - illegal */ 817 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_AMD64, PGM_TYPE_NONE - illegal */ 742 818 743 819 /* 32-bit nested paging mode: */ … … 756 832 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_NESTED_AMD64 - illegal */ 757 833 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_EPT - illegal */ 834 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_32BIT, PGM_TYPE_NONE - illegal */ 758 835 759 836 /* PAE nested paging mode: */ … … 772 849 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_NESTED_AMD64 - illegal */ 773 850 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_EPT - illegal */ 851 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_PAE, PGM_TYPE_NONE - illegal */ 774 852 775 853 /* AMD64 nested paging mode: */ … … 788 866 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_NESTED_AMD64 - illegal */ 789 867 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_EPT - illegal */ 868 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NESTED_AMD64, PGM_TYPE_NONE - illegal */ 790 869 791 870 /* EPT nested paging mode: */ … … 804 883 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_NESTED_AMD64 - illegal */ 805 884 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_EPT - illegal */ 885 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_EPT, PGM_TYPE_NONE - illegal */ 886 887 /* NONE / NEM: */ 888 PGMMODEDATABTH_NULL_ENTRY(), /* 0 */ 889 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_REAL, PGM_BTH_NAME_EPT_REAL), 890 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_PROT, PGM_BTH_NAME_EPT_PROT), 891 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_32BIT, PGM_BTH_NAME_EPT_32BIT), 892 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_PAE, PGM_BTH_NAME_EPT_PAE), 893 # ifdef VBOX_WITH_64_BITS_GUESTS 894 PGMMODEDATABTH_ENTRY(PGM_TYPE_NONE, PGM_TYPE_AMD64, PGM_BTH_NAME_EPT_AMD64), 895 # else 896 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_AMD64 - illegal */ 897 # endif 898 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_32BIT - illegal */ 899 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_PAE - illegal */ 900 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NESTED_AMD64 - illegal */ 901 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_EPT - illegal */ 902 PGMMODEDATABTH_NULL_ENTRY(), /* PGM_TYPE_NONE, PGM_TYPE_NONE - illegal */ 806 903 807 904 #endif /* IN_RC */ … … 2921 3018 case PGMMODE_NESTED_AMD64: return PGM_TYPE_NESTED_AMD64; 2922 3019 case PGMMODE_EPT: return PGM_TYPE_EPT; 3020 case PGMMODE_NONE: return PGM_TYPE_NONE; 2923 3021 default: 2924 3022 AssertFatalMsgFailed(("pgmMode=%d\n", pgmMode)); … … 3094 3192 { 3095 3193 pVM->pgm.s.fNestedPaging = true; 3096 enmShadowMode = PGMMODE_ EPT; /* whatever harmless... */3194 enmShadowMode = PGMMODE_NONE; 3097 3195 } 3098 3196 else … … 3440 3538 case PGMMODE_NESTED_AMD64: return "Nested-AMD64"; 3441 3539 case PGMMODE_EPT: return "EPT"; 3540 case PGMMODE_NONE: return "None"; 3442 3541 default: return "unknown mode value"; 3443 3542 } -
trunk/src/VBox/VMM/VMMAll/PGMAllBth.h
r73277 r73324 68 68 * remove redundant checks inside functions. 69 69 */ 70 #if PGM_GST_TYPE == PGM_TYPE_PAE && PGM_SHW_TYPE != PGM_TYPE_PAE && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 70 #if PGM_GST_TYPE == PGM_TYPE_PAE && PGM_SHW_TYPE != PGM_TYPE_PAE \ 71 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE 71 72 # error "Invalid combination; PAE guest implies PAE shadow" 72 73 #endif 73 74 74 #if (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \ 75 && !(PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE)) 75 #if (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \ 76 && !( PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_AMD64 \ 77 || PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NONE) 76 78 # error "Invalid combination; real or protected mode without paging implies 32 bits or PAE shadow paging." 77 79 #endif 78 80 79 81 #if (PGM_GST_TYPE == PGM_TYPE_32BIT || PGM_GST_TYPE == PGM_TYPE_PAE) \ 80 && !(PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE)) 82 && !( PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_PAE \ 83 || PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NONE) 81 84 # error "Invalid combination; 32 bits guest paging or PAE implies 32 bits or PAE shadow paging." 82 85 #endif 83 86 84 #if (PGM_GST_TYPE == PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_AMD64 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) ) \87 #if (PGM_GST_TYPE == PGM_TYPE_AMD64 && PGM_SHW_TYPE != PGM_TYPE_AMD64 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE) \ 85 88 || (PGM_SHW_TYPE == PGM_TYPE_AMD64 && PGM_GST_TYPE != PGM_TYPE_AMD64 && PGM_GST_TYPE != PGM_TYPE_PROT) 86 89 # error "Invalid combination; AMD64 guest implies AMD64 shadow and vice versa" … … 225 228 226 229 227 #if !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) 230 #if !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE 228 231 /** 229 232 * Deal with a guest page fault. … … 525 528 return rcStrict; 526 529 } /* if any kind of handler */ 527 # endif /* !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) */530 # endif /* !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE*/ 528 531 529 532 … … 548 551 || PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64) \ 549 552 && !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) \ 550 && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) 553 && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) \ 554 && PGM_SHW_TYPE != PGM_TYPE_NONE 551 555 int rc; 552 556 … … 1270 1274 return rc; 1271 1275 1272 # else /* Nested paging, EPT except PGM_GST_TYPE = PROT */1276 # else /* Nested paging, EPT except PGM_GST_TYPE = PROT, NONE. */ 1273 1277 NOREF(uErr); NOREF(pRegFrame); NOREF(pvFault); 1274 1278 AssertReleaseMsgFailed(("Shw=%d Gst=%d is not implemented!\n", PGM_SHW_TYPE, PGM_GST_TYPE)); … … 1302 1306 { 1303 1307 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) \ 1304 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 1308 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) \ 1309 && PGM_SHW_TYPE != PGM_TYPE_NONE 1305 1310 int rc; 1306 1311 PVM pVM = pVCpu->CTX_SUFF(pVM); … … 1585 1590 return rc; 1586 1591 1587 #else /* guest real and protected mode */1592 #else /* guest real and protected mode, nested + ept, none. */ 1588 1593 /* There's no such thing as InvalidatePage when paging is disabled, so just ignore. */ 1589 1594 NOREF(pVCpu); NOREF(GCPtrPage); … … 1592 1597 } 1593 1598 1599 #if PGM_SHW_TYPE != PGM_TYPE_NONE 1594 1600 1595 1601 /** … … 1727 1733 { 1728 1734 LogFlow(("SyncHandlerPte: monitored page (%R[pgmpage]) -> mark read-only\n", pPage)); 1729 # if PGM_SHW_TYPE == PGM_TYPE_EPT1735 # if PGM_SHW_TYPE == PGM_TYPE_EPT 1730 1736 pPteDst->u = PGM_PAGE_GET_HCPHYS(pPage); 1731 1737 pPteDst->n.u1Present = 1; … … 1734 1740 pPteDst->n.u3EMT = VMX_EPT_MEMTYPE_WB; 1735 1741 /* PteDst.n.u1Write = 0 && PteDst.n.u1Size = 0 */ 1736 # else1742 # else 1737 1743 if (fPteSrc & X86_PTE_A) 1738 1744 { … … 1742 1748 else 1743 1749 SHW_PTE_SET(*pPteDst, 0); 1744 # endif1745 } 1746 # ifdef PGM_WITH_MMIO_OPTIMIZATIONS1747 # if PGM_SHW_TYPE == PGM_TYPE_EPT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_AMD641750 # endif 1751 } 1752 # ifdef PGM_WITH_MMIO_OPTIMIZATIONS 1753 # if PGM_SHW_TYPE == PGM_TYPE_EPT || PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_AMD64 1748 1754 else if ( PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage) 1749 1755 && ( BTH_IS_NP_ACTIVE(pVM) 1750 1756 || (fPteSrc & (X86_PTE_RW | X86_PTE_US)) == X86_PTE_RW) /** @todo Remove X86_PTE_US here and pGstWalk->Core.fEffectiveUS before the sync page test. */ 1751 # if PGM_SHW_TYPE == PGM_TYPE_AMD641757 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 1752 1758 && pVM->pgm.s.fLessThan52PhysicalAddressBits 1753 # endif1759 # endif 1754 1760 ) 1755 1761 { 1756 1762 LogFlow(("SyncHandlerPte: MMIO page -> invalid \n")); 1757 # if PGM_SHW_TYPE == PGM_TYPE_EPT1763 # if PGM_SHW_TYPE == PGM_TYPE_EPT 1758 1764 /* 25.2.3.1: Reserved physical address bit -> EPT Misconfiguration (exit 49) */ 1759 1765 pPteDst->u = pVM->pgm.s.HCPhysInvMmioPg; … … 1764 1770 /* 25.2.3.1: leaf && 2:0 != 0 && u3Emt in {2, 3, 7} -> EPT Misconfiguration */ 1765 1771 pPteDst->n.u3EMT = 7; 1766 # else1772 # else 1767 1773 /* Set high page frame bits that MBZ (bankers on PAE, CPU dependent on AMD64). */ 1768 1774 SHW_PTE_SET(*pPteDst, pVM->pgm.s.HCPhysInvMmioPg | X86_PTE_PAE_MBZ_MASK_NO_NX | X86_PTE_P); 1769 # endif1770 } 1771 # endif1772 # endif /* PGM_WITH_MMIO_OPTIMIZATIONS */1775 # endif 1776 } 1777 # endif 1778 # endif /* PGM_WITH_MMIO_OPTIMIZATIONS */ 1773 1779 else 1774 1780 { … … 1797 1803 * @remark Not used for 2/4MB pages! 1798 1804 */ 1799 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) || defined(DOXYGEN_RUNNING)1805 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) || defined(DOXYGEN_RUNNING) 1800 1806 static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, GSTPDE PdeSrc, GSTPTE PteSrc, 1801 1807 PPGMPOOLPAGE pShwPage, unsigned iPTDst) 1802 # else1808 # else 1803 1809 static void PGM_BTH_NAME(SyncPageWorker)(PVMCPU pVCpu, PSHWPTE pPteDst, RTGCPHYS GCPhysPage, 1804 1810 PPGMPOOLPAGE pShwPage, unsigned iPTDst) 1805 # endif1811 # endif 1806 1812 { 1807 1813 PVM pVM = pVCpu->CTX_SUFF(pVM); 1808 1814 RTGCPHYS GCPhysOldPage = NIL_RTGCPHYS; 1809 1815 1810 # if defined(PGMPOOL_WITH_OPTIMIZED_DIRTY_PT) \1816 # if defined(PGMPOOL_WITH_OPTIMIZED_DIRTY_PT) \ 1811 1817 && PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) \ 1812 1818 && (PGM_GST_TYPE == PGM_TYPE_PAE || PGM_GST_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_PAE /* pae/32bit combo */) … … 1822 1828 pGstPT->a[iPTDst].u = PteSrc.u; 1823 1829 } 1824 # else1830 # else 1825 1831 Assert(!pShwPage->fDirty); 1826 # endif1827 1828 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)1832 # endif 1833 1834 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1829 1835 if ( PteSrc.n.u1Present 1830 1836 && GST_IS_PTE_VALID(pVCpu, PteSrc)) 1831 # endif1832 { 1833 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)1837 # endif 1838 { 1839 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1834 1840 RTGCPHYS GCPhysPage = GST_GET_PTE_GCPHYS(PteSrc); 1835 # endif1841 # endif 1836 1842 PGM_A20_ASSERT_MASKED(pVCpu, GCPhysPage); 1837 1843 … … 1852 1858 } 1853 1859 1854 # ifndef VBOX_WITH_NEW_LAZY_PAGE_ALLOC1860 # ifndef VBOX_WITH_NEW_LAZY_PAGE_ALLOC 1855 1861 /* Make the page writable if necessary. */ 1856 1862 if ( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM 1857 1863 && ( PGM_PAGE_IS_ZERO(pPage) 1858 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)1864 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1859 1865 || ( PteSrc.n.u1Write 1860 # else1866 # else 1861 1867 || ( 1 1862 # endif1868 # endif 1863 1869 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED 1864 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES1870 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES 1865 1871 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_WRITE_MONITORED 1866 # endif1867 # ifdef VBOX_WITH_PAGE_SHARING1872 # endif 1873 # ifdef VBOX_WITH_PAGE_SHARING 1868 1874 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_SHARED 1869 # endif1875 # endif 1870 1876 ) 1871 1877 ) … … 1875 1881 AssertRC(rc); 1876 1882 } 1877 # endif1883 # endif 1878 1884 1879 1885 /* … … 1890 1896 else 1891 1897 { 1892 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)1898 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1893 1899 /* 1894 1900 * If the page or page directory entry is not marked accessed, … … 1915 1921 } 1916 1922 else 1917 # endif1923 # endif 1918 1924 { 1919 1925 STAM_COUNTER_INC(&pVCpu->pgm.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,DirtyPageSkipped)); 1920 # if PGM_SHW_TYPE == PGM_TYPE_EPT1926 # if PGM_SHW_TYPE == PGM_TYPE_EPT 1921 1927 PteDst.u = PGM_PAGE_GET_HCPHYS(pPage); 1922 1928 PteDst.n.u1Present = 1; … … 1926 1932 PteDst.n.u3EMT = VMX_EPT_MEMTYPE_WB; 1927 1933 /* PteDst.n.u1Size = 0 */ 1928 # else1934 # else 1929 1935 SHW_PTE_SET(PteDst, fGstShwPteFlags | PGM_PAGE_GET_HCPHYS(pPage)); 1930 # endif1936 # endif 1931 1937 } 1932 1938 … … 1967 1973 * Update statistics and commit the entry. 1968 1974 */ 1969 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)1975 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1970 1976 if (!PteSrc.n.u1Global) 1971 1977 pShwPage->fSeenNonGlobal = true; 1972 # endif1978 # endif 1973 1979 SHW_PTE_ATOMIC_SET2(*pPteDst, PteDst); 1974 1980 return; … … 1978 1984 Log2(("SyncPageWorker: invalid address in Pte\n")); 1979 1985 } 1980 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE)1986 # if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 1981 1987 else if (!PteSrc.n.u1Present) 1982 1988 Log2(("SyncPageWorker: page not present in Pte\n")); 1983 1989 else 1984 1990 Log2(("SyncPageWorker: invalid Pte\n")); 1985 # endif1991 # endif 1986 1992 1987 1993 /* … … 2024 2030 PGM_LOCK_ASSERT_OWNER(pVM); 2025 2031 2026 # if( PGM_GST_TYPE == PGM_TYPE_32BIT \2032 # if ( PGM_GST_TYPE == PGM_TYPE_32BIT \ 2027 2033 || PGM_GST_TYPE == PGM_TYPE_PAE \ 2028 2034 || PGM_GST_TYPE == PGM_TYPE_AMD64) \ … … 2034 2040 Assert(PdeSrc.n.u1Present); 2035 2041 Assert(cPages); 2036 # if 0 /* rarely useful; leave for debugging. */2042 # if 0 /* rarely useful; leave for debugging. */ 2037 2043 STAM_COUNTER_INC(&pVCpu->pgm.s.StatSyncPagePD[(GCPtrPage >> GST_PD_SHIFT) & GST_PD_MASK]); 2038 # endif2044 # endif 2039 2045 2040 2046 /* 2041 2047 * Get the shadow PDE, find the shadow page table in the pool. 2042 2048 */ 2043 # if PGM_SHW_TYPE == PGM_TYPE_32BIT2049 # if PGM_SHW_TYPE == PGM_TYPE_32BIT 2044 2050 const unsigned iPDDst = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK; 2045 2051 PX86PDE pPdeDst = pgmShwGet32BitPDEPtr(pVCpu, GCPtrPage); … … 2049 2055 Assert(pShwPde); 2050 2056 2051 # elif PGM_SHW_TYPE == PGM_TYPE_PAE2057 # elif PGM_SHW_TYPE == PGM_TYPE_PAE 2052 2058 const unsigned iPDDst = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK; 2053 2059 PPGMPOOLPAGE pShwPde = NULL; … … 2062 2068 PX86PDEPAE pPdeDst = &pPDDst->a[iPDDst]; 2063 2069 2064 # elif PGM_SHW_TYPE == PGM_TYPE_AMD642070 # elif PGM_SHW_TYPE == PGM_TYPE_AMD64 2065 2071 const unsigned iPDDst = (GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK; 2066 2072 const unsigned iPdpt = (GCPtrPage >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64; … … 2072 2078 Assert(pPDDst && pPdptDst); 2073 2079 PX86PDEPAE pPdeDst = &pPDDst->a[iPDDst]; 2074 # endif2080 # endif 2075 2081 SHWPDE PdeDst = *pPdeDst; 2076 2082 … … 2096 2102 Assert(pShwPage); 2097 2103 2098 # if PGM_GST_TYPE == PGM_TYPE_AMD642104 # if PGM_GST_TYPE == PGM_TYPE_AMD64 2099 2105 /* Fetch the pgm pool shadow descriptor. */ 2100 2106 PPGMPOOLPAGE pShwPde = pgmPoolGetPage(pPool, pPdptDst->a[iPdpt].u & X86_PDPE_PG_MASK); 2101 2107 Assert(pShwPde); 2102 # endif2108 # endif 2103 2109 2104 2110 /* … … 2111 2117 { 2112 2118 GCPhys = GST_GET_PDE_GCPHYS(PdeSrc); 2113 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT2119 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 2114 2120 /* Select the right PDE as we're emulating a 4kb page table with 2 shadow page tables. */ 2115 2121 GCPhys = PGM_A20_APPLY(pVCpu, GCPhys | ((iPDDst & 1) * (PAGE_SIZE / 2))); 2116 # endif2122 # endif 2117 2123 } 2118 2124 else 2119 2125 { 2120 2126 GCPhys = GST_GET_BIG_PDE_GCPHYS(pVM, PdeSrc); 2121 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT2127 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 2122 2128 /* Select the right PDE as we're emulating a 4MB page directory with two 2 MB shadow PDEs.*/ 2123 2129 GCPhys = PGM_A20_APPLY(pVCpu, GCPhys | (GCPtrPage & (1 << X86_PD_PAE_SHIFT))); 2124 # endif2130 # endif 2125 2131 } 2126 2132 /** @todo This doesn't check the G bit of 2/4MB pages. FIXME */ … … 2130 2136 && PdeSrc.n.u1User == PdeDst.n.u1User 2131 2137 && (PdeSrc.n.u1Write == PdeDst.n.u1Write || !PdeDst.n.u1Write) 2132 # if PGM_WITH_NX(PGM_GST_TYPE, PGM_SHW_TYPE)2138 # if PGM_WITH_NX(PGM_GST_TYPE, PGM_SHW_TYPE) 2133 2139 && (PdeSrc.n.u1NoExecute == PdeDst.n.u1NoExecute || !GST_IS_NX_ACTIVE(pVCpu)) 2134 # endif2140 # endif 2135 2141 ) 2136 2142 { … … 2152 2158 if (RT_SUCCESS(rc)) 2153 2159 { 2154 # ifdef PGM_SYNC_N_PAGES2160 # ifdef PGM_SYNC_N_PAGES 2155 2161 Assert(cPages == 1 || !(uErr & X86_TRAP_PF_P)); 2156 2162 if ( cPages > 1 … … 2166 2172 */ 2167 2173 unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK; 2168 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT2174 # if PGM_SHW_TYPE == PGM_TYPE_PAE && PGM_GST_TYPE == PGM_TYPE_32BIT 2169 2175 /* Select the right PDE as we're emulating a 4kb page table with 2 shadow page tables. */ 2170 2176 const unsigned offPTSrc = ((GCPtrPage >> SHW_PD_SHIFT) & 1) * 512; 2171 # else2177 # else 2172 2178 const unsigned offPTSrc = 0; 2173 # endif2179 # endif 2174 2180 const unsigned iPTDstEnd = RT_MIN(iPTDst + PGM_SYNC_NR_PAGES / 2, RT_ELEMENTS(pPTDst->a)); 2175 2181 if (iPTDst < PGM_SYNC_NR_PAGES / 2) … … 2187 2193 RTGCPTR GCPtrCurPage = (GCPtrPage & ~(RTGCPTR)(GST_PT_MASK << GST_PT_SHIFT)) | ((offPTSrc + iPTDst) << PAGE_SHIFT); 2188 2194 NOREF(GCPtrCurPage); 2189 # ifdef VBOX_WITH_RAW_MODE_NOT_R02195 # ifdef VBOX_WITH_RAW_MODE_NOT_R0 2190 2196 /* 2191 2197 * Assuming kernel code will be marked as supervisor - and not as user level … … 2200 2206 && PGM_PAGE_HAS_ACTIVE_HANDLERS(pPage)) 2201 2207 ) 2202 # endif /* else: CSAM not active */2208 # endif /* else: CSAM not active */ 2203 2209 PGM_BTH_NAME(SyncPageWorker)(pVCpu, &pPTDst->a[iPTDst], PdeSrc, *pPteSrc, pShwPage, iPTDst); 2204 2210 Log2(("SyncPage: 4K+ %RGv PteSrc:{P=%d RW=%d U=%d raw=%08llx} PteDst=%08llx%s\n", … … 2213 2219 } 2214 2220 else 2215 # endif /* PGM_SYNC_N_PAGES */2221 # endif /* PGM_SYNC_N_PAGES */ 2216 2222 { 2217 2223 const unsigned iPTSrc = (GCPtrPage >> GST_PT_SHIFT) & GST_PT_MASK; … … 2249 2255 AssertFatalMsg(!PGM_PAGE_IS_BALLOONED(pPage), ("Unexpected ballooned page at %RGp\n", GCPhys)); 2250 2256 2251 # ifndef VBOX_WITH_NEW_LAZY_PAGE_ALLOC2257 # ifndef VBOX_WITH_NEW_LAZY_PAGE_ALLOC 2252 2258 /* Try to make the page writable if necessary. */ 2253 2259 if ( PGM_PAGE_GET_TYPE(pPage) == PGMPAGETYPE_RAM … … 2255 2261 || ( PdeSrc.n.u1Write 2256 2262 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_ALLOCATED 2257 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES2263 # ifdef VBOX_WITH_REAL_WRITE_MONITORED_PAGES 2258 2264 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_WRITE_MONITORED 2259 # endif2260 # ifdef VBOX_WITH_PAGE_SHARING2265 # endif 2266 # ifdef VBOX_WITH_PAGE_SHARING 2261 2267 && PGM_PAGE_GET_STATE(pPage) != PGM_PAGE_STATE_SHARED 2262 # endif2268 # endif 2263 2269 ) 2264 2270 ) … … 2268 2274 AssertRC(rc); 2269 2275 } 2270 # endif2276 # endif 2271 2277 2272 2278 /* … … 2362 2368 2363 2369 2364 # elif (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \2370 # elif (PGM_GST_TYPE == PGM_TYPE_REAL || PGM_GST_TYPE == PGM_TYPE_PROT) \ 2365 2371 && !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) \ 2366 2372 && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) \ … … 2368 2374 NOREF(PdeSrc); 2369 2375 2370 # ifdef PGM_SYNC_N_PAGES2376 # ifdef PGM_SYNC_N_PAGES 2371 2377 /* 2372 2378 * Get the shadow PDE, find the shadow page table in the pool. 2373 2379 */ 2374 # if PGM_SHW_TYPE == PGM_TYPE_32BIT2380 # if PGM_SHW_TYPE == PGM_TYPE_32BIT 2375 2381 X86PDE PdeDst = pgmShwGet32BitPDE(pVCpu, GCPtrPage); 2376 2382 2377 # elif PGM_SHW_TYPE == PGM_TYPE_PAE2383 # elif PGM_SHW_TYPE == PGM_TYPE_PAE 2378 2384 X86PDEPAE PdeDst = pgmShwGetPaePDE(pVCpu, GCPtrPage); 2379 2385 2380 # elif PGM_SHW_TYPE == PGM_TYPE_AMD642386 # elif PGM_SHW_TYPE == PGM_TYPE_AMD64 2381 2387 const unsigned iPDDst = ((GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK); 2382 2388 const unsigned iPdpt = (GCPtrPage >> X86_PDPT_SHIFT) & X86_PDPT_MASK_AMD64; NOREF(iPdpt); … … 2389 2395 Assert(pPDDst && pPdptDst); 2390 2396 PdeDst = pPDDst->a[iPDDst]; 2391 # elif PGM_SHW_TYPE == PGM_TYPE_EPT2397 # elif PGM_SHW_TYPE == PGM_TYPE_EPT 2392 2398 const unsigned iPDDst = ((GCPtrPage >> SHW_PD_SHIFT) & SHW_PD_MASK); 2393 2399 PEPTPD pPDDst; … … 2402 2408 Assert(pPDDst); 2403 2409 PdeDst = pPDDst->a[iPDDst]; 2404 # endif2410 # endif 2405 2411 /* In the guest SMP case we could have blocked while another VCPU reused this page table. */ 2406 2412 if (!PdeDst.n.u1Present) … … 2464 2470 } 2465 2471 else 2466 # endif /* PGM_SYNC_N_PAGES */2472 # endif /* PGM_SYNC_N_PAGES */ 2467 2473 { 2468 2474 const unsigned iPTDst = (GCPtrPage >> SHW_PT_SHIFT) & SHW_PT_MASK; … … 2479 2485 return VINF_SUCCESS; 2480 2486 2481 # else2487 # else 2482 2488 NOREF(PdeSrc); 2483 2489 AssertReleaseMsgFailed(("Shw=%d Gst=%d is not implemented!\n", PGM_GST_TYPE, PGM_SHW_TYPE)); 2484 2490 return VERR_PGM_NOT_USED_IN_MODE; 2485 # endif2491 # endif 2486 2492 } 2487 2493 2488 2489 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) 2494 #endif /* PGM_SHW_TYPE != PGM_TYPE_NONE */ 2495 #if PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE 2490 2496 2491 2497 /** … … 2735 2741 } 2736 2742 2737 #endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) */ 2738 2743 #endif /* PGM_WITH_PAGING(PGM_GST_TYPE, PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE */ 2739 2744 2740 2745 /** … … 2774 2779 || PGM_GST_TYPE == PGM_TYPE_PAE \ 2775 2780 || PGM_GST_TYPE == PGM_TYPE_AMD64) \ 2776 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 2781 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) \ 2782 && PGM_SHW_TYPE != PGM_TYPE_NONE 2777 2783 int rc = VINF_SUCCESS; 2778 2784 … … 3232 3238 && !PGM_TYPE_IS_NESTED(PGM_SHW_TYPE) \ 3233 3239 && (PGM_SHW_TYPE != PGM_TYPE_EPT || PGM_GST_TYPE == PGM_TYPE_PROT) \ 3240 && PGM_SHW_TYPE != PGM_TYPE_NONE \ 3234 3241 && !defined(IN_RC) 3235 3242 NOREF(iPDSrc); NOREF(pPDSrc); … … 3470 3477 || PGM_GST_TYPE == PGM_TYPE_PAE \ 3471 3478 || PGM_GST_TYPE == PGM_TYPE_AMD64 ) \ 3472 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 3479 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) \ 3480 && PGM_SHW_TYPE != PGM_TYPE_NONE 3473 3481 /* 3474 3482 * Check that all Guest levels thru the PDE are present, getting the … … 3583 3591 return rc; 3584 3592 3585 #elif PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 3593 #elif PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NONE 3586 3594 NOREF(pVCpu); NOREF(GCPtrPage); 3587 3595 return VINF_SUCCESS; /* ignore */ … … 3618 3626 || PGM_GST_TYPE == PGM_TYPE_PAE \ 3619 3627 || PGM_GST_TYPE == PGM_TYPE_AMD64 ) \ 3620 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 3628 && !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) \ 3629 && PGM_SHW_TYPE != PGM_TYPE_NONE 3621 3630 3622 3631 # ifdef VBOX_WITH_RAW_MODE_NOT_R0 … … 3778 3787 #else /* PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) */ 3779 3788 3780 Assert ReleaseMsgFailed(("Shw=%d Gst=%d is not implemented!\n", PGM_GST_TYPE, PGM_SHW_TYPE));3789 AssertLogRelMsgFailed(("Shw=%d Gst=%d is not implemented!\n", PGM_GST_TYPE, PGM_SHW_TYPE)); 3781 3790 return VERR_PGM_NOT_USED_IN_MODE; 3782 3791 #endif /* PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) */ … … 3805 3814 LogFlow(("SyncCR3 FF=%d fGlobal=%d\n", !!VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3), fGlobal)); 3806 3815 3807 #if !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 3816 #if !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE 3808 3817 3809 3818 pgmLock(pVM); … … 3830 3839 #endif /* !NESTED && !EPT */ 3831 3840 3832 #if PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 3833 /* 3834 * Nested / EPT - almost no work.3841 #if PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NONE 3842 /* 3843 * Nested / EPT / None - No work. 3835 3844 */ 3836 3845 Assert(!pgmMapAreMappingsEnabled(pVM)); … … 3897 3906 { 3898 3907 NOREF(pVCpu); NOREF(cr3); NOREF(cr4); NOREF(GCPtr); NOREF(cb); 3899 #if PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 3908 #if PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NONE 3900 3909 return 0; 3901 3910 #else … … 4639 4648 # endif /* GST is in {32BIT, PAE, AMD64} */ 4640 4649 return cErrors; 4641 #endif /* !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) */4650 #endif /* !PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) && PGM_SHW_TYPE != PGM_TYPE_NONE */ 4642 4651 } 4643 4652 #endif /* VBOX_STRICT */ … … 4778 4787 #endif 4779 4788 4780 /* Update shadow paging info for guest modes with paging (32, pae, 64). */ 4789 /* 4790 * Update shadow paging info for guest modes with paging (32-bit, PAE, AMD64). 4791 */ 4781 4792 # if ( ( PGM_SHW_TYPE == PGM_TYPE_32BIT \ 4782 4793 || PGM_SHW_TYPE == PGM_TYPE_PAE \ -
trunk/src/VBox/VMM/VMMAll/PGMAllShw.h
r73273 r73324 152 152 # define SHW_PT_MASK X86_PT_PAE_MASK 153 153 154 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64 154 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64 || /* whatever: */ PGM_SHW_TYPE == PGM_TYPE_NONE 155 155 # define SHW_PDPT_SHIFT X86_PDPT_SHIFT 156 156 # define SHW_PDPT_MASK X86_PDPT_MASK_AMD64 … … 167 167 # error "Misconfigured PGM_SHW_TYPE or something..." 168 168 # endif 169 #endif 170 171 #if PGM_SHW_TYPE == PGM_TYPE_NONE && PGM_TYPE_IS_NESTED_OR_EPT(PGM_SHW_TYPE) 172 # error "PGM_TYPE_IS_NESTED_OR_EPT is true for PGM_TYPE_NONE!" 169 173 #endif 170 174 … … 283 287 PGM_SHW_DECL(int, GetPage)(PVMCPU pVCpu, RTGCUINTPTR GCPtr, uint64_t *pfFlags, PRTHCPHYS pHCPhys) 284 288 { 289 #if PGM_SHW_TYPE == PGM_TYPE_NONE 290 RT_NOREF(pVCpu, GCPtr); 291 AssertFailed(); 292 *pfFlags = 0; 293 *pHCPhys = NIL_RTHCPHYS; 294 return VERR_PGM_SHW_NONE_IPE; 295 296 #else /* PGM_SHW_TYPE != PGM_TYPE_NONE */ 285 297 PVM pVM = pVCpu->CTX_SUFF(pVM); 286 298 … … 290 302 * Get the PDE. 291 303 */ 292 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64304 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64 293 305 X86PDEPAE Pde; 294 306 … … 322 334 Pde.n.u1NoExecute |= Pml4e.n.u1NoExecute | Pdpe.lm.u1NoExecute; 323 335 324 # elif PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE336 # elif PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE 325 337 X86PDEPAE Pde = pgmShwGetPaePDE(pVCpu, GCPtr); 326 338 327 # elif PGM_SHW_TYPE == PGM_TYPE_EPT339 # elif PGM_SHW_TYPE == PGM_TYPE_EPT 328 340 const unsigned iPd = ((GCPtr >> SHW_PD_SHIFT) & SHW_PD_MASK); 329 341 PEPTPD pPDDst; … … 339 351 Pde = pPDDst->a[iPd]; 340 352 341 # elif PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_NESTED_32BIT353 # elif PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_NESTED_32BIT 342 354 X86PDE Pde = pgmShwGet32BitPDE(pVCpu, GCPtr); 343 # else344 # error "Misconfigured PGM_SHW_TYPE or something..."345 # endif355 # else 356 # error "Misconfigured PGM_SHW_TYPE or something..." 357 # endif 346 358 if (!Pde.n.u1Present) 347 359 return VERR_PAGE_TABLE_NOT_PRESENT; … … 358 370 { 359 371 *pfFlags = (Pde.u & ~SHW_PDE_PG_MASK); 360 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64372 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64 361 373 if ( (Pde.u & X86_PTE_PAE_NX) 362 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)374 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) 363 375 && CPUMIsGuestNXEnabled(pVCpu) /** @todo why do we have to check the guest state here? */ 364 # endif376 # endif 365 377 ) 366 378 *pfFlags |= X86_PTE_PAE_NX; 367 # endif379 # endif 368 380 } 369 381 … … 386 398 else /* mapping: */ 387 399 { 388 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 \400 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 \ 389 401 || PGM_SHW_TYPE == PGM_TYPE_EPT \ 390 402 || defined(PGM_WITHOUT_MAPPINGS) 391 403 AssertFailed(); /* can't happen */ 392 404 pPT = NULL; /* shut up MSC */ 393 # else405 # else 394 406 Assert(pgmMapAreMappingsEnabled(pVM)); 395 407 396 408 PPGMMAPPING pMap = pgmGetMapping(pVM, (RTGCPTR)GCPtr); 397 409 AssertMsgReturn(pMap, ("GCPtr=%RGv\n", GCPtr), VERR_PGM_MAPPING_IPE); 398 # if PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_NESTED_32BIT410 # if PGM_SHW_TYPE == PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_NESTED_32BIT 399 411 pPT = pMap->aPTs[(GCPtr - pMap->GCPtr) >> X86_PD_SHIFT].CTX_SUFF(pPT); 400 # else /* PAE */412 # else /* PAE */ 401 413 pPT = pMap->aPTs[(GCPtr - pMap->GCPtr) >> X86_PD_SHIFT].CTX_SUFF(paPaePTs); 402 # endif403 # endif414 # endif 415 # endif 404 416 } 405 417 const unsigned iPt = (GCPtr >> SHW_PT_SHIFT) & SHW_PT_MASK; … … 418 430 & ((Pde.u & (X86_PTE_RW | X86_PTE_US)) | ~(uint64_t)(X86_PTE_RW | X86_PTE_US)); 419 431 420 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64432 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64 421 433 /* The NX bit is determined by a bitwise OR between the PT and PD */ 422 434 if ( ((SHW_PTE_GET_U(Pte) | Pde.u) & X86_PTE_PAE_NX) 423 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE)435 # if PGM_WITH_NX(PGM_SHW_TYPE, PGM_SHW_TYPE) 424 436 && CPUMIsGuestNXEnabled(pVCpu) /** @todo why do we have to check the guest state here? */ 425 # endif437 # endif 426 438 ) 427 439 *pfFlags |= X86_PTE_PAE_NX; 428 # endif440 # endif 429 441 } 430 442 … … 433 445 434 446 return VINF_SUCCESS; 447 #endif /* PGM_SHW_TYPE != PGM_TYPE_NONE */ 435 448 } 436 449 … … 453 466 PGM_SHW_DECL(int, ModifyPage)(PVMCPU pVCpu, RTGCUINTPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask, uint32_t fOpFlags) 454 467 { 468 #if PGM_SHW_TYPE == PGM_TYPE_NONE 469 RT_NOREF(pVCpu, GCPtr, cb, fFlags, fMask, fOpFlags); 470 AssertFailed(); 471 return VERR_PGM_SHW_NONE_IPE; 472 473 #else /* PGM_SHW_TYPE != PGM_TYPE_NONE */ 455 474 PVM pVM = pVCpu->CTX_SUFF(pVM); 456 int rc;457 458 475 PGM_LOCK_ASSERT_OWNER(pVM); 459 476 … … 461 478 * Walk page tables and pages till we're done. 462 479 */ 480 int rc; 463 481 for (;;) 464 482 { … … 466 484 * Get the PDE. 467 485 */ 468 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64486 # if PGM_SHW_TYPE == PGM_TYPE_AMD64 || PGM_SHW_TYPE == PGM_TYPE_NESTED_AMD64 469 487 X86PDEPAE Pde; 470 488 /* PML4 */ … … 491 509 Pde = pPd->a[iPd]; 492 510 493 # elif PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE511 # elif PGM_SHW_TYPE == PGM_TYPE_PAE || PGM_SHW_TYPE == PGM_TYPE_NESTED_PAE 494 512 X86PDEPAE Pde = pgmShwGetPaePDE(pVCpu, GCPtr); 495 513 496 # elif PGM_SHW_TYPE == PGM_TYPE_EPT514 # elif PGM_SHW_TYPE == PGM_TYPE_EPT 497 515 const unsigned iPd = ((GCPtr >> SHW_PD_SHIFT) & SHW_PD_MASK); 498 516 PEPTPD pPDDst; … … 508 526 Pde = pPDDst->a[iPd]; 509 527 510 # else /* PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_NESTED_32BIT */528 # else /* PGM_TYPE_32BIT || PGM_SHW_TYPE == PGM_TYPE_NESTED_32BIT */ 511 529 X86PDE Pde = pgmShwGet32BitPDE(pVCpu, GCPtr); 512 # endif530 # endif 513 531 if (!Pde.n.u1Present) 514 532 return VERR_PAGE_TABLE_NOT_PRESENT; … … 566 584 567 585 SHW_PTE_ATOMIC_SET2(pPT->a[iPTE], NewPte); 568 # if PGM_SHW_TYPE == PGM_TYPE_EPT586 # if PGM_SHW_TYPE == PGM_TYPE_EPT 569 587 HMInvalidatePhysPage(pVM, (RTGCPHYS)GCPtr); 570 # else588 # else 571 589 PGM_INVL_PG_ALL_VCPU(pVM, GCPtr); 572 # endif590 # endif 573 591 } 574 592 … … 581 599 } 582 600 } 601 #endif /* PGM_SHW_TYPE != PGM_TYPE_NONE */ 583 602 } 584 603 … … 594 613 PGM_SHW_DECL(int, Relocate)(PVMCPU pVCpu, RTGCPTR offDelta) 595 614 { 615 # if PGM_SHW_TYPE != PGM_TYPE_NONE 596 616 pVCpu->pgm.s.pShwPageCR3RC += offDelta; 617 # else 618 RT_NOREF(pVCpu, offDelta); 619 # endif 597 620 return VINF_SUCCESS; 598 621 } -
trunk/src/VBox/VMM/VMMR3/PGM.cpp
r73271 r73324 2539 2539 AssertRCSuccessReturn(rc, VERR_IPE_UNEXPECTED_INFO_STATUS); 2540 2540 2541 Assert(pVCpu->pgm.s.pShwPageCR3R3 != NULL );2541 Assert(pVCpu->pgm.s.pShwPageCR3R3 != NULL || pVCpu->pgm.s.enmShadowMode == PGMMODE_NONE); 2542 2542 AssertMsg( pVCpu->pgm.s.enmShadowMode >= PGMMODE_NESTED_32BIT 2543 2543 || CPUMGetHyperCR3(pVCpu) == PGMGetHyperCR3(pVCpu), -
trunk/src/VBox/VMM/VMMR3/VMMSwitcher.cpp
r73097 r73324 1011 1011 static RTRCPTR vmmR3SwitcherGetHyperGDT(PVM pVM) 1012 1012 { 1013 if ( HMIsRawModeCtxNeeded(pVM))1013 if (VM_IS_RAW_MODE_ENABLED(pVM) || HMIsRawModeCtxNeeded(pVM)) 1014 1014 return SELMGetHyperGDT(pVM); 1015 1015 # if HC_ARCH_BITS != 32 -
trunk/src/VBox/VMM/include/PGMInternal.h
r73285 r73324 214 214 #define PGM_TYPE_NESTED_AMD64 8 215 215 #define PGM_TYPE_EPT 9 216 #define PGM_TYPE_ MAX PGM_TYPE_EPT217 #define PGM_TYPE_END (PGM_TYPE_ EPT+ 1)216 #define PGM_TYPE_NONE 10 /**< Dummy shadow paging mode for NEM. */ 217 #define PGM_TYPE_END (PGM_TYPE_NONE + 1) 218 218 #define PGM_TYPE_FIRST_SHADOW PGM_TYPE_32BIT /**< The first type used by shadow paging. */ 219 219 /** @} */ … … 3023 3023 #define PGM_SHW_NAME_RC_EPT_STR(name) "pgmRCShwEPT" #name 3024 3024 #define PGM_SHW_NAME_R0_EPT_STR(name) "pgmR0ShwEPT" #name 3025 #define PGM_SHW_NAME_NONE(name) PGM_CTX(pgm,ShwNone##name) 3026 #define PGM_SHW_NAME_RC_NONE_STR(name) "pgmRCShwNone" #name 3027 #define PGM_SHW_NAME_R0_NONE_STR(name) "pgmR0ShwNone" #name 3025 3028 #define PGM_SHW_DECL(type, name) PGM_CTX_DECL(type) PGM_SHW_NAME(name) 3026 3029 … … 3055 3058 #define PGM_BTH_NAME_EPT_PAE(name) PGM_CTX(pgm,BthEPTPAE##name) 3056 3059 #define PGM_BTH_NAME_EPT_AMD64(name) PGM_CTX(pgm,BthEPTAMD64##name) 3060 #define PGM_BTH_NAME_NONE_REAL(name) PGM_CTX(pgm,BthNoneReal##name) 3061 #define PGM_BTH_NAME_NONE_PROT(name) PGM_CTX(pgm,BthNoneProt##name) 3062 #define PGM_BTH_NAME_NONE_32BIT(name) PGM_CTX(pgm,BthNone32Bit##name) 3063 #define PGM_BTH_NAME_NONE_PAE(name) PGM_CTX(pgm,BthNonePAE##name) 3064 #define PGM_BTH_NAME_NONE_AMD64(name) PGM_CTX(pgm,BthNoneAMD64##name) 3057 3065 3058 3066 #define PGM_BTH_NAME_RC_32BIT_REAL_STR(name) "pgmRCBth32BitReal" #name
Note:
See TracChangeset
for help on using the changeset viewer.