1 | /* $Id: PGMGstDefs.h 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox - Page Manager, Guest Paging Template - All context code.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 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 GST_BIG_PAGE_SIZE
|
---|
31 | #undef GST_BIG_PAGE_OFFSET_MASK
|
---|
32 | #undef GST_PDE_PG_MASK
|
---|
33 | #undef GST_PDE_BIG_PG_MASK
|
---|
34 | #undef GST_PD_SHIFT
|
---|
35 | #undef GST_PD_MASK
|
---|
36 | #undef GST_PTE_PG_MASK
|
---|
37 | #undef GST_PT_SHIFT
|
---|
38 | #undef GST_PT_MASK
|
---|
39 | #undef GST_TOTAL_PD_ENTRIES
|
---|
40 | #undef GST_CR3_PAGE_MASK
|
---|
41 | #undef GST_PDPE_ENTRIES
|
---|
42 | #undef GST_PDPT_SHIFT
|
---|
43 | #undef GST_PDPT_MASK
|
---|
44 | #undef GST_PDPE_PG_MASK
|
---|
45 | #undef GST_GET_PDE_BIG_PG_GCPHYS
|
---|
46 |
|
---|
47 | #if PGM_GST_TYPE == PGM_TYPE_REAL \
|
---|
48 | || PGM_GST_TYPE == PGM_TYPE_PROT
|
---|
49 |
|
---|
50 | # if PGM_SHW_TYPE == PGM_TYPE_EPT
|
---|
51 | # define GSTPT X86PTPAE
|
---|
52 | # define PGSTPT PX86PTPAE
|
---|
53 | # define GSTPTE X86PTEPAE
|
---|
54 | # define PGSTPTE PX86PTEPAE
|
---|
55 | # define GSTPD X86PDPAE
|
---|
56 | # define PGSTPD PX86PDPAE
|
---|
57 | # define GSTPDE X86PDEPAE
|
---|
58 | # define PGSTPDE PX86PDEPAE
|
---|
59 | # define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK
|
---|
60 | # else
|
---|
61 | # define GSTPT SHWPT
|
---|
62 | # define PGSTPT PSHWPT
|
---|
63 | # define GSTPTE SHWPTE
|
---|
64 | # define PGSTPTE PSHWPTE
|
---|
65 | # define GSTPD SHWPD
|
---|
66 | # define PGSTPD PSHWPD
|
---|
67 | # define GSTPDE SHWPDE
|
---|
68 | # define PGSTPDE PSHWPDE
|
---|
69 | # define GST_PTE_PG_MASK SHW_PTE_PG_MASK
|
---|
70 | # endif
|
---|
71 | #elif PGM_GST_TYPE == PGM_TYPE_32BIT
|
---|
72 | # define GSTPT X86PT
|
---|
73 | # define PGSTPT PX86PT
|
---|
74 | # define GSTPTE X86PTE
|
---|
75 | # define PGSTPTE PX86PTE
|
---|
76 | # define GSTPD X86PD
|
---|
77 | # define PGSTPD PX86PD
|
---|
78 | # define GSTPDE X86PDE
|
---|
79 | # define PGSTPDE PX86PDE
|
---|
80 | # define GST_BIG_PAGE_SIZE X86_PAGE_4M_SIZE
|
---|
81 | # define GST_BIG_PAGE_OFFSET_MASK X86_PAGE_4M_OFFSET_MASK
|
---|
82 | # define GST_PDE_PG_MASK X86_PDE_PG_MASK
|
---|
83 | # define GST_PDE_BIG_PG_MASK X86_PDE4M_PG_MASK
|
---|
84 | # define GST_GET_PDE_BIG_PG_GCPHYS(PdeGst) pgmGstGet4MBPhysPage(&pVM->pgm.s, PdeGst)
|
---|
85 | # define GST_PD_SHIFT X86_PD_SHIFT
|
---|
86 | # define GST_PD_MASK X86_PD_MASK
|
---|
87 | # define GST_TOTAL_PD_ENTRIES X86_PG_ENTRIES
|
---|
88 | # define GST_PTE_PG_MASK X86_PTE_PG_MASK
|
---|
89 | # define GST_PT_SHIFT X86_PT_SHIFT
|
---|
90 | # define GST_PT_MASK X86_PT_MASK
|
---|
91 | # define GST_CR3_PAGE_MASK X86_CR3_PAGE_MASK
|
---|
92 |
|
---|
93 | #elif PGM_GST_TYPE == PGM_TYPE_PAE \
|
---|
94 | || PGM_GST_TYPE == PGM_TYPE_AMD64
|
---|
95 | # define GSTPT X86PTPAE
|
---|
96 | # define PGSTPT PX86PTPAE
|
---|
97 | # define GSTPTE X86PTEPAE
|
---|
98 | # define PGSTPTE PX86PTEPAE
|
---|
99 | # define GSTPD X86PDPAE
|
---|
100 | # define PGSTPD PX86PDPAE
|
---|
101 | # define GSTPDE X86PDEPAE
|
---|
102 | # define PGSTPDE PX86PDEPAE
|
---|
103 | # define GST_BIG_PAGE_SIZE X86_PAGE_2M_SIZE
|
---|
104 | # define GST_BIG_PAGE_OFFSET_MASK X86_PAGE_2M_OFFSET_MASK
|
---|
105 | # define GST_PDE_PG_MASK X86_PDE_PAE_PG_MASK_FULL
|
---|
106 | # define GST_PDE_BIG_PG_MASK X86_PDE2M_PAE_PG_MASK
|
---|
107 | # define GST_GET_PDE_BIG_PG_GCPHYS(PdeGst) (PdeGst.u & GST_PDE_BIG_PG_MASK)
|
---|
108 | # define GST_PD_SHIFT X86_PD_PAE_SHIFT
|
---|
109 | # define GST_PD_MASK X86_PD_PAE_MASK
|
---|
110 | # if PGM_GST_TYPE == PGM_TYPE_PAE
|
---|
111 | # define GST_TOTAL_PD_ENTRIES (X86_PG_PAE_ENTRIES * X86_PG_PAE_PDPE_ENTRIES)
|
---|
112 | # define GST_PDPE_ENTRIES X86_PG_PAE_PDPE_ENTRIES
|
---|
113 | # define GST_PDPE_PG_MASK X86_PDPE_PG_MASK_FULL
|
---|
114 | # define GST_PDPT_SHIFT X86_PDPT_SHIFT
|
---|
115 | # define GST_PDPT_MASK X86_PDPT_MASK_PAE
|
---|
116 | # define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK
|
---|
117 | # define GST_CR3_PAGE_MASK X86_CR3_PAE_PAGE_MASK
|
---|
118 | # else
|
---|
119 | # define GST_TOTAL_PD_ENTRIES (X86_PG_AMD64_ENTRIES * X86_PG_AMD64_PDPE_ENTRIES)
|
---|
120 | # define GST_PDPE_ENTRIES X86_PG_AMD64_PDPE_ENTRIES
|
---|
121 | # define GST_PDPT_SHIFT X86_PDPT_SHIFT
|
---|
122 | # define GST_PDPE_PG_MASK X86_PDPE_PG_MASK_FULL
|
---|
123 | # define GST_PDPT_MASK X86_PDPT_MASK_AMD64
|
---|
124 | # define GST_PTE_PG_MASK X86_PTE_PAE_PG_MASK_FULL
|
---|
125 | # define GST_CR3_PAGE_MASK X86_CR3_AMD64_PAGE_MASK
|
---|
126 | # endif
|
---|
127 | # define GST_PT_SHIFT X86_PT_PAE_SHIFT
|
---|
128 | # define GST_PT_MASK X86_PT_PAE_MASK
|
---|
129 | #endif
|
---|
130 |
|
---|