[23] | 1 | /* $Id: MMPagePool.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
[1] | 2 | /** @file
|
---|
[82565] | 3 | * MM - Memory Manager - Page Pool (what's left of it).
|
---|
[1] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[82968] | 7 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
[1] | 8 | *
|
---|
| 9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
| 10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
| 11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
[5999] | 12 | * General Public License (GPL) as published by the Free Software
|
---|
| 13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
| 14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
| 15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
[1] | 16 | */
|
---|
| 17 |
|
---|
[57358] | 18 |
|
---|
| 19 | /*********************************************************************************************************************************
|
---|
| 20 | * Header Files *
|
---|
| 21 | *********************************************************************************************************************************/
|
---|
[878] | 22 | #define LOG_GROUP LOG_GROUP_MM_POOL
|
---|
[35346] | 23 | #include <VBox/vmm/mm.h>
|
---|
[1] | 24 | #include "MMInternal.h"
|
---|
[35346] | 25 | #include <VBox/vmm/vm.h>
|
---|
[76454] | 26 | #include <iprt/errcore.h>
|
---|
[1] | 27 | #include <VBox/log.h>
|
---|
| 28 |
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * Gets the HC pointer to the dummy page.
|
---|
| 32 | *
|
---|
| 33 | * The dummy page is used as a place holder to prevent potential bugs
|
---|
| 34 | * from doing really bad things to the system.
|
---|
| 35 | *
|
---|
| 36 | * @returns Pointer to the dummy page.
|
---|
[58122] | 37 | * @param pVM The cross context VM structure.
|
---|
[1] | 38 | * @thread The Emulation Thread.
|
---|
| 39 | */
|
---|
[12989] | 40 | VMMR3DECL(void *) MMR3PageDummyHCPtr(PVM pVM)
|
---|
[1] | 41 | {
|
---|
| 42 | VM_ASSERT_EMT(pVM);
|
---|
| 43 | if (!pVM->mm.s.pvDummyPage)
|
---|
| 44 | {
|
---|
[82565] | 45 | int rc = MMHyperAlloc(pVM, PAGE_SIZE, PAGE_SIZE, MM_TAG_PGM, &pVM->mm.s.pvDummyPage);
|
---|
| 46 | AssertRelease(RT_SUCCESS(rc));
|
---|
[1] | 47 | AssertRelease(pVM->mm.s.pvDummyPage);
|
---|
[82565] | 48 | pVM->mm.s.HCPhysDummyPage = MMR3HyperHCVirt2HCPhys(pVM, pVM->mm.s.pvDummyPage);
|
---|
[32036] | 49 | AssertRelease(!(pVM->mm.s.HCPhysDummyPage & ~X86_PTE_PAE_PG_MASK));
|
---|
[1] | 50 | }
|
---|
| 51 | return pVM->mm.s.pvDummyPage;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | /**
|
---|
| 56 | * Gets the HC Phys to the dummy page.
|
---|
| 57 | *
|
---|
| 58 | * The dummy page is used as a place holder to prevent potential bugs
|
---|
| 59 | * from doing really bad things to the system.
|
---|
| 60 | *
|
---|
| 61 | * @returns Pointer to the dummy page.
|
---|
[58122] | 62 | * @param pVM The cross context VM structure.
|
---|
[1] | 63 | * @thread The Emulation Thread.
|
---|
| 64 | */
|
---|
[12989] | 65 | VMMR3DECL(RTHCPHYS) MMR3PageDummyHCPhys(PVM pVM)
|
---|
[1] | 66 | {
|
---|
| 67 | VM_ASSERT_EMT(pVM);
|
---|
| 68 | if (!pVM->mm.s.pvDummyPage)
|
---|
| 69 | MMR3PageDummyHCPtr(pVM);
|
---|
| 70 | return pVM->mm.s.HCPhysDummyPage;
|
---|
| 71 | }
|
---|
| 72 |
|
---|