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 format string issues due to printf attribute checks
[palacios.git] / palacios / src / palacios / vmm_ctrl_regs.c
index 94a8d85..e2ab2bc 100644 (file)
@@ -120,7 +120,7 @@ int v3_handle_cr0_write(struct guest_info * info) {
          
          if (v3_get_mem_mode(info) == VIRTUAL_MEM) {
            struct cr3_32 * shadow_cr3 = (struct cr3_32 *)&(info->shdw_pg_state.shadow_cr3);
-           
+           PrintDebug("Setting up Shadow Page Table\n");
            info->ctrl_regs.cr3 = *(addr_t*)shadow_cr3;
          } else  {
            info->ctrl_regs.cr3 = *(addr_t*)&(info->direct_map_pt);
@@ -261,25 +261,34 @@ int v3_handle_cr3_write(struct guest_info * info) {
                 *(uint_t*)shadow_cr3, *(uint_t*)guest_cr3);
       
 
-      cached = v3_cache_page_tables32(info, V3_PAddr((addr_t)CR3_TO_PDE32((void *)*(addr_t *)new_cr3)));
 
+      cached = v3_cache_page_tables32(info, (addr_t)V3_PAddr((void *)(addr_t)CR3_TO_PDE32((void *)*(addr_t *)new_cr3)));
+       
       if (cached == -1) {
        PrintError("CR3 Cache failed\n");
        return -1;
       } else if (cached == 0) {
        addr_t shadow_pt;
        
-       PrintDebug("New CR3 is different - flushing shadow page table\n");      
+       if( info->mem_mode == VIRTUAL_MEM )
+       {
+               PrintDebug("New CR3 is different - flushing shadow page table %p\n", shadow_cr3 );      
        
-       delete_page_tables_pde32((pde32_t *)CR3_TO_PDE32(*(uint_t*)shadow_cr3));
+               delete_page_tables_pde32((pde32_t *)CR3_TO_PDE32(*(uint_t*)shadow_cr3));
+       }
        
        shadow_pt =  v3_create_new_shadow_pt32();
        
        shadow_cr3->pdt_base_addr = (addr_t)V3_PAddr((void *)(addr_t)PD32_BASE_ADDR(shadow_pt));
+       PrintDebug( "Created new shadow page table %p\n", (void *)(addr_t)shadow_cr3->pdt_base_addr );
+       //PrintDebugPageTables( (pde32_t *)CR3_TO_PDE32(*(uint_t*)shadow_cr3) );
+
+
       } else {
        PrintDebug("Reusing cached shadow Page table\n");
       }
       
+      
       shadow_cr3->pwt = new_cr3->pwt;
       shadow_cr3->pcd = new_cr3->pcd;