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.


added more 64 bit support,
[palacios.git] / palacios / src / palacios / vmm_shadow_paging.c
index 97dac47..c12b485 100644 (file)
@@ -82,6 +82,9 @@ int v3_init_shadow_page_state(struct guest_info * info) {
   state->guest_cr3 = 0;
   state->shadow_cr3 = 0;
 
+  state->guest_cr0 = 0;
+
+
 
   state->cr3_cache = create_hashtable(0, &cr3_hash_fn, &cr3_equals);
 
@@ -144,6 +147,16 @@ int cache_page_tables32(struct guest_info * info, addr_t pde) {
 }
 */
 
+
+int v3_cache_page_tables(struct guest_info * info, addr_t cr3) {
+  switch(v3_get_cpu_mode(info)) {
+  case PROTECTED:
+    return v3_cache_page_tables32(info, (addr_t)V3_PAddr((void *)CR3_TO_PDE32(cr3)));
+  default:
+    return -1;
+  }
+}
+
 int v3_cache_page_tables32(struct guest_info * info, addr_t pde) {
   struct shadow_page_state * state = &(info->shdw_pg_state);
   addr_t pde_host_addr;
@@ -225,6 +238,11 @@ int v3_handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_e
   
   if (info->mem_mode == PHYSICAL_MEM) {
     // If paging is not turned on we need to handle the special cases
+
+#ifdef DEBUG_SHADOW_PAGING
+    PrintPageTree(info->cpu_mode, fault_addr, info->ctrl_regs.cr3);
+#endif
+
     return handle_special_page_fault(info, fault_addr, fault_addr, error_code);
   } else if (info->mem_mode == VIRTUAL_MEM) {
 
@@ -244,7 +262,7 @@ int v3_handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_e
   }
 }
 
-addr_t v3_create_new_shadow_pt32() {
+addr_t v3_create_new_shadow_pt() {
   void * host_pde = 0;
 
   host_pde = V3_VAddr(V3_AllocPages(1));
@@ -418,7 +436,7 @@ static int handle_shadow_pagefault32(struct guest_info * info, addr_t fault_addr
   
   if (shadow_pde_access == PT_ENTRY_NOT_PRESENT) 
     {
-      pte32_t * shadow_pt =  (pte32_t *)v3_create_new_shadow_pt32();
+      pte32_t * shadow_pt =  (pte32_t *)v3_create_new_shadow_pt();
 
       shadow_pde->present = 1;
       shadow_pde->user_page = guest_pde->user_page;