From: Jack Lange Date: Sat, 25 Oct 2008 17:54:54 +0000 (-0500) Subject: added 32 bit support for geekos X-Git-Tag: 1.0^2~1 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=11c0d91392ab632542eb364412b62fa7c96697c4 added 32 bit support for geekos --- diff --git a/build/Makefile b/build/Makefile index 4b641ad..39e5392 100644 --- a/build/Makefile +++ b/build/Makefile @@ -187,12 +187,14 @@ endif all : $(ALL_TARGETS) +palacios64: + (cd $(PALACIOS_BUILD_DIR) && make ARCH=64 $(DEBUG_SECTIONS)) -palacios: +palacios32: (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS)) -palacios-full: +palacios-full32: (cd $(PALACIOS_BUILD_DIR) && make $(DEBUG_SECTIONS) world) palacios-full64: @@ -201,28 +203,28 @@ palacios-full64: palacios-lean: (cd $(PALACIOS_BUILD_DIR) && make LEAN_AND_MEAN=1 world) -kitten: palacios-full64 +kitten: + (cd $(KITTEN_TOP_DIR) && make) + +kitten-full: palacios-full64 cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(KITTEN_TOP_DIR)/palacios/ cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed32e.a $(KITTEN_TOP_DIR)/palacios/ cp $(PALACIOS_BUILD_DIR)/vm_kernel $(KITTEN_TOP_DIR)/palacios/ - (cd $(KITTEN_TOP_DIR) && make) + (cd $(KITTEN_TOP_DIR) && make clean && make) geekos: - cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/ - cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/ - cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/ (cd $(GEEKOS_BUILD_DIR) && make) -geekos-full: +geekos-full: palacios-full32 cp $(PALACIOS_BUILD_DIR)/libv3vee.a $(GEEKOS_BUILD_DIR)/palacios/ cp $(PALACIOS_BUILD_DIR)/../lib/xed/libxed.a $(GEEKOS_BUILD_DIR)/palacios/ cp $(PALACIOS_BUILD_DIR)/vm_kernel $(GEEKOS_BUILD_DIR)/palacios/ (cd $(GEEKOS_BUILD_DIR) && make clean && make) -world: palacios-full geekos-full +world: geekos-full kitten-full lean-and-mean: palacios-lean geekos-full diff --git a/palacios/include/palacios/vmm_paging.h b/palacios/include/palacios/vmm_paging.h index 4831525..313afc7 100644 --- a/palacios/include/palacios/vmm_paging.h +++ b/palacios/include/palacios/vmm_paging.h @@ -316,7 +316,7 @@ pt_access_status_t can_access_pte32(pte32_t * pte, addr_t addr, pf_error_t acces struct guest_info; -pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info); +pde32_t * create_passthrough_pts_32(struct guest_info * guest_info); pml4e64_t * create_passthrough_pts_64(struct guest_info * info); diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index c9d69ef..f9edbb2 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -38,10 +38,6 @@ -extern uint_t Get_CR3(); - - - extern void v3_stgi(); extern void v3_clgi(); extern int v3_svm_launch(vmcb_t * vmcb, struct v3_gprs * vm_regs); @@ -213,9 +209,13 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { if (vm_info->shdw_pg_mode == SHADOW_PAGING) { PrintDebug("Creating initial shadow page table\n"); - // vm_info->direct_map_pt = (addr_t)V3_PAddr(create_passthrough_pde32_pts(vm_info)); + + + /* Testing 64 bit page tables for long paged real mode guests */ vm_info->direct_map_pt = (addr_t)V3_PAddr(create_passthrough_pts_64(vm_info)); + //vm_info->direct_map_pt = (addr_t)V3_PAddr(create_passthrough_pts_32(vm_info)); + /* End Test */ //vm_info->shdw_pg_state.shadow_cr3 |= (vm_info->direct_map_pt & ~0xfff); vm_info->shdw_pg_state.shadow_cr3 = 0; @@ -258,7 +258,7 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info *vm_info) { PrintDebug("NP_Enable at 0x%p\n", (void *)&(ctrl_area->NP_ENABLE)); // Set the Nested Page Table pointer - vm_info->direct_map_pt = ((addr_t)create_passthrough_pde32_pts(vm_info) & ~0xfff); + vm_info->direct_map_pt = ((addr_t)create_passthrough_pts_32(vm_info) & ~0xfff); ctrl_area->N_CR3 = vm_info->direct_map_pt; // ctrl_area->N_CR3 = Get_CR3(); @@ -372,7 +372,7 @@ static int start_svm_guest(struct guest_info *info) { PrintDebug("SVM ERROR!!\n"); - PrintDebug("RIP: %p\n", (void *)guest_state->rip); + PrintDebug("RIP: %p\n", (void *)(addr_t)(guest_state->rip)); linear_addr = get_addr_linear(info, guest_state->rip, &(info->segments.cs)); @@ -688,7 +688,7 @@ void v3_init_SVM(struct v3_ctrl_ops * vmm_ops) { if (vm_info.page_mode == SHADOW_PAGING) { PrintDebug("Creating initial shadow page table\n"); - vm_info.shdw_pg_state.shadow_cr3 |= ((addr_t)create_passthrough_pde32_pts(&vm_info) & ~0xfff); + vm_info.shdw_pg_state.shadow_cr3 |= ((addr_t)create_passthrough_pts_32(&vm_info) & ~0xfff); PrintDebug("Created\n"); guest_state->cr3 = vm_info.shdw_pg_state.shadow_cr3; diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index 4c76f8a..23546e2 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -339,10 +339,10 @@ int v3_handle_svm_exit(struct guest_info * info) { PrintError("SVM Returned:(VMCB=%p)\n", (void *)(info->vmm_data)); - PrintError("RIP: %p\n", (void *)(guest_state->rip)); - PrintError("RIP Linear: %p\n", (void *)(rip_addr)); + PrintError("RIP: %p\n", (void *)(addr_t)(guest_state->rip)); + PrintError("RIP Linear: %p\n", (void *)(addr_t)(rip_addr)); - PrintError("SVM Returned: Exit Code: %p\n", (void *)exit_code); + PrintError("SVM Returned: Exit Code: %p\n", (void *)(addr_t)exit_code); PrintError("io_info1 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info1)); PrintError("io_info1 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info1)) + 4)); diff --git a/palacios/src/palacios/vm_guest.c b/palacios/src/palacios/vm_guest.c index ef025fa..e47c1fb 100644 --- a/palacios/src/palacios/vm_guest.c +++ b/palacios/src/palacios/vm_guest.c @@ -91,7 +91,7 @@ void v3_print_segments(struct guest_info * info) { for (i = 0; seg_names[i] != NULL; i++) { PrintDebug("\t%s: Sel=%x, base=%p, limit=%x\n", seg_names[i], seg_ptr[i].selector, - (void *)seg_ptr[i].base, seg_ptr[i].limit); + (void *)(addr_t)seg_ptr[i].base, seg_ptr[i].limit); } @@ -110,10 +110,10 @@ void v3_print_ctrl_regs(struct guest_info * info) { PrintDebug("32 bit Ctrl Regs:\n"); for (i = 0; reg_names[i] != NULL; i++) { - PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)reg_ptr[i]); + PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)(addr_t)reg_ptr[i]); } - PrintDebug("\tEFER=0x%p\n", (void*)(guest_state->efer)); + PrintDebug("\tEFER=0x%p\n", (void*)(addr_t)(guest_state->efer)); } @@ -129,6 +129,6 @@ void v3_print_GPRs(struct guest_info * info) { PrintDebug("32 bit GPRs:\n"); for (i = 0; reg_names[i] != NULL; i++) { - PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)reg_ptr[i]); + PrintDebug("\t%s=0x%p\n", reg_names[i], (void *)(addr_t)reg_ptr[i]); } } diff --git a/palacios/src/palacios/vm_guest_mem.c b/palacios/src/palacios/vm_guest_mem.c index 3400b97..920c8bb 100644 --- a/palacios/src/palacios/vm_guest_mem.c +++ b/palacios/src/palacios/vm_guest_mem.c @@ -160,9 +160,9 @@ int guest_va_to_guest_pa(struct guest_info * guest_info, addr_t guest_va, addr_t addr_t guest_pde = 0; if (guest_info->shdw_pg_mode == SHADOW_PAGING) { - guest_pde = (addr_t)V3_PAddr((void *)(addr_t)CR3_TO_PDE32((void *)(guest_info->shdw_pg_state.guest_cr3))); + guest_pde = (addr_t)V3_PAddr((void *)(addr_t)CR3_TO_PDE32((void *)(addr_t)(guest_info->shdw_pg_state.guest_cr3))); } else if (guest_info->shdw_pg_mode == NESTED_PAGING) { - guest_pde = (addr_t)V3_PAddr((void *)(addr_t)CR3_TO_PDE32((void *)(guest_info->ctrl_regs.cr3))); + guest_pde = (addr_t)V3_PAddr((void *)(addr_t)CR3_TO_PDE32((void *)(addr_t)(guest_info->ctrl_regs.cr3))); } if (guest_pa_to_host_va(guest_info, guest_pde, (addr_t *)&pde) == -1) { diff --git a/palacios/src/palacios/vmm_paging.c b/palacios/src/palacios/vmm_paging.c index 0832077..dff74dd 100644 --- a/palacios/src/palacios/vmm_paging.c +++ b/palacios/src/palacios/vmm_paging.c @@ -169,7 +169,7 @@ pt_access_status_t can_access_pte32(pte32_t * pte, addr_t addr, pf_error_t acces * pulling pages from the mem_list when necessary * If there are any gaps in the layout, we add them as unmapped pages */ -pde32_t * create_passthrough_pde32_pts(struct guest_info * guest_info) { +pde32_t * create_passthrough_pts_32(struct guest_info * guest_info) { addr_t current_page_addr = 0; int i, j; struct shadow_map * map = &(guest_info->mem_map); diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 7baee58..1f8e7a2 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -681,7 +681,7 @@ int v3_handle_shadow_invlpg(struct guest_info * info) int ret = read_guest_va_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr); if (ret != 15) { - PrintError("Could not read instruction 0x%p (ret=%d)\n", (void *)(info->rip), ret); + PrintError("Could not read instruction 0x%p (ret=%d)\n", (void *)(addr_t)(info->rip), ret); return -1; }