VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR3/MMPagePool.cpp@ 93583

Last change on this file since 93583 was 93554, checked in by vboxsync, 3 years ago

VMM: Changed PAGE_SIZE -> GUEST_PAGE_SIZE / HOST_PAGE_SIZE, PAGE_SHIFT -> GUEST_PAGE_SHIFT / HOST_PAGE_SHIFT, and PAGE_OFFSET_MASK -> GUEST_PAGE_OFFSET_MASK / HOST_PAGE_OFFSET_MASK. Also removed most usage of ASMMemIsZeroPage and ASMMemZeroPage since the host and guest page size doesn't need to be the same any more. Some work left to do in the page pool code. bugref:9898

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.5 KB
Line 
1/* $Id: MMPagePool.cpp 93554 2022-02-02 22:57:02Z vboxsync $ */
2/** @file
3 * MM - Memory Manager - Page Pool (what's left of it).
4 */
5
6/*
7 * Copyright (C) 2006-2022 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 */
40VMMR3DECL(void *) MMR3PageDummyHCPtr(PVM pVM)
41{
42 VM_ASSERT_EMT(pVM);
43 if (!pVM->mm.s.pvDummyPage)
44 {
45 /** @todo Redo this. */
46 int rc = MMHyperAlloc(pVM, RT_MAX(GUEST_PAGE_SIZE, HOST_PAGE_SIZE), GUEST_PAGE_SIZE, MM_TAG_PGM, &pVM->mm.s.pvDummyPage);
47 AssertRelease(RT_SUCCESS(rc));
48 AssertRelease(pVM->mm.s.pvDummyPage);
49 pVM->mm.s.HCPhysDummyPage = MMR3HyperHCVirt2HCPhys(pVM, pVM->mm.s.pvDummyPage);
50 AssertRelease(!(pVM->mm.s.HCPhysDummyPage & ~X86_PTE_PAE_PG_MASK));
51 }
52 return pVM->mm.s.pvDummyPage;
53}
54
55
56/**
57 * Gets the HC Phys to the dummy page.
58 *
59 * The dummy page is used as a place holder to prevent potential bugs
60 * from doing really bad things to the system.
61 *
62 * @returns Pointer to the dummy page.
63 * @param pVM The cross context VM structure.
64 * @thread The Emulation Thread.
65 */
66VMMR3DECL(RTHCPHYS) MMR3PageDummyHCPhys(PVM pVM)
67{
68 VM_ASSERT_EMT(pVM);
69 if (!pVM->mm.s.pvDummyPage)
70 MMR3PageDummyHCPtr(pVM);
71 return pVM->mm.s.HCPhysDummyPage;
72}
73
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette