VirtualBox

source: vbox/trunk/src/VBox/VMM/PGMGstDefs.h@ 31816

Last change on this file since 31816 was 31775, checked in by vboxsync, 14 years ago

PGM: Wrap up all access to PAE/LM PTEs so that we can treat the invalid entries used by PGM_WITH_MMIO_OPTIMIZATIONS as not-present.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.1 KB
Line 
1/* $Id: PGMGstDefs.h 31775 2010-08-19 09:48:24Z vboxsync $ */
2/** @file
3 * VBox - Page Manager, Guest Paging Template - All context code.
4 */
5
6/*
7 * Copyright (C) 2006-2010 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* Defined Constants And Macros *
21*******************************************************************************/
22#undef GSTPT
23#undef PGSTPT
24#undef GSTPTE
25#undef PGSTPTE
26#undef GSTPD
27#undef PGSTPD
28#undef GSTPDE
29#undef PGSTPDE
30#undef GSTPTWALK
31#undef PGSTPTWALK
32#undef PCGSTPTWALK
33#undef GST_BIG_PAGE_SIZE
34#undef GST_BIG_PAGE_OFFSET_MASK
35#undef GST_PDE_PG_MASK
36#undef GST_PDE_BIG_PG_MASK
37#undef GST_PD_SHIFT
38#undef GST_PD_MASK
39#undef GST_PTE_PG_MASK
40#undef GST_PT_SHIFT
41#undef GST_PT_MASK
42#undef GST_TOTAL_PD_ENTRIES
43#undef GST_CR3_PAGE_MASK
44#undef GST_PDPE_ENTRIES
45#undef GST_PDPT_SHIFT
46#undef GST_PDPT_MASK
47#undef GST_PDPE_PG_MASK
48#undef GST_GET_PDE_BIG_PG_GCPHYS
49#undef GST_IS_PTE_VALID
50#undef GST_IS_PDE_VALID
51#undef GST_IS_BIG_PDE_VALID
52#undef GST_IS_PDPE_VALID
53#undef GST_IS_BIG_PDPE_VALID
54#undef GST_IS_PML4E_VALID
55#undef GST_IS_PSE_ACTIVE
56#undef GST_IS_NX_ACTIVE
57#undef BTH_IS_NP_ACTIVE
58
59#if PGM_GST_TYPE == PGM_TYPE_REAL \
60 || PGM_GST_TYPE == PGM_TYPE_PROT
61
62# if PGM_SHW_TYPE == PGM_TYPE_EPT
63# define GSTPT X86PTPAE
64# define PGSTPT PX86PTPAE
65# define GSTPTE X86PTEPAE
66# define PGSTPTE PX86PTEPAE
67# define GSTPD X86PDPAE
68# define PGSTPD PX86PDPAE
69# define GSTPDE X86PDEPAE
70# define PGSTPDE PX86PDEPAE
71# define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK
72# define GST_IS_NX_ACTIVE(pVCpu) (true && This_should_perhaps_not_be_used_in_this_context)
73# define BTH_IS_NP_ACTIVE(pVM) (true)
74# else
75# if PGM_SHW_TYPE == PGM_TYPE_32BIT /* Same as shadow paging, but no PGMSHWPTEPAE. */
76# define GSTPT X86PT
77# define PGSTPT PX86PT
78# define GSTPTE X86PTE
79# define PGSTPTE PX86PTE
80# define GSTPD X86PD
81# define PGSTPD PX86PD
82# define GSTPDE X86PDE
83# define PGSTPDE PX86PDE
84# define GST_PTE_PG_MASK X86_PTE_PG_MASK
85# else
86# define GSTPT X86PTPAE
87# define PGSTPT PX86PTPAE
88# define GSTPTE X86PTEPAE
89# define PGSTPTE PX86PTEPAE
90# define GSTPD X86PDPAE
91# define PGSTPD PX86PDPAE
92# define GSTPDE X86PDEPAE
93# define PGSTPDE PX86PDEPAE
94# define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK
95# endif
96# define GST_IS_NX_ACTIVE(pVCpu) (pgmGstIsNoExecuteActive(pVCpu))
97# if PGM_GST_TYPE == PGM_TYPE_PROT /* (comment at top of PGMAllBth.h) */
98# define BTH_IS_NP_ACTIVE(pVM) (pVM->pgm.s.fNestedPaging)
99# else
100# define BTH_IS_NP_ACTIVE(pVM) (false)
101# endif
102# endif
103# define GST_IS_PTE_VALID(pVCpu, Pte) (true)
104# define GST_IS_PDE_VALID(pVCpu, Pde) (true)
105# define GST_IS_BIG_PDE_VALID(pVCpu, Pde) (true)
106# define GST_IS_PDPE_VALID(pVCpu, Pdpe) (true)
107# define GST_IS_BIG_PDPE_VALID(pVCpu, Pdpe) (true)
108# define GST_IS_PML4E_VALID(pVCpu, Pml4e) (true)
109# define GST_IS_PSE_ACTIVE(pVCpu) (false && This_should_not_be_used_in_this_context)
110
111#elif PGM_GST_TYPE == PGM_TYPE_32BIT
112# define GSTPT X86PT
113# define PGSTPT PX86PT
114# define GSTPTE X86PTE
115# define PGSTPTE PX86PTE
116# define GSTPD X86PD
117# define PGSTPD PX86PD
118# define GSTPDE X86PDE
119# define PGSTPDE PX86PDE
120# define GSTPTWALK PGMPTWALKGST32BIT
121# define PGSTPTWALK PPGMPTWALKGST32BIT
122# define PCGSTPTWALK PCPGMPTWALKGST32BIT
123# define GST_BIG_PAGE_SIZE X86_PAGE_4M_SIZE
124# define GST_BIG_PAGE_OFFSET_MASK X86_PAGE_4M_OFFSET_MASK
125# define GST_PDE_PG_MASK X86_PDE_PG_MASK
126# define GST_PDE_BIG_PG_MASK X86_PDE4M_PG_MASK
127# define GST_GET_PDE_BIG_PG_GCPHYS(pVM, PdeGst) pgmGstGet4MBPhysPage(&(pVM)->pgm.s, PdeGst)
128# define GST_PD_SHIFT X86_PD_SHIFT
129# define GST_PD_MASK X86_PD_MASK
130# define GST_TOTAL_PD_ENTRIES X86_PG_ENTRIES
131# define GST_PTE_PG_MASK X86_PTE_PG_MASK
132# define GST_PT_SHIFT X86_PT_SHIFT
133# define GST_PT_MASK X86_PT_MASK
134# define GST_CR3_PAGE_MASK X86_CR3_PAGE_MASK
135# define GST_IS_PTE_VALID(pVCpu, Pte) (true)
136# define GST_IS_PDE_VALID(pVCpu, Pde) (true)
137# define GST_IS_BIG_PDE_VALID(pVCpu, Pde) (!( (Pde).u & (pVCpu)->pgm.s.fGst32BitMbzBigPdeMask ))
138//# define GST_IS_PDPE_VALID(pVCpu, Pdpe) (false)
139//# define GST_IS_BIG_PDPE_VALID(pVCpu, Pdpe) (false)
140//# define GST_IS_PML4E_VALID(pVCpu, Pml4e) (false)
141# define GST_IS_PSE_ACTIVE(pVCpu) pgmGst32BitIsPageSizeExtActive(pVCpu)
142# define GST_IS_NX_ACTIVE(pVCpu) (false)
143# define BTH_IS_NP_ACTIVE(pVM) (false)
144
145#elif PGM_GST_TYPE == PGM_TYPE_PAE \
146 || PGM_GST_TYPE == PGM_TYPE_AMD64
147# define GSTPT X86PTPAE
148# define PGSTPT PX86PTPAE
149# define GSTPTE X86PTEPAE
150# define PGSTPTE PX86PTEPAE
151# define GSTPD X86PDPAE
152# define PGSTPD PX86PDPAE
153# define GSTPDE X86PDEPAE
154# define PGSTPDE PX86PDEPAE
155# define GST_BIG_PAGE_SIZE X86_PAGE_2M_SIZE
156# define GST_BIG_PAGE_OFFSET_MASK X86_PAGE_2M_OFFSET_MASK
157# define GST_PDE_PG_MASK X86_PDE_PAE_PG_MASK_FULL
158# define GST_PDE_BIG_PG_MASK X86_PDE2M_PAE_PG_MASK
159# define GST_GET_PDE_BIG_PG_GCPHYS(pVM, PdeGst) ((PdeGst).u & GST_PDE_BIG_PG_MASK)
160# define GST_PD_SHIFT X86_PD_PAE_SHIFT
161# define GST_PD_MASK X86_PD_PAE_MASK
162# if PGM_GST_TYPE == PGM_TYPE_PAE
163# define GSTPTWALK PGMPTWALKGSTPAE
164# define PGSTPTWALK PPGMPTWALKGSTPAE
165# define PCGSTPTWALK PCPGMPTWALKGSTPAE
166# define GST_TOTAL_PD_ENTRIES (X86_PG_PAE_ENTRIES * X86_PG_PAE_PDPE_ENTRIES)
167# define GST_PDPE_ENTRIES X86_PG_PAE_PDPE_ENTRIES
168# define GST_PDPE_PG_MASK X86_PDPE_PG_MASK_FULL
169# define GST_PDPT_SHIFT X86_PDPT_SHIFT
170# define GST_PDPT_MASK X86_PDPT_MASK_PAE
171# define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK
172# define GST_CR3_PAGE_MASK X86_CR3_PAE_PAGE_MASK
173# define GST_IS_PTE_VALID(pVCpu, Pte) (!( (Pte).u & (pVCpu)->pgm.s.fGstPaeMbzPteMask ))
174# define GST_IS_PDE_VALID(pVCpu, Pde) (!( (Pde).u & (pVCpu)->pgm.s.fGstPaeMbzPdeMask ))
175# define GST_IS_BIG_PDE_VALID(pVCpu, Pde) (!( (Pde).u & (pVCpu)->pgm.s.fGstPaeMbzBigPdeMask ))
176# define GST_IS_PDPE_VALID(pVCpu, Pdpe) (!( (Pdpe).u & (pVCpu)->pgm.s.fGstPaeMbzPdpeMask ))
177//# define GST_IS_BIG_PDPE_VALID(pVCpu, Pdpe) (false)
178//# define GST_IS_PML4E_VALID(pVCpu, Pml4e) (false)
179# else
180# define GSTPTWALK PGMPTWALKGSTAMD64
181# define PGSTPTWALK PPGMPTWALKGSTAMD64
182# define PCGSTPTWALK PCPGMPTWALKGSTAMD64
183# define GST_TOTAL_PD_ENTRIES (X86_PG_AMD64_ENTRIES * X86_PG_AMD64_PDPE_ENTRIES)
184# define GST_PDPE_ENTRIES X86_PG_AMD64_PDPE_ENTRIES
185# define GST_PDPT_SHIFT X86_PDPT_SHIFT
186# define GST_PDPE_PG_MASK X86_PDPE_PG_MASK_FULL
187# define GST_PDPT_MASK X86_PDPT_MASK_AMD64
188# define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK_FULL
189# define GST_CR3_PAGE_MASK X86_CR3_AMD64_PAGE_MASK
190# define GST_IS_PTE_VALID(pVCpu, Pte) (!( (Pte).u & (pVCpu)->pgm.s.fGstAmd64MbzPteMask ))
191# define GST_IS_PDE_VALID(pVCpu, Pde) (!( (Pde).u & (pVCpu)->pgm.s.fGstAmd64MbzPdeMask ))
192# define GST_IS_BIG_PDE_VALID(pVCpu, Pde) (!( (Pde).u & (pVCpu)->pgm.s.fGstAmd64MbzBigPdeMask ))
193# define GST_IS_PDPE_VALID(pVCpu, Pdpe) (!( (Pdpe).u & (pVCpu)->pgm.s.fGstAmd64MbzPdpeMask ))
194# define GST_IS_BIG_PDPE_VALID(pVCpu, Pdpe) (!( (Pdpe).u & (pVCpu)->pgm.s.fGstAmd64MbzBigPdpeMask ))
195# define GST_IS_PML4E_VALID(pVCpu, Pml4e) (!( (Pml4e).u & (pVCpu)->pgm.s.fGstAmd64MbzPml4eMask ))
196# endif
197# define GST_PT_SHIFT X86_PT_PAE_SHIFT
198# define GST_PT_MASK X86_PT_PAE_MASK
199# define GST_IS_PSE_ACTIVE(pVCpu) (true)
200# define GST_IS_NX_ACTIVE(pVCpu) (pgmGstIsNoExecuteActive(pVCpu))
201# define BTH_IS_NP_ACTIVE(pVM) (false)
202#endif
203
204
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