vbox5: increase boot speed of Linux guests

Until now, if we examined an EPT fault and the corresponding guest
physical memory was not allocated, we forwarded the faulting instruction
to the instruction emulator, which in turn handled the memory allocation
implicitly. This lead to long instruction emulation times on certain
instructions (e.g. 'rep mov' on large memory junks).  Therefore, we now
allocate and map the corresponding guest physical memory immediately in
the EPT fault handler and directly return to the guest.

fixes #2645
This commit is contained in:
Sebastian Sumpf 2018-01-17 11:14:25 +01:00 committed by Christian Helmuth
parent 6013889028
commit 963f5de117
1 changed files with 15 additions and 0 deletions

View File

@ -44,6 +44,21 @@ int Vcpu_handler::map_memory(RTGCPHYS GCPhys, size_t cbWrite,
_ept_fault_addr_type = PGM_PAGE_GET_TYPE(pPage);
/*
* If page is not allocated (== zero page) and no MMIO or active page, allocate and map it
* immediately. Important do not do this if A20 gate is disabled, A20 gate
* is handled by IEM/REM in this case.
*/
if (PGM_PAGE_IS_ZERO(pPage)
&& !PGM_PAGE_IS_ALLOCATED(pPage)
&& !PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage)
&& !PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage)
&& PGM_A20_IS_ENABLED(pVCpu)) {
pgmLock(pVM);
pgmPhysPageMakeWritable(pVM, pPage, GCPhys);
pgmUnlock(pVM);
}
if (PGM_PAGE_HAS_ACTIVE_ALL_HANDLERS(pPage) ||
PGM_PAGE_IS_SPECIAL_ALIAS_MMIO(pPage) ||
PGM_PAGE_IS_ZERO(pPage)) {