1 #ifndef __VMM_CTRL_REGS_H
2 #define __VMM_CTRL_REGS_H
5 #include <palacios/vm_guest.h>
67 uint_t pdt_base_addr : 20;
75 uint_t pdpt_base_addr : 27;
84 ullong_t pml4t_base_addr : 40;
123 uint_t cf : 1; // carry flag
124 uint_t rsvd1 : 1; // Must be 1
125 uint_t pf : 1; // parity flag
126 uint_t rsvd2 : 1; // Read as 0
127 uint_t af : 1; // Auxillary flag
128 uint_t rsvd3 : 1; // Read as 0
129 uint_t zf : 1; // zero flag
130 uint_t sf : 1; // sign flag
131 uint_t tf : 1; // trap flag
132 uint_t intr : 1; // interrupt flag
133 uint_t df : 1; // direction flag
134 uint_t of : 1; // overflow flag
135 uint_t iopl : 2; // IO privilege level
136 uint_t nt : 1; // nested task
137 uint_t rsvd4 : 1; // read as 0
138 uint_t rf : 1; // resume flag
139 uint_t vm : 1; // Virtual-8086 mode
140 uint_t ac : 1; // alignment check
141 uint_t vif : 1; // virtual interrupt flag
142 uint_t vip : 1; // virtual interrupt pending
143 uint_t id : 1; // ID flag
144 uint_t rsvd5 : 10; // Read as 0
145 uint_t rsvd6 : 32; // Read as 0
153 static const uchar_t cr_access_byte = 0x0f;
155 // Second opcode byte
156 static const uchar_t lmsw_byte = 0x01;
157 static const uchar_t lmsw_reg_byte = 0x6;
158 static const uchar_t smsw_byte = 0x01;
159 static const uchar_t smsw_reg_byte = 0x4;
160 static const uchar_t clts_byte = 0x06;
161 static const uchar_t mov_to_cr_byte = 0x22;
162 static const uchar_t mov_from_cr_byte = 0x20;
166 int handle_cr0_write(struct guest_info * info);
167 int handle_cr0_read(struct guest_info * info);
169 int handle_cr3_write(struct guest_info * info);
170 int handle_cr3_read(struct guest_info * info);