Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


V3VEE compiles. Segfaults, but the callback structures work.
Trammell Hudson [Tue, 21 Oct 2008 22:38:40 +0000 (17:38 -0500)]
kitten/Makefile
kitten/include/lwk/palacios.h
kitten/init/main.c
kitten/palacios-glue/Makefile [new file with mode: 0644]
kitten/palacios-glue/vm.c
kitten/palacios-glue/vm.h [deleted file]
kitten/palacios-glue/vmm_stubs.c
kitten/palacios-glue/vmm_stubs.h [deleted file]

index 2a43e80..3407681 100644 (file)
@@ -535,6 +535,7 @@ export MODLIB
 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) \
index 599b6c6..f17f08f 100644 (file)
@@ -5,10 +5,32 @@
 
 #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;
 
 
 /*
index ea9c09b..d56f7e1 100644 (file)
@@ -118,29 +118,8 @@ start_kernel()
        }
 
 #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...
@@ -148,6 +127,7 @@ start_kernel()
        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();
diff --git a/kitten/palacios-glue/Makefile b/kitten/palacios-glue/Makefile
new file mode 100644 (file)
index 0000000..f8ca9b2
--- /dev/null
@@ -0,0 +1 @@
+obj-$(CONFIG_V3VEE)    := vm.o vmm_stubs.o
index 438a303..be49efb 100644 (file)
 
 
 
-#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) {
@@ -89,7 +67,7 @@ int RunVMM() {
   //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);
diff --git a/kitten/palacios-glue/vm.h b/kitten/palacios-glue/vm.h
deleted file mode 100644 (file)
index c7fadd9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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
-
index 3d44102..789eee7 100644 (file)
  * 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;
 
@@ -44,12 +49,12 @@ void Init_Stubs(struct guest_info * info) {
 
 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) 
@@ -80,7 +85,7 @@ void Free_VMM_Page(void * page)
   rc=pmem_query(&query,&result);
 
   if (!rc) { 
-    result.allocated=FALSE;
+    result.allocated=0;
     pmem_update(&result);
   } else {
     // BAD
@@ -88,15 +93,6 @@ void Free_VMM_Page(void * page)
 }
 
 
-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) {
@@ -178,3 +174,18 @@ unsigned int get_cpu_khz()
 }
 
 
+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,
+};
+
diff --git a/kitten/palacios-glue/vmm_stubs.h b/kitten/palacios-glue/vmm_stubs.h
deleted file mode 100644 (file)
index 2263ee6..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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