VirtualBox

source: vbox/trunk/src/VBox/VMM/PGMBth.h@ 7692

Last change on this file since 7692 was 7629, checked in by vboxsync, 17 years ago

Initial cleanup for PAE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1/* $Id: PGMBth.h 7629 2008-03-28 15:07:31Z vboxsync $ */
2/** @file
3 * VBox - Page Manager / Monitor, Shadow+Guest Paging Template.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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*******************************************************************************/
22__BEGIN_DECLS
23PGM_BTH_DECL(int, InitData)(PVM pVM, PPGMMODEDATA pModeData, bool fResolveGCAndR0);
24PGM_BTH_DECL(int, Enter)(PVM pVM, RTGCPHYS GCPhysCR3);
25PGM_BTH_DECL(int, Relocate)(PVM pVM, RTGCUINTPTR offDelta);
26
27PGM_BTH_DECL(int, Trap0eHandler)(PVM pVM, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault);
28PGM_BTH_DECL(int, SyncCR3)(PVM pVM, uint32_t cr0, uint32_t cr3, uint32_t cr4, bool fGlobal);
29PGM_BTH_DECL(int, SyncPage)(PVM pVM, X86PDE PdeSrc, RTGCUINTPTR GCPtrPage, unsigned cPages, unsigned uError);
30PGM_BTH_DECL(int, VerifyAccessSyncPage)(PVM pVM, RTGCUINTPTR Addr, unsigned fPage, unsigned uError);
31PGM_BTH_DECL(int, InvalidatePage)(PVM pVM, RTGCPTR GCPtrPage);
32PGM_BTH_DECL(int, PrefetchPage)(PVM pVM, RTGCUINTPTR GCPtrPage);
33PGM_BTH_DECL(unsigned, AssertCR3)(PVM pVM, uint32_t cr3, uint32_t cr4, RTGCUINTPTR GCPtr = 0, RTGCUINTPTR cb = ~(RTGCUINTPTR)0);
34__END_DECLS
35
36
37/**
38 * Initializes the both bit of the paging mode data.
39 *
40 * @returns VBox status code.
41 * @param pVM The VM handle.
42 * @param fResolveGCAndR0 Indicate whether or not GC and Ring-0 symbols can be resolved now.
43 * This is used early in the init process to avoid trouble with PDM
44 * not being initialized yet.
45 */
46PGM_BTH_DECL(int, InitData)(PVM pVM, PPGMMODEDATA pModeData, bool fResolveGCAndR0)
47{
48 Assert(pModeData->uShwType == PGM_SHW_TYPE); Assert(pModeData->uGstType == PGM_GST_TYPE);
49
50 /* Ring 3 */
51 pModeData->pfnR3BthRelocate = PGM_BTH_NAME(Relocate);
52 pModeData->pfnR3BthSyncCR3 = PGM_BTH_NAME(SyncCR3);
53 pModeData->pfnR3BthTrap0eHandler = PGM_BTH_NAME(Trap0eHandler);
54 pModeData->pfnR3BthInvalidatePage = PGM_BTH_NAME(InvalidatePage);
55 pModeData->pfnR3BthSyncPage = PGM_BTH_NAME(SyncPage);
56 pModeData->pfnR3BthPrefetchPage = PGM_BTH_NAME(PrefetchPage);
57 pModeData->pfnR3BthVerifyAccessSyncPage = PGM_BTH_NAME(VerifyAccessSyncPage);
58#ifdef VBOX_STRICT
59 PGM_BTH_PFN(AssertCR3, pVM) = PGM_BTH_NAME(AssertCR3);
60#endif
61
62 if (fResolveGCAndR0)
63 {
64 int rc;
65
66 /* GC */
67 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(Trap0eHandler), &pModeData->pfnGCBthTrap0eHandler);
68 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(Trap0eHandler), rc), rc);
69 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(InvalidatePage), &pModeData->pfnGCBthInvalidatePage);
70 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(InvalidatePage), rc), rc);
71 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(SyncCR3), &pModeData->pfnGCBthSyncCR3);
72 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(SyncPage), rc), rc);
73 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(SyncPage), &pModeData->pfnGCBthSyncPage);
74 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(SyncPage), rc), rc);
75 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(PrefetchPage), &pModeData->pfnGCBthPrefetchPage);
76 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(PrefetchPage), rc), rc);
77 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(VerifyAccessSyncPage), &pModeData->pfnGCBthVerifyAccessSyncPage);
78 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(VerifyAccessSyncPage), rc), rc);
79#ifdef VBOX_STRICT
80 rc = PDMR3GetSymbolGC(pVM, NULL, PGM_BTH_NAME_GC_STR(AssertCR3), &pModeData->pfnGCBthAssertCR3);
81 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_GC_STR(AssertCR3), rc), rc);
82#endif
83
84 /* Ring 0 */
85 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(Trap0eHandler), &pModeData->pfnR0BthTrap0eHandler);
86 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(Trap0eHandler), rc), rc);
87 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(InvalidatePage), &pModeData->pfnR0BthInvalidatePage);
88 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(InvalidatePage), rc), rc);
89 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(SyncCR3), &pModeData->pfnR0BthSyncCR3);
90 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(SyncCR3), rc), rc);
91 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(SyncPage), &pModeData->pfnR0BthSyncPage);
92 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(SyncPage), rc), rc);
93 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(PrefetchPage), &pModeData->pfnR0BthPrefetchPage);
94 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(PrefetchPage), rc), rc);
95 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(VerifyAccessSyncPage), &pModeData->pfnR0BthVerifyAccessSyncPage);
96 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(VerifyAccessSyncPage), rc), rc);
97#ifdef VBOX_STRICT
98 rc = PDMR3GetSymbolR0(pVM, NULL, PGM_BTH_NAME_R0_STR(AssertCR3), &pModeData->pfnR0BthAssertCR3);
99 AssertMsgRCReturn(rc, ("%s -> rc=%Vrc\n", PGM_BTH_NAME_R0_STR(AssertCR3), rc), rc);
100#endif
101 }
102 return VINF_SUCCESS;
103}
104
105
106/**
107 * Enters the shadow+guest mode.
108 *
109 * @returns VBox status code.
110 * @param pVM VM handle.
111 * @param GCPhysCR3 The physical address from the CR3 register.
112 */
113PGM_BTH_DECL(int, Enter)(PVM pVM, RTGCPHYS GCPhysCR3)
114{
115 /* nothing special to do here - InitData does the job. */
116 return VINF_SUCCESS;
117}
118
119
120/**
121 * Relocate any GC pointers related to shadow mode paging.
122 *
123 * @returns VBox status code.
124 * @param pVM The VM handle.
125 * @param offDelta The reloation offset.
126 */
127PGM_BTH_DECL(int, Relocate)(PVM pVM, RTGCUINTPTR offDelta)
128{
129 /* nothing special to do here - InitData does the job. */
130 return VINF_SUCCESS;
131}
132
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