source "./modules/linux_mods/Kconfig"
+source "./modules/v3_mods/Kconfig"
\ No newline at end of file
obj-$(CONFIG_LNX_MOD_32BIT) += linux_mods/i386/
#obj-$(CONFIG_LNX_MOD_64BIT) += linux_mods/x86_64/
+obj-$(CONFIG_V3_MOD_32BIT) += v3_mods/i386/
+#obj-$(CONFIG_V3_MOD_64BIT) += v3_mods/x86_64/
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);
+register_module("test_32", v3_lnx_mod_32bit_test_start, v3_lnx_mod_32bit_test_stop, V3_SYMMOD_LNX);
#endif
--- /dev/null
+
+
+
+config V3_MODS
+ bool "V3VEE Symbiotic modules"
+ select V3_MOD_32BIT
+ select V3_MOD_64BIT
+
+
+
+
+
+config V3_MOD_32BIT
+ bool "32 bit modules"
+ depends on V3_MODS
+
+config V3_MOD_32BIT_TEST
+ bool "V3 Sym (i386) test module"
+ default y if SYMMOD
+ depends on V3_MOD_32BIT
+ help
+ This is a simple 32 bit test Symbiotic Module
+
+
+
+
+config V3_MOD_64BIT
+ bool "64 bit modules"
+ depends on V3_MODS
+ default y
+
--- /dev/null
+
+
+
+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
--- /dev/null
+obj-$(CONFIG_LNX_MOD_32BIT) += binaries.o headers.o
\ No newline at end of file
--- /dev/null
+#; -*- 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/v3_mods/i386/binaries/name)
+
+
+#ifdef CONFIG_V3_MOD_32BIT_TEST
+.globl v3_mod_32bit_test_start
+v3_mod_32bit_test_start:
+.incbin MOD_DIR(test.vo)
+.globl v3_mod_32bit_test_stop
+v3_mod_32bit_test_stop:
+#endif
+
--- /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) 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_V3_MOD_32BIT_TEST
+extern uint8_t v3_mod_32bit_test_start[];
+extern uint8_t v3_mod_32bit_test_stop[];
+
+register_module("v3_test_32", v3_mod_32bit_test_start, v3_mod_32bit_test_stop, V3_SYMMOD_MOD);
+#endif
TEST_HCALL = 0x0001,
SYMCALL_RET_HCALL = 0x0535, // args in GPRs
SYMCALL_ERR_HCALL = 0x0536, // RBX: error code
+
+ /* -- Symmod symbol table hypercall --
+ * RBX: SymTable start
+ * RCX: SymTable size
+ * RDX: SymStrs start
+ * RSI: SymStrs size
+ */
+ SYMMOD_SYMS_HCALL = 0x0600,
+
MEM_OFFSET_HCALL = 0x1000, // RBX: base addr(out)
GUEST_INFO_HCALL = 0x3000, // no args
TELEMETRY_HCALL = 0x3001, // no args
+/**
+ * list_next_entry -- get the struct for the next entry in a list
+ * @ptr: current list entry
+ * @type: type of the struct this is embedded in
+ * @member: name of the list struct within the struct
+ */
+#define list_next_entry(node, type, member) \
+ ({ \
+ type * next = NULL; \
+ if ((node)->next != (node)) { \
+ next = list_entry((node)->next, type, member); \
+ } \
+ next; \
+ })
+
/**
* list_for_each - iterate over a list
struct v3_symmod_loader_ops * loader_ops;
void * loader_data;
-
struct hashtable * module_table;
};
+#define V3_SYMMOD_INV (0x00000000)
+#define V3_SYMMOD_LNX (0x00000001)
+#define V3_SYMMOD_MOD (0x00000002)
+#define V3_SYMMOD_SEC (0x00000003)
+union v3_symmod_flags {
+ uint32_t flags;
+ struct {
+ uint8_t type;
+ } __attribute__((packed));
+} __attribute__((packed));
+
struct v3_sym_module {
char * name;
void * start_addr;
void * end_addr;
+ uint32_t flags; // see 'struct v3_symmod_flags'
} __attribute__((packed));
+
+
int v3_set_symmod_loader(struct v3_vm_info * vm, struct v3_symmod_loader_ops * ops, void * priv_data);
int v3_load_sym_module(struct v3_vm_info * vm, char * mod_name);
-
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);
-#define register_module(name, start, end) \
+#define register_module(name, start, end, flags) \
static char v3_module_name[] = name; \
static struct v3_sym_module _v3_module \
__attribute__((__used__)) \
__attribute__((unused, __section__ ("_v3_modules"), \
aligned(sizeof(addr_t)))) \
- = {v3_module_name, start, end};
+ = {v3_module_name, start, end, flags};
int V3_init_symmod();
}
- if (q->cur_avail_idx < q->avail->index) {
+ if (q->cur_avail_idx != q->avail->index) {
uint16_t notifier_idx = q->avail->ring[q->cur_avail_idx % q->queue_size];
struct symmod_hdr * notifier = NULL;
struct vring_desc * notifier_desc = NULL;
master_mod_table = v3_create_htable(0, mod_hash_fn, mod_eq_fn);
while (tmp_mod != __stop__v3_modules) {
-
if (v3_htable_search(master_mod_table, (addr_t)(tmp_mod->name))) {
PrintError("Multiple instances of Module (%s)\n", tmp_mod->name);
return -1;
- }
-
-
+ }
PrintDebug("Registering Symbiotic Module (%s)\n", tmp_mod->name);
if (v3_htable_insert(master_mod_table,
PrintError("Could not insert module %s to master list\n", tmp_mod->name);
return -1;
}
-
-
tmp_mod = &(__start__v3_modules[++i]);
}
-
return 0;
}
struct v3_sym_module * v3_get_sym_module(struct v3_vm_info * vm, char * name) {
struct v3_sym_module * mod = (struct v3_sym_module *)v3_htable_search(master_mod_table, (addr_t)name);
-
if (!mod) {
PrintError("Could not find module %s\n", name);
return NULL;