Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Refactoring and additions to direct paging (nested and passthrough)
[palacios.git] / palacios / include / palacios / vmx_ept.h
1 /* 
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2011, Jack Lange <jacklange@cs.pitt.edu> 
11  * All rights reserved.
12  *
13  * Author: Jack Lange <jacklange@cs.pitt.edu>
14  *
15  * This is free software.  You are permitted to use,
16  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
17  */
18
19
20 #ifndef __VMX_EPT_H__
21 #define __VMX_EPT_H__
22
23
24 #ifdef __V3VEE__
25
26 #include <palacios/vmx_hw_info.h>
27
28
29 /* The actual format of these data structures is specified as being machine 
30    dependent. Thus the lengths of the base address fields are defined as variable. 
31    To be safe we assume the maximum(?) size fields 
32
33    From Intel Manual...
34    N is the physical-address width supported by the logical processor. Software can determine a processor's
35    physical-address width by executing CPUID with 80000008H in EAX. The physical address
36    width is returned in bits 7:0 of EAX.
37 */
38
39
40 struct ept_exit_qual {
41     union {
42         uint64_t value;
43         struct {
44             uint64_t rd_op       : 1;
45             uint64_t wr_op       : 1;
46             uint64_t ifetch      : 1;
47             uint64_t present     : 1;
48             uint64_t write       : 1;
49             uint64_t exec        : 1;
50             uint64_t rsvd1       : 1;
51             uint64_t addr_valid  : 1;
52             uint64_t addr_type   : 1;
53             uint64_t rsvd2       : 1;
54             uint64_t nmi_unblock : 1;
55             uint64_t rsvd3      : 53;
56         } __attribute__((packed));
57     } __attribute__((packed));
58 } __attribute__((packed));
59
60
61
62 typedef struct vmx_eptp {
63     uint64_t psmt            : 3; /* (0=UC, 6=WB) */
64     uint64_t pwl1            : 3; /* 1 less than EPT page-walk length (?)*/
65     uint64_t rsvd1           : 6;
66     uint64_t pml_base_addr  : 39; 
67     uint16_t rsvd2          : 13;
68 } __attribute__((packed)) vmx_eptp_t;
69
70
71 typedef struct ept_pml4 {
72     uint64_t read            : 1;
73     uint64_t write           : 1;
74     uint64_t exec            : 1;
75     uint64_t rsvd1           : 5;
76     uint64_t ignore1         : 4;
77     uint64_t pdp_base_addr  : 39;
78     uint64_t rsvd2           : 1;
79     uint64_t ignore2        : 12;
80 } __attribute__((packed)) ept_pml4_t;
81
82
83 typedef struct ept_pdp_1GB {
84     uint64_t read            : 1;
85     uint64_t write           : 1;
86     uint64_t exec            : 1;
87     uint64_t mt              : 3;
88     uint64_t ipat            : 1;
89     uint64_t large_page      : 1;
90     uint64_t ignore1         : 4;
91     uint64_t rsvd1          : 18;
92     uint64_t page_base_addr : 21;
93     uint64_t rsvd2           : 1;
94     uint64_t ignore2        : 12;
95 } __attribute__((packed)) ept_pdp_1GB_t;
96
97 typedef struct ept_pdp {
98     uint64_t read            : 1;
99     uint64_t write           : 1;
100     uint64_t exec            : 1;
101     uint64_t rsvd1           : 4;
102     uint64_t large_page      : 1;
103     uint64_t ignore1         : 4;
104     uint64_t pd_base_addr   : 39;
105     uint64_t rsvd2           : 1;
106     uint64_t ignore2        : 12;
107 } __attribute__((packed)) ept_pdp_t;
108
109
110 typedef struct ept_pde_2MB {
111     uint64_t read            : 1;
112     uint64_t write           : 1;
113     uint64_t exec            : 1;
114     uint64_t mt              : 3;
115     uint64_t ipat            : 1;
116     uint64_t large_page      : 1;
117     uint64_t ignore1         : 4;
118     uint64_t rsvd1          : 9;
119     uint64_t page_base_addr : 30;
120     uint64_t rsvd2           : 1;
121     uint64_t ignore2        : 12;
122 } __attribute__((packed)) ept_pde_2MB_t;
123
124
125 typedef struct ept_pde {
126     uint64_t read            : 1;
127     uint64_t write           : 1;
128     uint64_t exec            : 1;
129     uint64_t rsvd1           : 4;
130     uint64_t large_page      : 1;
131     uint64_t ignore1         : 4;
132     uint64_t pt_base_addr   : 39;
133     uint64_t rsvd2           : 1;
134     uint64_t ignore2        : 12;
135 } __attribute__((packed)) ept_pde_t;
136
137
138
139 typedef struct ept_pte {
140     uint64_t read            : 1;
141     uint64_t write           : 1;
142     uint64_t exec            : 1;
143     uint64_t mt              : 3;
144     uint64_t ipat            : 1;
145     uint64_t ignore1         : 5;
146     uint64_t page_base_addr  : 39;
147     uint64_t rsvd2           : 1;
148     uint64_t ignore2         : 12;
149 } __attribute__((packed)) ept_pte_t;
150
151
152
153 #endif 
154
155 #endif
156