Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


fixed crash issue due to inproperly saving host state
[palacios.git] / palacios / src / palacios / vm_guest.c
index 1eee109..be9778c 100644 (file)
@@ -23,6 +23,7 @@
 #include <palacios/vm_guest.h>
 #include <palacios/vmm_ctrl_regs.h>
 #include <palacios/vmm.h>
+#include <palacios/vmm_decoder.h>
 #include <palacios/vmcb.h>
 
 
@@ -35,7 +36,7 @@ v3_cpu_mode_t v3_get_vm_cpu_mode(struct guest_info * info) {
 
     if (info->shdw_pg_mode == SHADOW_PAGING) {
        cr0 = (struct cr0_32 *)&(info->shdw_pg_state.guest_cr0);
-       efer = (struct efer_64 *)&(info->guest_efer);
+       efer = (struct efer_64 *)&(info->shdw_pg_state.guest_efer);
     } else if (info->shdw_pg_mode == NESTED_PAGING) {
        cr0 = (struct cr0_32 *)&(info->ctrl_regs.cr0);
        efer = (struct efer_64 *)&(guest_state->efer);
@@ -69,7 +70,7 @@ uint_t v3_get_addr_width(struct guest_info * info) {
 
     if (info->shdw_pg_mode == SHADOW_PAGING) {
        cr0 = (struct cr0_32 *)&(info->shdw_pg_state.guest_cr0);
-       efer = (struct efer_64 *)&(info->guest_efer);
+       efer = (struct efer_64 *)&(info->shdw_pg_state.guest_efer);
     } else if (info->shdw_pg_mode == NESTED_PAGING) {
        cr0 = (struct cr0_32 *)&(info->ctrl_regs.cr0);
        efer = (struct efer_64 *)&(guest_state->efer);
@@ -183,7 +184,7 @@ void v3_print_ctrl_regs(struct guest_info * info) {
     char * reg_names[] = {"CR0", "CR2", "CR3", "CR4", "CR8", "FLAGS", NULL};
     vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA(info->vmm_data);
 
-    reg_ptr= (v3_reg_t *)regs;
+    reg_ptr = (v3_reg_t *)regs;
 
     PrintDebug("32 bit Ctrl Regs:\n");
 
@@ -196,6 +197,27 @@ void v3_print_ctrl_regs(struct guest_info * info) {
 }
 
 
+void v3_print_guest_state(struct guest_info * info) {
+    addr_t linear_addr = 0; 
+
+    PrintDebug("RIP: %p\n", (void *)(addr_t)(info->rip));
+    linear_addr = get_addr_linear(info, info->rip, &(info->segments.cs));
+    PrintDebug("RIP Linear: %p\n", (void *)linear_addr);
+
+    v3_print_segments(info);
+    v3_print_ctrl_regs(info);
+
+    if (info->shdw_pg_mode == SHADOW_PAGING) {
+       PrintDebug("Shadow Paging Guest Registers:\n");
+       PrintDebug("\tGuest CR0=%p\n", (void *)(addr_t)(info->shdw_pg_state.guest_cr0));
+       PrintDebug("\tGuest CR3=%p\n", (void *)(addr_t)(info->shdw_pg_state.guest_cr3));
+       PrintDebug("\tGuest EFER=%p\n", (void *)(addr_t)(info->shdw_pg_state.guest_efer.value));
+       // CR4
+    }
+    v3_print_GPRs(info);
+}
+
+
 #ifdef __V3_32BIT__
 void v3_print_GPRs(struct guest_info * info) {
     struct v3_gprs * regs = &(info->vm_regs);