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.


added module directory tree and build configuration
Jack Lange [Thu, 11 Feb 2010 04:00:23 +0000 (22:00 -0600)]
14 files changed:
Kconfig
Makefile
modules/Kconfig [new file with mode: 0644]
modules/Makefile [new file with mode: 0644]
modules/linux_mods/Kconfig [new file with mode: 0644]
modules/linux_mods/i386/Kconfig [new file with mode: 0644]
modules/linux_mods/i386/Makefile [new file with mode: 0644]
modules/linux_mods/i386/binaries.S [new file with mode: 0644]
modules/linux_mods/i386/binaries/test.ko [new file with mode: 0644]
modules/linux_mods/i386/headers.c [new file with mode: 0644]
palacios/include/palacios/vmm_symmod.h
palacios/src/devices/lnx_virtio_symmod.c
palacios/src/palacios/vmm_binaries.S
palacios/src/palacios/vmm_symmod.c

diff --git a/Kconfig b/Kconfig
index 029cfd1..726a7b6 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -151,8 +151,6 @@ config SYMBIOTIC
          Enable Symbiotic components of the VMM. 
          This includes the SymSpy interface.
 
-
-
 config SYMCALL
        bool "Symbiotic upcalls"
        default n
@@ -160,14 +158,6 @@ config SYMCALL
        help
          Enables the Symbiotic upcall interface
 
-config SYMMOD
-       bool "Symbiotic Modules"
-       default n
-       depends on SYMBIOTIC && EXPERIMENTAL
-       help
-         Enable Symbiotic module loading
-
-
 config SWAPBYPASS
        bool "SwapBypass"
        default n
@@ -182,6 +172,21 @@ config SWAPBYPASS_TELEMETRY
        help 
          Enable the telemetry information for the SwapBypass subsystem
 
+menuconfig SYMMOD 
+       bool "Symbiotic Modules"
+       default n
+       depends on EXPERIMENTAL
+#      depends on SYMBIOTIC
+       help
+         Enable Symbiotic module loading
+
+if SYMMOD
+
+source "modules/Kconfig"
+
+endif
+
+
 
 endmenu
 
index e21caf4..51c03e9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -429,6 +429,7 @@ scripts_basic: palacios/include/autoconf.h
 core-y          := palacios/src/palacios/
 libs-y         := palacios/lib/$(ARCH)/
 devices-y       := palacios/src/devices/
+modules-y       := modules/
 
 ifeq ($(dot-config),1)
 # In this section, we need .config
@@ -507,7 +508,7 @@ export      INSTALL_PATH ?= /build
 
 
 palacios-dirs  := $(patsubst %/,%,$(filter %/,  \
-                    $(core-y) $(devices-y) $(libs-y)))
+                    $(core-y) $(devices-y) $(libs-y)) $(modules-y))
 
 #palacios-alldirs      := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \
 #                   $(core-n) $(core-) $(devices-n) $(devices-) \
@@ -515,13 +516,14 @@ palacios-dirs     := $(patsubst %/,%,$(filter %/,  \
 
 
 palacios-cleandirs := $(sort $(palacios-dirs) $(patsubst %/,%,$(filter %/, \
-                       $(core-n) $(core-) $(devices-n) $(devices-))))
+                       $(core-n) $(core-) $(devices-n) $(devices-) $(modules-n) $(modules-))))
 
 
 
 core-y         := $(patsubst %/, %/built-in.o, $(core-y))
 devices-y      := $(patsubst %/, %/built-in.o, $(devices-y))
 libs-y         := $(patsubst %/, %/built-in.o, $(libs-y))
+modules-y       := $(patsubst %/, %/built-in.o, $(modules-y))
 #core-y                := $(patsubst %/, %/lib.a, $(core-y))
 #devices-y     := $(patsubst %/, %/lib.a, $(devices-y))
 
@@ -544,7 +546,7 @@ libs-y              := $(patsubst %/, %/built-in.o, $(libs-y))
 
 
 
-palacios := $(core-y) $(devices-y) $(libs-y)
+palacios := $(core-y) $(devices-y) $(libs-y) $(modules-y)
 
 # Rule to link palacios - also used during CONFIG_KALLSYMS
 # May be overridden by /Makefile.$(ARCH)
