X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fsvm_ctrl_regs.c;h=a0c5e1a8311926e54013bd53864d4b7155b6dafc;hb=959ed075fac59969a8dc299e51824166f50bb2d0;hp=656bb9eb87d8af00df734cfa7e81a0034ebcace6;hpb=8cb3daaded0d8c80be801aa74493006b5a06999f;p=palacios.git diff --git a/palacios/src/geekos/svm_ctrl_regs.c b/palacios/src/geekos/svm_ctrl_regs.c index 656bb9e..a0c5e1a 100644 --- a/palacios/src/geekos/svm_ctrl_regs.c +++ b/palacios/src/geekos/svm_ctrl_regs.c @@ -3,10 +3,10 @@ #include #include #include - +#include int handle_cr0_write(struct guest_info * info, ullong_t * new_cr0) { - vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(info->vmm_data)); + //vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(info->vmm_data)); vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data)); char instr[15]; @@ -18,13 +18,33 @@ int handle_cr0_write(struct guest_info * info, ullong_t * new_cr0) { int index = 0; while (is_prefix_byte(instr[index])) { + PrintDebug("instr(%d): 0x%x\n", index, instr[index]); index++; } - + PrintDebug("instr(%d): 0x%x\n", index, instr[index]); + PrintDebug("instr(%d): 0x%x\n", index+1, instr[index + 1]); + if ((instr[index] == cr_access_byte) && - (instr[index + 1] == lmsw_byte)) { + (instr[index + 1] == lmsw_byte) && + (MODRM_REG(instr[index + 2]) == lmsw_reg_byte)) { + + addr_t first_operand; + addr_t second_operand; + // LMSW // decode mod/RM + index += 2; + + + if (decode_operands16(&(info->vm_regs), instr + index, &first_operand, &second_operand, REG16) != 0) { + // error... don't know what to do + return -1; + } + + PrintDebug("FirstOperand addr: %x, RAX addr: %x\n", first_operand, &(info->vm_regs.rax)); + + + } else if ((instr[index] == cr_access_byte) && (instr[index + 1] == clts_byte)) {