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.


more namespace changes
[palacios.git] / palacios / src / palacios / vmm_shadow_paging.c
index e9a8cff..cca1e0f 100644 (file)
@@ -1,5 +1,22 @@
-/* Northwestern University */
-/* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
+/* 
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
 
 #include <palacios/vmm_shadow_paging.h>
 
@@ -59,7 +76,7 @@ static int handle_shadow_pte32_fault(struct guest_info* info,
 
 static int handle_shadow_pagefault32(struct guest_info * info, addr_t fault_addr, pf_error_t error_code);
 
-int init_shadow_page_state(struct guest_info * info) {
+int v3_init_shadow_page_state(struct guest_info * info) {
   struct shadow_page_state * state = &(info->shdw_pg_state);
   state->guest_mode = PDE32;
   state->shadow_mode = PDE32;
@@ -129,7 +146,7 @@ int cache_page_tables32(struct guest_info * info, addr_t pde) {
 }
 */
 
-int cache_page_tables32(struct guest_info * info, addr_t pde) {
+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;
   pde32_t * tmp_pde;
@@ -184,7 +201,7 @@ int v3_replace_shdw_page32(struct guest_info * info, addr_t location, pte32_t *
   pde32_t * shadow_pde =  (pde32_t *)&(shadow_pd[PDE32_INDEX(location)]);
 
   if (shadow_pde->large_page == 0) {
-    pte32_t * shadow_pt = (pte32_t *)PDE32_T_ADDR((*shadow_pde));
+    pte32_t * shadow_pt = (pte32_t *)(addr_t)PDE32_T_ADDR((*shadow_pde));
     pte32_t * shadow_pte = (pte32_t *)&(shadow_pt[PTE32_INDEX(location)]);
 
     //if (shadow_pte->present == 1) {
@@ -206,7 +223,7 @@ int v3_replace_shdw_page32(struct guest_info * info, addr_t location, pte32_t *
 
 
 
-int handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) {
+int v3_handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_error_t error_code) {
   
   if (info->mem_mode == PHYSICAL_MEM) {
     // If paging is not turned on we need to handle the special cases
@@ -229,7 +246,7 @@ int handle_shadow_pagefault(struct guest_info * info, addr_t fault_addr, pf_erro
   }
 }
 
-addr_t create_new_shadow_pt32() {
+addr_t v3_create_new_shadow_pt32() {
   void * host_pde = 0;
 
   host_pde = V3_AllocPages(1);
@@ -403,7 +420,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 *)create_new_shadow_pt32();
+      pte32_t * shadow_pt =  (pte32_t *)v3_create_new_shadow_pt32();
 
       shadow_pde->present = 1;
       shadow_pde->user_page = guest_pde->user_page;
@@ -419,7 +436,7 @@ static int handle_shadow_pagefault32(struct guest_info * info, addr_t fault_addr
       
       guest_pde->accessed = 1;
       
-      shadow_pde->pt_base_addr = PD32_BASE_ADDR(shadow_pt);
+      shadow_pde->pt_base_addr = PD32_BASE_ADDR((addr_t)shadow_pt);
       
       if (guest_pde->large_page == 0) {
        shadow_pde->writable = guest_pde->writable;
@@ -433,7 +450,7 @@ static int handle_shadow_pagefault32(struct guest_info * info, addr_t fault_addr
       //
       // PTE fault
       //
-      pte32_t * shadow_pt = (pte32_t *)PDE32_T_ADDR((*shadow_pde));
+      pte32_t * shadow_pt = (pte32_t *)(addr_t)PDE32_T_ADDR((*shadow_pde));
 
       if (guest_pde->large_page == 0) {
        pte32_t * guest_pt = NULL;
@@ -647,7 +664,7 @@ static int handle_shadow_pte32_fault(struct guest_info * info,
 
 
 /* Currently Does not work with Segmentation!!! */
-int handle_shadow_invlpg(struct guest_info * info) {
+int v3_handle_shadow_invlpg(struct guest_info * info) {
   if (info->mem_mode != VIRTUAL_MEM) {
     // Paging must be turned on...
     // should handle with some sort of fault I think
@@ -657,7 +674,7 @@ int handle_shadow_invlpg(struct guest_info * info) {
 
 
   if (info->cpu_mode == PROTECTED) {
-    char instr[15];
+    uchar_t instr[15];
     int ret;
     int index = 0;
 
@@ -679,7 +696,7 @@ int handle_shadow_invlpg(struct guest_info * info) {
 
       addr_t first_operand;
       addr_t second_operand;
-      operand_type_t addr_type;
+      v3_operand_type_t addr_type;
       addr_t guest_cr3 = CR3_TO_PDE32(info->shdw_pg_state.guest_cr3);
 
       pde32_t * guest_pd = NULL;
@@ -714,7 +731,7 @@ int handle_shadow_invlpg(struct guest_info * info) {
        } else {
         
          if (shadow_pde->present == 1) {
-           pte32_t * shadow_pt = (pte32_t *)PDE32_T_ADDR((*shadow_pde));
+           pte32_t * shadow_pt = (pte32_t *)(addr_t)PDE32_T_ADDR((*shadow_pde));
            pte32_t * shadow_pte = (pte32_t *)&shadow_pt[PTE32_INDEX(first_operand)];
 
 #ifdef DEBUG_SHADOW_PAGING