diff --git a/modules/Kconfig b/modules/Kconfig
new file mode 100644 (file)
index 0000000..d888b18
--- /dev/null
@@ -0,0 +1 @@
+source "./modules/linux_mods/Kconfig"
diff --git a/modules/Makefile b/modules/Makefile
new file mode 100644 (file)
index 0000000..303d52a
--- /dev/null
@@ -0,0 +1,2 @@
+obj-$(CONFIG_LNX_MOD_32BIT)       += linux_mods/i386/
+#obj-$(CONFIG_LNX_MOD_64BIT)       += linux_mods/x86_64/
diff --git a/modules/linux_mods/Kconfig b/modules/linux_mods/Kconfig
new file mode 100644 (file)
index 0000000..3869f46
--- /dev/null
@@ -0,0 +1,31 @@
+
+
+
+config LNX_KERN_MODS
+       bool "Linux kernel modules"
+       select LNX_MOD_32BIT
+       select LNX_MOD_64BIT
+       
+
+
+
+
+config LNX_MOD_32BIT
+       bool "32 bit modules"
+       depends on LNX_KERN_MODS
+
+config LNX_MOD_32BIT_TEST
+       bool "Linux (i386) test module"
+       default y if SYMMOD
+       depends on LNX_MOD_32BIT
+       help 
+           This is a simple 32 bit test Linux kernel module
+
+
+
+
+config LNX_MOD_64BIT
+       bool "64 bit modules" 
+       depends on LNX_KERN_MODS
+       default y               
+
diff --git a/modules/linux_mods/i386/Kconfig b/modules/linux_mods/i386/Kconfig
new file mode 100644 (file)
index 0000000..28ed4da
--- /dev/null
@@ -0,0 +1,20 @@
+
+
+
+config LINUX_KERN_MODS
+       bool "Include Linux kernel modules"
+       depends on SYMMOD
+
+if LINUX_KERN_MODS 
+
+config LINUX_TEST_MODULE
+       bool "Linux test module"
+       default y if SYMMOD
+       depends on SYMMOD
+       help 
+           This is a simple test linux kernel module
+
+
+       
+
+endif
diff --git a/modules/linux_mods/i386/Makefile b/modules/linux_mods/i386/Makefile
new file mode 100644 (file)
index 0000000..cdcc933
--- /dev/null
@@ -0,0 +1 @@
+obj-$(CONFIG_LNX_MOD_32BIT)   += binaries.o headers.o
\ No newline at end of file
diff --git a/modules/linux_mods/i386/binaries.S b/modules/linux_mods/i386/binaries.S
new file mode 100644 (file)
index 0000000..753b01b
--- /dev/null
@@ -0,0 +1,35 @@
+#;  -*- fundamental -*-
+
+/* 
+ * 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) 2010, Jack Lange <jarusl@cs.northwestern.edu>
+ * Copyright (c) 2010, 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".
+ */
+
+.data
+
+#define TOSTR(str) #str
+#define MOD_DIR(name) TOSTR(./modules/linux_mods/i386/binaries/name)
+
+       
+#ifdef CONFIG_LNX_MOD_32BIT_TEST
+.globl v3_lnx_mod_32bit_test_start
+v3_lnx_mod_32bit_test_start:
+.incbin MOD_DIR(test.ko)
+.globl v3_lnx_mod_32bit_test_stop
+v3_lnx_mod_32bit_test_stop:
+#endif
+
diff --git a/modules/linux_mods/i386/binaries/test.ko b/modules/linux_mods/i386/binaries/test.ko
new file mode 100644 (file)
index 0000000..e5af2d2
Binary files /dev/null and b/modules/linux_mods/i386/binaries/test.ko differ
diff --git a/modules/linux_mods/i386/headers.c b/modules/linux_mods/i386/headers.c
new file mode 100644 (file)
index 0000000..f7061e0
--- /dev/null
@@ -0,0 +1,29 @@
+/* 
+ * 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) 2010, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2010, 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".
+ */
+
+#include <palacios/vmm_symmod.h>
+
+
+
+#ifdef CONFIG_LNX_MOD_32BIT_TEST
+extern uint8_t v3_lnx_mod_32bit_test_start[];
+extern uint8_t v3_lnx_mod_32bit_test_stop[];
+
+register_module("test_32", v3_lnx_mod_32bit_test_start, v3_lnx_mod_32bit_test_stop);
+#endif
index bc7079b..bf360d2 100644 (file)
@@ -59,6 +59,25 @@ int v3_init_symmod_vm(struct v3_vm_info * vm, v3_cfg_tree_t * cfg);
 struct v3_sym_module * v3_get_sym_module(struct v3_vm_info * vm, char * name);
 
 
