VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR3/PGMGst.h@ 73260

Last change on this file since 73260 was 73250, checked in by vboxsync, 7 years ago

PGM: Working on eliminating PGMMODEDATA and the corresponding PGMCPU section so we can do mode switching in ring-0. This forth part dealing with shadow+guest paging pointers and finally removing the PGMMODEDATA type. bugref:9044

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 2.8 KB
Line 
1/* $Id: PGMGst.h 73250 2018-07-19 17:57:31Z vboxsync $ */
2/** @file
3 * VBox - Page Manager / Monitor, Guest Paging Template.
4 */
5
6/*
7 * Copyright (C) 2006-2017 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* Internal Functions *
21*******************************************************************************/
22RT_C_DECLS_BEGIN
23/* r3 */
24PGM_GST_DECL(int, Enter)(PVMCPU pVCpu, RTGCPHYS GCPhysCR3);
25PGM_GST_DECL(int, Relocate)(PVMCPU pVCpu, RTGCPTR offDelta);
26PGM_GST_DECL(int, Exit)(PVMCPU pVCpu);
27
28/* all */
29PGM_GST_DECL(int, GetPage)(PVMCPU pVCpu, RTGCPTR GCPtr, uint64_t *pfFlags, PRTGCPHYS pGCPhys);
30PGM_GST_DECL(int, ModifyPage)(PVMCPU pVCpu, RTGCPTR GCPtr, size_t cb, uint64_t fFlags, uint64_t fMask);
31PGM_GST_DECL(int, GetPDE)(PVMCPU pVCpu, RTGCPTR GCPtr, PX86PDEPAE pPDE);
32RT_C_DECLS_END
33
34
35/**
36 * Enters the guest mode.
37 *
38 * @returns VBox status code.
39 * @param pVCpu The cross context virtual CPU structure.
40 * @param GCPhysCR3 The physical address from the CR3 register.
41 */
42PGM_GST_DECL(int, Enter)(PVMCPU pVCpu, RTGCPHYS GCPhysCR3)
43{
44 /*
45 * Map and monitor CR3
46 */
47 uintptr_t idxBth = pVCpu->pgm.s.idxBothModeData;
48 AssertReturn(idxBth < RT_ELEMENTS(g_aPgmBothModeData), VERR_PGM_MODE_IPE);
49 AssertReturn(g_aPgmBothModeData[idxBth].pfnMapCR3, VERR_PGM_MODE_IPE);
50 return g_aPgmBothModeData[idxBth].pfnMapCR3(pVCpu, GCPhysCR3);
51}
52
53
54/**
55 * Relocate any GC pointers related to guest mode paging.
56 *
57 * @returns VBox status code.
58 * @param pVCpu The cross context virtual CPU structure.
59 * @param offDelta The relocation offset.
60 */
61PGM_GST_DECL(int, Relocate)(PVMCPU pVCpu, RTGCPTR offDelta)
62{
63 pVCpu->pgm.s.pGst32BitPdRC += offDelta;
64
65 for (unsigned i = 0; i < RT_ELEMENTS(pVCpu->pgm.s.apGstPaePDsRC); i++)
66 {
67 pVCpu->pgm.s.apGstPaePDsRC[i] += offDelta;
68 }
69 pVCpu->pgm.s.pGstPaePdptRC += offDelta;
70
71 return VINF_SUCCESS;
72}
73
74
75/**
76 * Exits the guest mode.
77 *
78 * @returns VBox status code.
79 * @param pVCpu The cross context virtual CPU structure.
80 */
81PGM_GST_DECL(int, Exit)(PVMCPU pVCpu)
82{
83 uintptr_t idxBth = pVCpu->pgm.s.idxBothModeData;
84 AssertReturn(idxBth < RT_ELEMENTS(g_aPgmBothModeData), VERR_PGM_MODE_IPE);
85 AssertReturn(g_aPgmBothModeData[idxBth].pfnUnmapCR3, VERR_PGM_MODE_IPE);
86 return g_aPgmBothModeData[idxBth].pfnUnmapCR3(pVCpu);
87}
88
Note: See TracBrowser for help on using the repository browser.

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