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.


32bit Write Hook Case for Direct Paging
Steven Jaconette [Fri, 6 Feb 2009 20:30:18 +0000 (14:30 -0600)]
palacios/src/palacios/vmm_direct_paging.c
palacios/src/palacios/vmm_direct_paging_32.h

index 55bf30d..c197c4c 100644 (file)
@@ -12,9 +12,7 @@ pde32_t * v3_create_direct_passthrough_pts(struct guest_info * info) {
   v3_vm_cpu_mode_t mode = v3_get_cpu_mode(info);
   switch(mode) {
     case REAL:
-      //break;
     case PROTECTED:
-      PrintError("ABC\n");
       return v3_create_direct_passthrough_pts_32(info);
     case PROTECTED_PAE:
       break;
@@ -33,7 +31,6 @@ int v3_handle_shadow_pagefault_physical_mode(struct guest_info * info, addr_t fa
   v3_vm_cpu_mode_t mode = v3_get_cpu_mode(info);
   switch(mode) {
     case REAL:
-      // break;
     case PROTECTED:
       return v3_handle_shadow_pagefault_physical_mode_32(info, fault_addr, error_code);
     case PROTECTED_PAE:
index 625abab..d075e74 100644 (file)
@@ -40,6 +40,7 @@ static inline int v3_handle_shadow_pagefault_physical_mode_32(struct guest_info
     pte32_t * pte = create_pte32();
     addr_t host_addr;
     if(guest_pa_to_host_pa(info, fault_addr, &host_addr) == -1) return -1;
+    struct v3_shadow_region * region =  v3_get_shadow_region(info, PAGE_BASE_ADDR(host_addr));
       pte[pte_index].present = 1;
       pte[pte_index].writable = 1;
       pte[pte_index].user_page = 1;
@@ -49,6 +50,9 @@ static inline int v3_handle_shadow_pagefault_physical_mode_32(struct guest_info
       pde[pde_index].writable = 1;
       pde[pde_index].user_page = 1;
       pde[pde_index].pt_base_addr = PAGE_BASE_ADDR((addr_t)V3_PAddr(pte));
+      if(region->host_type == SHDW_REGION_WRITE_HOOK) {
+       pte[pte_index].writable = 0;
+      }
       PrintError("Fault Addr: 0x%p\nHost Addr: 0x%p\n", (void*)fault_addr, (void*)host_addr);
     }
     else {
@@ -56,10 +60,14 @@ static inline int v3_handle_shadow_pagefault_physical_mode_32(struct guest_info
       if(pte[pte_index].present != 1) {
        addr_t host_addr;
        if(guest_pa_to_host_pa(info, fault_addr, &host_addr) == -1) return -1;
+       struct v3_shadow_region * region =  v3_get_shadow_region(info, PAGE_BASE_ADDR(host_addr));
        pte[pte_index].present = 1;
        pte[pte_index].writable = 1;
        pte[pte_index].user_page = 1;
        pte[pte_index].page_base_addr = PAGE_BASE_ADDR(host_addr);
+       if(region->host_type == SHDW_REGION_WRITE_HOOK) {
+         pte[pte_index].writable = 0;
+       }
       }
     }
     return 0;