+
+
+
+struct v3_module_hdr {
+    char * name;
+    void * start_addr;
+    void * end_addr;
+} __attribute__((packed));
+
+
+#define register_module(name, start, end)                      \
+    static char v3_module_name[] = name;                       \
+    static struct v3_module_hdr _v3_module                     \
+    __attribute__((__used__))                                  \
+       __attribute__((unused, __section__ ("_v3_modules"),     \
+                      aligned(sizeof(addr_t))))                \
+       = {v3_module_name, start, end};
+
+
 int V3_init_symmod();
 
 
index b1e4a28..53a7171 100644 (file)
@@ -148,6 +148,8 @@ static int handle_xfer_kick(struct guest_info * core, struct virtio_sym_state *
            }
 
            memcpy(buf, module->data + offset, buf_desc->length);
+           PrintDebug("Copying module to virtio buffers: SRC=%p, DST=%p, len=%d\n",
+                      (void *)(module->data + offset), (void *)buf, buf_desc->length);
 
            if (tmp_status != 0) {
                PrintError("Error loading module segment\n");
@@ -170,6 +172,7 @@ static int handle_xfer_kick(struct guest_info * core, struct virtio_sym_state *
        xfer_len += status_desc->length;
        *status_ptr = status;
 
+       PrintDebug("Transferred %d bytes (xfer_len)\n", xfer_len);
        q->used->ring[q->used->index % QUEUE_SIZE].id = q->avail->ring[q->cur_avail_idx % QUEUE_SIZE];
        q->used->ring[q->used->index % QUEUE_SIZE].length = xfer_len; // set to total inbound xfer length
 
index 0caa9dc..9be1933 100644 (file)
@@ -50,3 +50,13 @@ pxebios_start:
 .globl pxebios_end
 pxebios_end:
 #endif
+
+
+/* temporary module */
+/*
+.globl symmod_start
+symmod_start:
+.incbin "./palacios/src/modules/test.ko"
+.globl symmod_end
+symmod_end:*/
+
index d52f01e..41767ff 100644 (file)
@@ -21,6 +21,7 @@
 #include <palacios/vmm_symbiotic.h>
 #include <palacios/vm_guest.h>
 
+static struct v3_sym_module  test_module;
 
 int V3_init_symmod() {
 
@@ -37,32 +38,45 @@ int v3_init_symmod_vm(struct v3_vm_info * info, v3_cfg_tree_t * cfg) {
 
 int v3_set_symmod_loader(struct v3_vm_info * vm, struct v3_symmod_loader_ops * ops, void * priv_data) {
     struct v3_symmod_state * symmod_state = &(vm->sym_vm_state.symmod_state);
+    extern uint8_t symmod_start[];
+    extern uint8_t symmod_end[];
+
+
+
+
+    struct v3_sym_module tmp_mod = {
+       .name = "test",
+       .num_bytes = symmod_end - symmod_start,
+       .data = symmod_start,
+    };
+    
+    
+    test_module = tmp_mod;
 
 
     symmod_state->loader_ops = ops;
     symmod_state->loader_data = priv_data;
 
+    
     return 0;
+
 }
 
 
 
-static char test_module_data[16] = {"hello"};
 
-static struct v3_sym_module test_module = {
-    .name = "test",
-    .num_bytes = 16,
-    .data = test_module_data,
-};
 
 int v3_load_sym_module(struct v3_vm_info * vm, char * mod_name) {
     struct v3_symmod_state * symmod_state = &(vm->sym_vm_state.symmod_state);
 
     PrintDebug("Loading Module (%s)\n", mod_name);
 
-    return symmod_state->loader_ops->load_module(vm, mod_name, 16, symmod_state->loader_data);
+    return symmod_state->loader_ops->load_module(vm, test_module.name, test_module.num_bytes, symmod_state->loader_data);
 }
 
+
+
+
 struct v3_sym_module * v3_get_sym_module(struct v3_vm_info * vm, char * name) {
     return &test_module;
 }