Changeset 19992 in vbox for trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
- Timestamp:
- May 25, 2009 11:31:23 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IOMAllMMIO.cpp
r19677 r19992 1884 1884 } 1885 1885 1886 /** 1887 * Mapping a HC page in place of an MMIO page for direct access. 1888 * 1889 * (This is a special optimization used by the APIC in the VT-x case.) 1890 * 1891 * @returns VBox status code. 1892 * 1893 * @param pVM The virtual machine. 1894 * @param GCPhys The address of the MMIO page to be changed. 1895 * @param HCPhys The address of the host physical page. 1896 * @param fPageFlags Page flags to set. Must be (X86_PTE_RW | X86_PTE_P) 1897 * for the time being. 1898 */ 1899 VMMDECL(int) IOMMMIOMapMMIOHCPage(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint64_t fPageFlags) 1900 { 1901 Log(("IOMMMIOMapMMIOHCPage %RGp -> %RGp flags=%RX64\n", GCPhys, HCPhys, fPageFlags)); 1902 1903 AssertReturn(fPageFlags == (X86_PTE_RW | X86_PTE_P), VERR_INVALID_PARAMETER); 1904 Assert(HWACCMIsEnabled(pVM)); 1905 1906 PVMCPU pVCpu = VMMGetCpu(pVM); 1907 1908 /* 1909 * Lookup the context range node the page belongs to. 1910 */ 1911 PIOMMMIORANGE pRange = iomMMIOGetRange(&pVM->iom.s, GCPhys); 1912 AssertMsgReturn(pRange, 1913 ("Handlers and page tables are out of sync or something! GCPhys=%RGp\n", GCPhys), 1914 VERR_IOM_MMIO_RANGE_NOT_FOUND); 1915 Assert((pRange->GCPhys & PAGE_OFFSET_MASK) == 0); 1916 Assert((pRange->Core.KeyLast & PAGE_OFFSET_MASK) == PAGE_OFFSET_MASK); 1917 1918 /* 1919 * Do the aliasing; page align the addresses since PGM is picky. 1920 */ 1921 GCPhys &= ~(RTGCPHYS)PAGE_OFFSET_MASK; 1922 HCPhys &= ~(RTHCPHYS)PAGE_OFFSET_MASK; 1923 1924 int rc = PGMHandlerPhysicalPageAliasHC(pVM, pRange->GCPhys, GCPhys, HCPhys); 1925 AssertRCReturn(rc, rc); 1926 1927 /* 1928 * Modify the shadow page table. Since it's an MMIO page it won't be present and we 1929 * can simply prefetch it. 1930 * 1931 * Note: This is a NOP in the EPT case; we'll just let it fault again to resync the page. 1932 */ 1933 rc = PGMPrefetchPage(pVCpu, (RTGCPTR)GCPhys); 1934 Assert(rc == VINF_SUCCESS || rc == VERR_PAGE_NOT_PRESENT || rc == VERR_PAGE_TABLE_NOT_PRESENT); 1935 return VINF_SUCCESS; 1936 } 1886 1937 1887 1938 /**
Note:
See TracChangeset
for help on using the changeset viewer.