ifeq ($(KBUILD_EXTMOD),)
#core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
core-y += kernel/ mm/
+core-$(CONFIG_V3VEE) += palacios-glue/
vmlwk-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
#ifdef CONFIG_V3VEE
+#include <lwk/types.h>
#include <palacios/vmm.h>
+#include <palacios/vmm_host_events.h>
+
+
+extern int
+RunVMM( void );
+
+extern struct v3_os_hooks v3vee_os_hooks;
+
+/****
+ *
+ * stubs called by geekos....
+ *
+ ***/
+extern void Init_Stubs(struct guest_info * info);
+void send_key_to_vmm(unsigned char status, unsigned char scancode);
+void send_mouse_to_vmm(unsigned char packet[3]);
+void send_tick_to_vmm(unsigned int period_us);
+
+
+/* Location of the ROM Bios and VGA Bios used by palacios */
extern uint8_t rombios_start, rombios_end;
extern uint8_t vgabios_start, vgabios_end;
+extern paddr_t initrd_start, initrd_end;
/*
}
#ifdef CONFIG_V3VEE
- {
- struct v3_os_hooks os_hooks;
- struct v3_ctrl_ops v3_ops;
- struct guest_info * vm_info = 0;
- struct v3_vm_config vm_config;
-
- memset(&os_hooks, 0, sizeof(struct v3_os_hooks));
- memset(&v3_ops, 0, sizeof(struct v3_ctrl_ops));
- memset(&vm_config, 0, sizeof(struct v3_vm_config));
-
- printk( KERN_INFO "Calling Init_V3\n" );
- Init_V3(&os_hooks, &v3_ops);
- printk( KERN_INFO "Rombios: %p @ %d\n",
- &rombios_start,
- &rombios_end - &rombios_start
- );
-
- printk( KERN_INFO "VGA Bios: %p @ %d\n",
- &vgabios_start,
- &vgabios_end - &vgabios_start
- );
- }
-#endif
+ RunVMM();
+#else
/*
* Start up user-space...
printk(KERN_INFO "Loading initial user-level task (init_task)...\n");
if ((status = create_init_task()) != 0)
panic("Failed to create init_task (status=%d).", status);
+#endif
schedule(); /* This should not return */
BUG();
--- /dev/null
+obj-$(CONFIG_V3VEE) := vm.o vmm_stubs.o
-#include <palacios-glue/vmm_stubs.h>
-#include <palacios-glue/vm.h>
-
#include <lwk/kernel.h>
-
#include <lwk/palacios.h>
#include <palacios/vmm.h>
int RunVMM() {
- struct v3_os_hooks os_hooks;
- struct v3_ctrl_ops v3_ops;
+ struct v3_ctrl_ops v3_ops = {};
struct guest_info * vm_info = 0;
- struct v3_vm_config vm_config;
-
- void * ramdiskImage=&initrd_start;
- ulong_t ramdiskSize=(&initrd_end)-(&initrd_start);
- memset(&os_hooks, 0, sizeof(struct v3_os_hooks));
- memset(&v3_ops, 0, sizeof(struct v3_ctrl_ops));
- memset(&vm_config, 0, sizeof(struct v3_vm_config));
-
-
- os_hooks.print_debug = &printk; // serial print ideally
- os_hooks.print_info = &printk; // serial print ideally
- os_hooks.print_trace = &printk; // serial print ideally
- os_hooks.allocate_pages = &Allocate_VMM_Pages; // defined in vmm_stubs
- os_hooks.free_page = &Free_VMM_Page; // defined in vmm_stubs
- os_hooks.malloc = &kmem_alloc;
- os_hooks.free = &kmem_free;
- os_hooks.vaddr_to_paddr = &kitten_va_to_pa;
- os_hooks.paddr_to_vaddr = &kitten_pa_to_va;
- os_hooks.hook_interrupt = &kitten_hook_interrupt;
- os_hooks.ack_irq = &ack_irq;
- os_hooks.get_cpu_khz = &get_cpu_khz;
+ void * ramdiskImage=initrd_start;
+ uintptr_t ramdiskSize=initrd_end-initrd_start;
- Init_V3(&os_hooks, &v3_ops);
+ Init_V3(&v3vee_os_hooks, &v3_ops);
- vm_config.rombios = &rombios_start;
- vm_config.rombios_size = (&rombios_end)-(&rombios_start);
- vm_config.vgabios = &vgabios_start;
- vm_config.vgabios_size = (&vgabios_end)-(&vgabios_start);
+ struct v3_vm_config vm_config = {
+ .rombios = &rombios_start,
+ .rombios_size = (&rombios_end)-(&rombios_start),
+ .vgabios = &vgabios_start,
+ .vgabios_size = (&vgabios_end)-(&vgabios_start),
+ };
if (ramdiskImage != NULL) {
//PrintBoth("Configured guest\n");
(v3_ops).init_guest(vm_info);
- PrintBoth("Starting Guest\n");
+ printk("Starting Guest\n");
//Clear_Screen();
(v3_ops).start_guest(vm_info);
+++ /dev/null
-/*
- * 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 <jarusl@cs.northwestern.edu>
- * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
- * All rights reserved.
- *
- * Author: Jack Lange <jarusl@cs.northwestern.edu>
- *
- * This is free software. You are permitted to use,
- * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
- */
-
-#ifndef __VM_H
-#define __VM_H
-
-int RunVMM();
-
-
-#endif
-
* redistribute, and modify it as specified in the file "V3VEE_LICENSE".
*/
-#include <palacios/vmm.h>
-#include <palacios/vmm_host_events.h>
-
+#include <lwk/palacios.h>
+#include <lwk/types.h>
#include <lwk/pmem.h>
+#include <lwk/string.h>
+#include <lwk/cpuinfo.h>
+#include <lwk/kernel.h>
+#include <arch/page.h>
+#include <arch/ptrace.h>
+#include <arch/apic.h>
struct guest_info * g_vm_guest = NULL;
void * kitten_pa_to_va(void *ptr)
{
- return __va(ptr);
+ return (void*) __va(ptr);
}
void * kitten_va_to_pa(void *ptr)
{
- return __pa(ptr);
+ return (void*) __pa(ptr);
}
void * Allocate_VMM_Pages(int num_pages)
rc=pmem_query(&query,&result);
if (!rc) {
- result.allocated=FALSE;
+ result.allocated=0;
pmem_update(&result);
} else {
// BAD
}
-void * VMM_Malloc(unsigned int size) {
- return Malloc((unsigned long) size);
-}
-
-
-void VMM_Free(void * addr) {
- Free(addr);
-}
-
void send_key_to_vmm(unsigned char status, unsigned char scancode) {
}
+struct v3_os_hooks v3vee_os_hooks = {
+ .print_debug = &printk, // serial print ideally
+ .print_info = &printk, // serial print ideally
+ .print_trace = &printk, // serial print ideally
+ .allocate_pages = &Allocate_VMM_Pages, // defined in vmm_stubs
+ .free_page = &Free_VMM_Page, // defined in vmm_stubs
+ .malloc = &kmem_alloc,
+ .free = &kmem_free,
+ .vaddr_to_paddr = &kitten_va_to_pa,
+ .paddr_to_vaddr = &kitten_pa_to_va,
+ .hook_interrupt = &kitten_hook_interrupt,
+ .ack_irq = &ack_irq,
+ .get_cpu_khz = &get_cpu_khz,
+};
+
+++ /dev/null
-/*
- * 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 <jarusl@cs.northwestern.edu>
- * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
- * All rights reserved.
- *
- * Author: Jack Lange <jarusl@cs.northwestern.edu>
- *
- * This is free software. You are permitted to use,
- * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
- */
-
-#ifndef __VMM_STUBS_H
-#define __VMM_STUBS_H
-
-
-//#include <geekos/mem.h>
-//#include <geekos/malloc.h>
-
-
-struct guest_info;
-
-
-
-
-void * Allocate_VMM_Pages(int num_pages);
-void Free_VMM_Page(void * page);
-
-void * VMM_Malloc(unsigned int size);
-void VMM_Free(void * addr);
-
-void * Identity(void *addr);
-
-
-int hook_irq_stub(struct guest_info * info, int irq);
-int ack_irq(int irq);
-
-int geekos_hook_interrupt(struct guest_info * info, uint_t irq);
-
-unsigned int get_cpu_khz();
-
-void Init_Stubs(struct guest_info * info);
-
-
-
-/****
- *
- * stubs called by geekos....
- *
- ***/
-void send_key_to_vmm(unsigned char status, unsigned char scancode);
-void send_mouse_to_vmm(unsigned char packet[3]);
-void send_tick_to_vmm(unsigned int period_us);
-
-
-#if 0
-
-# define do_div(n,base) ({ \
- uint32_t __base = (base); \
- uint32_t __rem; \
- __rem = ((uint64_t)(n)) % __base; \
- (n) = ((uint64_t)(n)) / __base; \
- __rem; \
- })
-
-#else
-
-/*
- * do_div() is NOT a C function. It wants to return
- * two values (the quotient and the remainder), but
- * since that doesn't work very well in C, what it
- * does is:
- *
- * - modifies the 64-bit dividend _in_place_
- * - returns the 32-bit remainder
- *
- * This ends up being the most efficient "calling
- * convention" on x86.
- */
-#define do_div(n,base) ({ \
- unsigned long __upper, __low, __high, __mod, __base; \
- __base = (base); \
- asm("":"=a" (__low), "=d" (__high):"A" (n)); \
- __upper = __high; \
- if (__high) { \
- __upper = __high % (__base); \
- __high = __high / (__base); \
- } \
- asm("divl %2":"=a" (__low), "=d" (__mod):"rm" (__base), "0" (__low), "1" (__upper)); \
- asm("":"=A" (n):"a" (__low),"d" (__high)); \
- __mod; \
- })
-
-#endif
-
-
-
-
-
-
-#endif