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.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2011, Jack Lange <jacklange@cs.pitt.edu>
11 * All rights reserved.
13 * Author: Jack Lange <jacklange@cs.pitt.edu>
15 * This is free software. You are permitted to use,
16 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
26 #include <palacios/vmx_hw_info.h>
28 /* The actual format of these data structures is specified as being machine
29 dependent. Thus the lengths of the base address fields are defined as variable.
30 To be safe we assume the maximum(?) size fields
33 N is the physical-address width supported by the logical processor. Software can determine a processor's
34 physical-address width by executing CPUID with 80000008H in EAX. The physical address
35 width is returned in bits 7:0 of EAX.
39 struct ept_exit_qual {
50 uint64_t addr_valid : 1;
51 uint64_t addr_type : 1;
53 uint64_t nmi_unblock : 1;
55 } __attribute__((packed));
56 } __attribute__((packed));
57 } __attribute__((packed));
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 (?)*/
66 uint64_t pml_base_addr : 39;
68 } __attribute__((packed)) vmx_eptp_t;
71 typedef struct ept_pml4 {
77 uint64_t pdp_base_addr : 39;
79 uint64_t ignore2 : 12;
80 } __attribute__((packed)) ept_pml4_t;
83 typedef struct ept_pdp_1GB {
89 uint64_t large_page : 1;
92 uint64_t page_base_addr : 21;
94 uint64_t ignore2 : 12;
95 } __attribute__((packed)) ept_pdp_1GB_t;
97 typedef struct ept_pdp {
102 uint64_t large_page : 1;
103 uint64_t ignore1 : 4;
104 uint64_t pd_base_addr : 39;
106 uint64_t ignore2 : 12;
107 } __attribute__((packed)) ept_pdp_t;
110 typedef struct ept_pde_2MB {
116 uint64_t large_page : 1;
117 uint64_t ignore1 : 4;
119 uint64_t page_base_addr : 30;
121 uint64_t ignore2 : 12;
122 } __attribute__((packed)) ept_pde_2MB_t;
125 typedef struct ept_pde {
130 uint64_t large_page : 1;
131 uint64_t ignore1 : 4;
132 uint64_t pt_base_addr : 39;
134 uint64_t ignore2 : 12;
135 } __attribute__((packed)) ept_pde_t;
139 typedef struct ept_pte {
145 uint64_t ignore1 : 5;
146 uint64_t page_base_addr : 39;
148 uint64_t ignore2 : 12;
149 } __attribute__((packed)) ept_pte_t;
151 int v3_init_ept(struct guest_info * core, struct vmx_hw_info * hw_info);
152 int v3_handle_ept_fault(struct guest_info * core, addr_t fault_addr, struct ept_exit_qual * ept_qual);