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>
34 extern void * g_ramdiskImage;
35 extern ulong_t s_ramdiskSize;
38 int RunVMM(struct Boot_Info * bootInfo) {
39 struct v3_os_hooks os_hooks;
40 struct v3_ctrl_ops v3_ops;
41 struct guest_info * vm_info = 0;
42 struct v3_vm_config vm_config;
44 memset(&os_hooks, 0, sizeof(struct v3_os_hooks));
45 memset(&v3_ops, 0, sizeof(struct v3_ctrl_ops));
46 memset(&vm_config, 0, sizeof(struct v3_vm_config));
49 os_hooks.print_debug = &SerialPrint;
50 os_hooks.print_info = &Print;
51 os_hooks.print_trace = &SerialPrint;
52 os_hooks.allocate_pages = &Allocate_VMM_Pages;
53 os_hooks.free_page = &Free_VMM_Page;
54 os_hooks.malloc = &VMM_Malloc;
55 os_hooks.free = &VMM_Free;
56 os_hooks.vaddr_to_paddr = &Identity;
57 os_hooks.paddr_to_vaddr = &Identity;
58 os_hooks.hook_interrupt = &geekos_hook_interrupt;
59 os_hooks.ack_irq = &ack_irq;
60 os_hooks.get_cpu_khz = &get_cpu_khz;
64 Init_V3(&os_hooks, &v3_ops);
67 extern char _binary___palacios_vm_kernel_start;
68 PrintBoth(" Guest Load Addr: 0x%x\n", &_binary___palacios_vm_kernel_start);
70 vm_config.vm_kernel = &_binary___palacios_vm_kernel_start;
73 if (g_ramdiskImage != NULL) {
74 vm_config.use_ramdisk = 1;
75 vm_config.ramdisk = g_ramdiskImage;
76 vm_config.ramdisk_size = s_ramdiskSize;
81 vm_info = (v3_ops).allocate_guest();
85 PrintBoth("Allocated Guest\n");
87 (v3_ops).config_guest(vm_info, &vm_config);
89 PrintBoth("Configured guest\n");
91 (v3_ops).init_guest(vm_info);
92 PrintBoth("Starting Guest\n");
95 (v3_ops).start_guest(vm_info);