X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_paging.c;h=429c6d29d91952e7bfba29dcf21ded6646adb019;hb=8c767ddb04d3ac42d080d9f9f5f40196d6f8f217;hp=0d6e9eab659913759280e4a606b88cefe99f8836;hpb=101529b6eae500272347287df43ec51aa003d0aa;p=palacios.git diff --git a/palacios/src/palacios/vmm_paging.c b/palacios/src/palacios/vmm_paging.c index 0d6e9ea..429c6d2 100644 --- a/palacios/src/palacios/vmm_paging.c +++ b/palacios/src/palacios/vmm_paging.c @@ -1,6 +1,21 @@ -/* (c) 2008, Jack Lange */ -/* (c) 2008, The V3VEE Project */ - +/* + * 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 + * Copyright (c) 2008, The V3VEE Project + * All rights reserved. + * + * Author: Jack Lange + * + * This is free software. You are permitted to use, + * redistribute, and modify it as specified in the file "V3VEE_LICENSE". + */ #include @@ -20,7 +35,8 @@ void delete_page_tables_pde32(pde32_t * pde) { for (i = 0; (i < MAX_PDE32_ENTRIES); i++) { if (pde[i].present) { - pte32_t * pte = (pte32_t *)(pde[i].pt_base_addr << PAGE_POWER); + // We double cast, first to an addr_t to handle 64 bit issues, then to the pointer + pte32_t * pte = (pte32_t *)((addr_t)(pde[i].pt_base_addr << PAGE_POWER)); /* for (j = 0; (j < MAX_PTE32_ENTRIES); j++) { @@ -35,7 +51,7 @@ void delete_page_tables_pde32(pde32_t * pde) { } // PrintDebug("Deleting PDE (%x)\n", pde); - V3_FreePage(pde); + V3_FreePage(V3_PAddr(pde)); } @@ -154,11 +170,11 @@ pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info) { int i, j; struct shadow_map * map = &(guest_info->mem_map); - pde32_t * pde = V3_AllocPages(1); + pde32_t * pde = V3_VAddr(V3_AllocPages(1)); for (i = 0; i < MAX_PDE32_ENTRIES; i++) { int pte_present = 0; - pte32_t * pte = V3_AllocPages(1); + pte32_t * pte = V3_VAddr(V3_AllocPages(1)); for (j = 0; j < MAX_PTE32_ENTRIES; j++) { @@ -209,7 +225,7 @@ pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info) { } if (pte_present == 0) { - V3_FreePage(pte); + V3_FreePage(V3_PAddr(pte)); pde[i].present = 0; pde[i].writable = 0; @@ -233,7 +249,7 @@ pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info) { pde[i].large_page = 0; pde[i].global_page = 0; pde[i].vmm_info = 0; - pde[i].pt_base_addr = PAGE_ALIGNED_ADDR(pte); + pde[i].pt_base_addr = PAGE_ALIGNED_ADDR((addr_t)V3_PAddr(pte)); } } @@ -249,8 +265,8 @@ pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info) { void PrintPDE32(addr_t virtual_address, pde32_t * pde) { PrintDebug("PDE %p -> %p : present=%x, writable=%x, user=%x, wt=%x, cd=%x, accessed=%x, reserved=%x, largePages=%x, globalPage=%x, kernelInfo=%x\n", - virtual_address, - (void *) (pde->pt_base_addr << PAGE_POWER), + (void *)virtual_address, + (void *)(addr_t) (pde->pt_base_addr << PAGE_POWER), pde->present, pde->writable, pde->user_page, @@ -266,8 +282,8 @@ void PrintPDE32(addr_t virtual_address, pde32_t * pde) void PrintPTE32(addr_t virtual_address, pte32_t * pte) { PrintDebug("PTE %p -> %p : present=%x, writable=%x, user=%x, wt=%x, cd=%x, accessed=%x, dirty=%x, pteAttribute=%x, globalPage=%x, vmm_info=%x\n", - virtual_address, - (void*)(pte->page_base_addr << PAGE_POWER), + (void *)virtual_address, + (void*)(addr_t)(pte->page_base_addr << PAGE_POWER), pte->present, pte->writable, pte->user_page, @@ -319,7 +335,7 @@ void PrintDebugPageTables(pde32_t * pde) for (i = 0; (i < MAX_PDE32_ENTRIES); i++) { if (pde[i].present) { PrintPDE32((addr_t)(PAGE_SIZE * MAX_PTE32_ENTRIES * i), &(pde[i])); - PrintPT32((addr_t)(PAGE_SIZE * MAX_PTE32_ENTRIES * i), (pte32_t *)(pde[i].pt_base_addr << PAGE_POWER)); + PrintPT32((addr_t)(PAGE_SIZE * MAX_PTE32_ENTRIES * i), (pte32_t *)V3_VAddr((void *)(addr_t)(pde[i].pt_base_addr << PAGE_POWER))); } } }