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 page table deletion error
[palacios.git] / palacios / src / palacios / vmm_ctrl_regs.c
index d134043..0d29092 100644 (file)
@@ -1,7 +1,7 @@
 #include <palacios/vmm_mem.h>
 #include <palacios/vmm.h>
 #include <palacios/vmcb.h>
-#include <palacios/vmm_emulate.h>
+#include <palacios/vmm_decoder.h>
 #include <palacios/vm_guest_mem.h>
 #include <palacios/vmm_ctrl_regs.h>
 
@@ -106,7 +106,8 @@ int handle_cr0_write(struct guest_info * info) {
     } else if ((instr[index] == cr_access_byte) && 
               (instr[index + 1] == clts_byte)) {
       // CLTS
-
+      PrintDebug("CLTS unhandled\n");
+      return -1;
 
     } else if ((instr[index] == cr_access_byte) && 
               (instr[index + 1] = mov_to_cr_byte)) {
@@ -291,13 +292,14 @@ int handle_cr0_read(struct guest_info * info) {
        
        if (guest_pa_to_host_va(info, first_operand + (info->segments.ds.base << 4), &host_addr) == -1) {
          // gpf the guest
+         PrintDebug("Could not convert guest physical address to host virtual address\n");
          return -1;
        }
        
        first_operand = host_addr;
       } else {
-       // error... don't know what to do
-       return -1;
+       // Register operand
+       // Should be ok??
       }
 
       cr0_val = *(char*)cr0 & 0x0f;
@@ -411,6 +413,8 @@ int handle_cr3_write(struct guest_info * info) {
     int ret;
     char instr[15];
 
+
+    /* Isn't the RIP a Guest Virtual Address???????? */
     ret = read_guest_pa_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
     if (ret != 15) {
       PrintDebug("Could not read instruction (ret=%d)\n", ret);
@@ -446,13 +450,19 @@ int handle_cr3_write(struct guest_info * info) {
        struct cr3_32 * shadow_cr3 = (struct cr3_32 *)&(info->shdw_pg_state.shadow_cr3);
        struct cr3_32 * guest_cr3 = (struct cr3_32 *)&(info->shdw_pg_state.guest_cr3);
 
+       PrintDebug("fooo1\n");
+
+       /* Delete the current Page Tables */
+       delete_page_tables_pde32((pde32_t *)CR3_TO_PDE32(*(uint_t*)shadow_cr3));
 
+       PrintDebug("fooo2\n");
        *guest_cr3 = *new_cr3;
 
        // Something like this
        shadow_pt =  create_new_shadow_pt32(info);
        //shadow_pt = setup_shadow_pt32(info, CR3_TO_PDE32(*(addr_t *)new_cr3));
 
+
        /* Copy Various flags */
        *shadow_cr3 = *new_cr3;