From: Jack Lange Date: Sun, 2 Mar 2008 00:08:18 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: working-cdboot-physical-but-not-qemu~61 X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=b4963a8a43ca9103946f926e062e609e4498c2e2 *** empty log message *** --- diff --git a/palacios/include/geekos/svm.h b/palacios/include/geekos/svm.h index ed2aae0..5ebed66 100644 --- a/palacios/include/geekos/svm.h +++ b/palacios/include/geekos/svm.h @@ -221,4 +221,7 @@ void Init_VMCB(vmcb_t * vmcb, guest_info_t vm_info); int init_svm_guest(struct guest_info *info); int start_svm_guest(struct guest_info * info); +int handle_svm_exit(); + + #endif diff --git a/palacios/include/geekos/vmm.h b/palacios/include/geekos/vmm.h index c1c82d9..8f0dfbc 100644 --- a/palacios/include/geekos/vmm.h +++ b/palacios/include/geekos/vmm.h @@ -37,6 +37,18 @@ } while (0) \ + + +// We need to check the hook structure at runtime to ensure its SAFE +#define VMMMalloc(size) \ + do { \ + extern struct vmm_os_hooks * os_hooks; \ + if ((os_hooks) && (os_hooks)->malloc) { \ + (os_hooks)->malloc(size); \ + } \ + } while (0) \ + + /* ** */ diff --git a/palacios/include/geekos/vmm_mem.h b/palacios/include/geekos/vmm_mem.h index dd6ec34..f938b3e 100644 --- a/palacios/include/geekos/vmm_mem.h +++ b/palacios/include/geekos/vmm_mem.h @@ -26,8 +26,8 @@ typedef struct vmm_mem_map { void init_mem_map(vmm_mem_map_t * map); -void add_pages(vmm_mem_map_t * map, ullong_t addr, uint_t numPages); -int remove_pages(vmm_mem_map_t * map, ullong_t addr, uint_t numPages); +void add_mem_map_pages(vmm_mem_map_t * map, ullong_t addr, uint_t numPages); +int remove_mem_map_pages(vmm_mem_map_t * map, ullong_t addr, uint_t numPages); diff --git a/palacios/src/geekos/main.c b/palacios/src/geekos/main.c index 4da5461..e92e70d 100644 --- a/palacios/src/geekos/main.c +++ b/palacios/src/geekos/main.c @@ -3,7 +3,7 @@ * Copyright (c) 2001,2003,2004 David H. Hovemeyer * Copyright (c) 2003, Jeffrey K. Hollingsworth * Copyright (c) 2004, Iulian Neamtiu - * $Revision: 1.13 $ + * $Revision: 1.14 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -325,31 +325,31 @@ void Main(struct Boot_Info* bootInfo) { - struct vmm_os_hooks os_hooks; - struct vmm_ctrl_ops vmm_ops; - guest_info_t vm_info; - memset(&os_hooks, 0, sizeof(struct vmm_os_hooks)); - memset(&vmm_ops, 0, sizeof(struct vmm_ctrl_ops)); - memset(&vm_info, 0, sizeof(guest_info_t)); - - os_hooks.print_debug = &PrintBoth; - os_hooks.print_info = &Print; - os_hooks.print_trace = &SerialPrint; - os_hooks.Allocate_Pages = &Allocate_VMM_Pages; - os_hooks.Free_Page = &Free_VMM_Page; - - Init_VMM(&os_hooks, &vmm_ops); - - + struct vmm_os_hooks os_hooks; + struct vmm_ctrl_ops vmm_ops; + guest_info_t vm_info; + memset(&os_hooks, 0, sizeof(struct vmm_os_hooks)); + memset(&vmm_ops, 0, sizeof(struct vmm_ctrl_ops)); + memset(&vm_info, 0, sizeof(guest_info_t)); + + os_hooks.print_debug = &PrintBoth; + os_hooks.print_info = &Print; + os_hooks.print_trace = &SerialPrint; + os_hooks.Allocate_Pages = &Allocate_VMM_Pages; + os_hooks.Free_Page = &Free_VMM_Page; + + Init_VMM(&os_hooks, &vmm_ops); + - vm_info.rip = (ullong_t)(void*)&BuzzVM; - vm_info.rsp = (ulong_t)Alloc_Page(); - SerialPrint("Initializing Guest\n"); - (vmm_ops).init_guest(&vm_info); - SerialPrint("Starting Guest\n"); - (vmm_ops).start_guest(&vm_info); + vm_info.rip = (ullong_t)(void*)&BuzzVM; + vm_info.rsp = (ulong_t)Alloc_Page(); + SerialPrint("Initializing Guest\n"); + (vmm_ops).init_guest(&vm_info); + SerialPrint("Starting Guest\n"); + (vmm_ops).start_guest(&vm_info); + } diff --git a/palacios/src/geekos/svm_lowlevel.asm b/palacios/src/geekos/svm_lowlevel.asm index 40bb8ea..c468c5a 100644 --- a/palacios/src/geekos/svm_lowlevel.asm +++ b/palacios/src/geekos/svm_lowlevel.asm @@ -27,16 +27,37 @@ EXPORT launch_svm + +; I think its safe to say that there are some pretty serious register issues... launch_svm: push ebp mov ebp, esp pusha mov eax, [ebp + 8] -; vmrun - db 00fh, 001h, 0d8h + vmrun +; db 00fh, 001h, 0d8h popa pop ebp ret %endif + + + + +; eventual svm_launch +; pusha +; pushf +; +; .vmm_loop +; vmrun +; push guest GPRs +; call handle_svm_exit +; jz .vmm_loop +; popf +; popa +; ret +; +; +; \ No newline at end of file diff --git a/palacios/src/geekos/vmm_mem.c b/palacios/src/geekos/vmm_mem.c index 128df3d..0bd908e 100644 --- a/palacios/src/geekos/vmm_mem.c +++ b/palacios/src/geekos/vmm_mem.c @@ -1,5 +1,22 @@ #include +#include +extern struct vmm_os_hooks * os_hooks; +void init_mem_map(vmm_mem_map_t * map) { + map->num_pages = 0; + map->long_mode = false; + + map->num_regions = 0; + map->head = NULL; + map->tail = NULL; +} + + +void add_mem_map_pages(vmm_mem_map_t * map, ullong_t addr, uint_t numPages) { + + + +}