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 configuration macro checks and a few configuration bugs
[palacios.git] / palacios / src / palacios / vmm_paging.c
index 27392cb..b4ba9ee 100644 (file)
@@ -46,7 +46,7 @@ static pt_entry_type_t pte64_lookup(pte64_t * pt, addr_t addr, addr_t * entry);
 
 
 
-#ifndef DEBUG_SHADOW_PAGING
+#ifndef CONFIG_DEBUG_SHADOW_PAGING
 #undef PrintDebug
 #define PrintDebug(fmt, args...)
 #endif
@@ -63,14 +63,14 @@ void delete_page_tables_32(pde32_t * pde) {
     PrintDebug("Deleting Page Tables (32) -- PDE (%p)\n", pde);
 
     for (i = 0; i < MAX_PDE32_ENTRIES; i++) {
-       if ((pde[i].present) && (pde[i].large_page == 0)) {
+       if ((pde[i].present == 1) && (pde[i].large_page == 0)) {
            // We double cast, first to an addr_t to handle 64 bit issues, then to the pointer
       
-           V3_FreePage((void *)(addr_t)PAGE_ADDR_4KB(pde[i].pt_base_addr));
+           PrintDebug("Deleting PT Page %d (%p)\n", i, (void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pde[i].pt_base_addr));
+           V3_FreePage((void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pde[i].pt_base_addr));
        }
     }
 
-
     V3_FreePage(V3_PAddr(pde));
 }
 
@@ -88,7 +88,7 @@ void delete_page_tables_32pae(pdpe32pae_t * pdpe) {
            continue;
        }
 
-       pde32pae_t * pde = (pde32pae_t *)V3_VAddr((void *)(addr_t)PAGE_ADDR_4KB(pdpe[i].pd_base_addr));
+       pde32pae_t * pde = (pde32pae_t *)V3_VAddr((void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pdpe[i].pd_base_addr));
 
        for (j = 0; j < MAX_PDE32PAE_ENTRIES; j++) {
 
@@ -96,7 +96,7 @@ void delete_page_tables_32pae(pdpe32pae_t * pdpe) {
                continue;
            }
 
-           V3_FreePage((void *)(addr_t)PAGE_ADDR_4KB(pde[j].pt_base_addr));
+           V3_FreePage((void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pde[j].pt_base_addr));
        }
 
        V3_FreePage(V3_PAddr(pde));
@@ -119,21 +119,21 @@ void delete_page_tables_64(pml4e64_t * pml4) {
            continue;
        }
 
-       pdpe64_t * pdpe = (pdpe64_t *)V3_VAddr((void *)(addr_t)PAGE_ADDR_4KB(pml4[i].pdp_base_addr));
+       pdpe64_t * pdpe = (pdpe64_t *)V3_VAddr((void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pml4[i].pdp_base_addr));
 
        for (j = 0; j < MAX_PDPE64_ENTRIES; j++) {
            if ((pdpe[j].present == 0) || (pdpe[j].large_page == 1)) {
                continue;
            }
 
-           pde64_t * pde = (pde64_t *)V3_VAddr((void *)(addr_t)PAGE_ADDR_4KB(pdpe[j].pd_base_addr));
+           pde64_t * pde = (pde64_t *)V3_VAddr((void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pdpe[j].pd_base_addr));
 
            for (k = 0; k < MAX_PDE64_ENTRIES; k++) {
                if ((pde[k].present == 0) || (pde[k].large_page == 1)) {
                    continue;
                }
 
-               V3_FreePage((void *)(addr_t)PAGE_ADDR_4KB(pde[k].pt_base_addr));
+               V3_FreePage((void *)(addr_t)BASE_TO_PAGE_ADDR_4KB(pde[k].pt_base_addr));
            }
            
            V3_FreePage(V3_PAddr(pde));