1 #include <geekos/svm_ctrl_regs.h>
2 #include <geekos/vmm_mem.h>
3 #include <geekos/vmm.h>
4 #include <geekos/vmcb.h>
5 #include <geekos/vmm_emulate.h>
8 int handle_cr0_write(struct guest_info * info, ullong_t * new_cr0) {
9 vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(info->vmm_data));
10 vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data));
16 if (info->cpu_mode == REAL) {
17 read_guest_pa_memory(info, (addr_t)guest_state->rip, 15, instr);
20 while (is_prefix_byte(instr[index])) {
24 if ((instr[index] == cr_access_byte) &&
25 (instr[index + 1] == lmsw_byte)) {
29 } else if ((instr[index] == cr_access_byte) &&
30 (instr[index + 1] == clts_byte)) {
33 // unsupported instruction, GPF the guest