X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fsvm_ctrl_regs.c;h=ffdd3def394b89717df06634ba7e15ea7549cf41;hb=8c38488bc7d510a85ad23222ddd228924d14be8a;hp=99d1f9474b5ec826deb8275d215aa45641eb54d5;hpb=4c17fb67c38120c141fa36bca9d7faa418b3c8e5;p=palacios.git diff --git a/palacios/src/geekos/svm_ctrl_regs.c b/palacios/src/geekos/svm_ctrl_regs.c index 99d1f94..ffdd3de 100644 --- a/palacios/src/geekos/svm_ctrl_regs.c +++ b/palacios/src/geekos/svm_ctrl_regs.c @@ -25,7 +25,7 @@ int handle_cr0_write(struct guest_info * info) { int ret; // The real rip address is actually a combination of the rip + CS base - ret = read_guest_pa_memory(info, (addr_t)guest_state->rip + (guest_state->cs.base << 4), 15, instr); + ret = read_guest_pa_memory(info, get_rip_linear(info, guest_state->rip, guest_state->cs.base), 15, instr); if (ret != 15) { // I think we should inject a GPF into the guest PrintDebug("Could not read instruction (ret=%d)\n", ret); @@ -117,7 +117,7 @@ int handle_cr0_write(struct guest_info * info) { PrintDebug("Protected Mode write to CR0\n"); // The real rip address is actually a combination of the rip + CS base - ret = read_guest_pa_memory(info, (addr_t)guest_state->rip + guest_state->cs.base, 15, instr); + ret = read_guest_pa_memory(info, get_rip_linear(info, guest_state->rip, guest_state->cs.base), 15, instr); if (ret != 0) { // I think we should inject a GPF into the guest PrintDebug("Could not read instruction (ret=%d)\n", ret); @@ -128,6 +128,8 @@ int handle_cr0_write(struct guest_info * info) { index++; } + + /* CHECK IF MOV_TO_CR CAN TAKE MEMORY OPERANDS... */ if ((instr[index] == cr_access_byte) && (instr[index + 1] == mov_to_cr_byte)) { @@ -198,7 +200,7 @@ int handle_cr0_read(struct guest_info * info) { int ret; // The real rip address is actually a combination of the rip + CS base - ret = read_guest_pa_memory(info, (addr_t)guest_state->rip + (guest_state->cs.base << 4), 15, instr); + ret = read_guest_pa_memory(info, get_rip_linear(info, guest_state->rip, guest_state->cs.base), 15, instr); if (ret != 15) { // I think we should inject a GPF into the guest PrintDebug("Could not read instruction (ret=%d)\n", ret); @@ -255,7 +257,7 @@ int handle_cr0_read(struct guest_info * info) { int ret; // The real rip address is actually a combination of the rip + CS base - ret = read_guest_pa_memory(info, (addr_t)guest_state->rip + guest_state->cs.base, 15, instr); + ret = read_guest_pa_memory(info, get_rip_linear(info, guest_state->rip, guest_state->cs.base), 15, instr); if (ret != 15) { // I think we should inject a GPF into the guest PrintDebug("Could not read instruction (ret=%d)\n", ret);