1 | /* $Id: MMPagePool.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * MM - Memory Manager - Page Pool (what's left of it).
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2020 Oracle Corporation
|
---|
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
|
---|
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.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*********************************************************************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *********************************************************************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_MM_POOL
|
---|
23 | #include <VBox/vmm/mm.h>
|
---|
24 | #include "MMInternal.h"
|
---|
25 | #include <VBox/vmm/vm.h>
|
---|
26 | #include <iprt/errcore.h>
|
---|
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.
|
---|
37 | * @param pVM The cross context VM structure.
|
---|
38 | * @thread The Emulation Thread.
|
---|
39 | */
|
---|
40 | VMMR3DECL(void *) MMR3PageDummyHCPtr(PVM pVM)
|
---|
41 | {
|
---|
42 | VM_ASSERT_EMT(pVM);
|
---|
43 | if (!pVM->mm.s.pvDummyPage)
|
---|
44 | {
|
---|
45 | int rc = MMHyperAlloc(pVM, PAGE_SIZE, PAGE_SIZE, MM_TAG_PGM, &pVM->mm.s.pvDummyPage);
|
---|
46 | AssertRelease(RT_SUCCESS(rc));
|
---|
47 | AssertRelease(pVM->mm.s.pvDummyPage);
|
---|
48 | pVM->mm.s.HCPhysDummyPage = MMR3HyperHCVirt2HCPhys(pVM, pVM->mm.s.pvDummyPage);
|
---|
49 | AssertRelease(!(pVM->mm.s.HCPhysDummyPage & ~X86_PTE_PAE_PG_MASK));
|
---|
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.
|
---|
62 | * @param pVM The cross context VM structure.
|
---|
63 | * @thread The Emulation Thread.
|
---|
64 | */
|
---|
65 | VMMR3DECL(RTHCPHYS) MMR3PageDummyHCPhys(PVM pVM)
|
---|
66 | {
|
---|
67 | VM_ASSERT_EMT(pVM);
|
---|
68 | if (!pVM->mm.s.pvDummyPage)
|
---|
69 | MMR3PageDummyHCPtr(pVM);
|
---|
70 | return pVM->mm.s.HCPhysDummyPage;
|
---|
71 | }
|
---|
72 |
|
---|