2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
22 #include <geekos/vmm_stubs.h>
24 #include <geekos/debug.h>
25 #include <geekos/serial.h>
26 #include <geekos/vm.h>
27 #include <geekos/screen.h>
29 #include <palacios/vmm.h>
30 #include <palacios/vmm_io.h>
33 extern void * g_ramdiskImage;
34 extern ulong_t s_ramdiskSize;
37 int RunVMM(struct Boot_Info * bootInfo) {
38 struct vmm_os_hooks os_hooks;
39 struct vmm_ctrl_ops vmm_ops;
40 struct guest_info * vm_info = 0;
41 struct v3_vm_config vm_config;
45 memset(&os_hooks, 0, sizeof(struct vmm_os_hooks));
46 memset(&vmm_ops, 0, sizeof(struct vmm_ctrl_ops));
47 memset(&vm_config, 0, sizeof(struct v3_vm_config));
50 os_hooks.print_debug = &SerialPrint;
51 os_hooks.print_info = &Print;
52 os_hooks.print_trace = &SerialPrint;
53 os_hooks.allocate_pages = &Allocate_VMM_Pages;
54 os_hooks.free_page = &Free_VMM_Page;
55 os_hooks.malloc = &VMM_Malloc;
56 os_hooks.free = &VMM_Free;
57 os_hooks.vaddr_to_paddr = &Identity;
58 os_hooks.paddr_to_vaddr = &Identity;
59 os_hooks.hook_interrupt = &geekos_hook_interrupt;
60 os_hooks.ack_irq = &ack_irq;
61 os_hooks.get_cpu_khz = &get_cpu_khz;
65 Init_V3(&os_hooks, &vmm_ops);
68 extern char _binary___palacios_vm_kernel_start;
69 PrintBoth(" Guest Load Addr: 0x%x\n", &_binary___palacios_vm_kernel_start);
71 vm_config.vm_kernel = &_binary___palacios_vm_kernel_start;
74 if (g_ramdiskImage != NULL) {
75 vm_config.use_ramdisk = 1;
76 vm_config.ramdisk = g_ramdiskImage;
77 vm_config.ramdisk_size = s_ramdiskSize;
82 vm_info = (vmm_ops).allocate_guest();
86 PrintBoth("Allocated Guest\n");
88 (vmm_ops).config_guest(vm_info, &vm_config);
90 PrintBoth("Configured guest\n");
92 (vmm_ops).init_guest(vm_info);
93 PrintBoth("Starting Guest\n");
96 (vmm_ops).start_guest(vm_info);