1 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
2 /* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
4 #ifndef __VMM_CTRL_REGS_H
5 #define __VMM_CTRL_REGS_H
10 #include <palacios/vm_guest.h>
72 uint_t pdt_base_addr : 20;
80 uint_t pdpt_base_addr : 27;
89 ullong_t pml4t_base_addr : 40;
129 uint_t rsvd1 : 7; // RAZ
131 uint_t rsvd2 : 1; // MBZ
135 uint_t rsvd3 : 1; // MBZ
137 uint_t rsvd4 : 12; // MBZ
138 uint_t rsvd5 : 32; // MBZ
143 uint_t cf : 1; // carry flag
144 uint_t rsvd1 : 1; // Must be 1
145 uint_t pf : 1; // parity flag
146 uint_t rsvd2 : 1; // Read as 0
147 uint_t af : 1; // Auxillary flag
148 uint_t rsvd3 : 1; // Read as 0
149 uint_t zf : 1; // zero flag
150 uint_t sf : 1; // sign flag
151 uint_t tf : 1; // trap flag
152 uint_t intr : 1; // interrupt flag
153 uint_t df : 1; // direction flag
154 uint_t of : 1; // overflow flag
155 uint_t iopl : 2; // IO privilege level
156 uint_t nt : 1; // nested task
157 uint_t rsvd4 : 1; // read as 0
158 uint_t rf : 1; // resume flag
159 uint_t vm : 1; // Virtual-8086 mode
160 uint_t ac : 1; // alignment check
161 uint_t vif : 1; // virtual interrupt flag
162 uint_t vip : 1; // virtual interrupt pending
163 uint_t id : 1; // ID flag
164 uint_t rsvd5 : 10; // Read as 0
165 uint_t rsvd6 : 32; // Read as 0
174 static const uchar_t cr_access_byte = 0x0f;
176 // Second opcode byte
177 static const uchar_t lmsw_byte = 0x01;
178 static const uchar_t lmsw_reg_byte = 0x6;
179 static const uchar_t smsw_byte = 0x01;
180 static const uchar_t smsw_reg_byte = 0x4;
181 static const uchar_t clts_byte = 0x06;
182 static const uchar_t mov_to_cr_byte = 0x22;
183 static const uchar_t mov_from_cr_byte = 0x20;
187 int handle_cr0_write(struct guest_info * info);
188 int handle_cr0_read(struct guest_info * info);
190 int handle_cr3_write(struct guest_info * info);
191 int handle_cr3_read(struct guest_info * info);
194 #endif // ! __V3VEE__