+
+
#define register_module(name, start, end, flags) \
static char v3_module_name[] = name; \
static struct v3_sym_module _v3_module \
static struct hashtable * master_mod_table = NULL;
-
+/*
+ * This is a place holder to ensure that the _v3_modules section gets created
+ */
+static struct {} null_mod __attribute__((__used__)) \
+ __attribute__((unused, __section__ ("_v3_modules"), \
+ aligned(sizeof(addr_t))));
static uint_t mod_hash_fn(addr_t key) {
char * name = (char *)key;
struct v3_sym_module * tmp_mod = __start__v3_modules;
int i = 0;
+ if (tmp_mod == __stop__v3_modules) {
+ PrintDebug("No Symbiotic modules found\n");
+ return 0;
+ }
+
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,
# cpp -undef $(DEFS) binary.S -o $(MOD_DIR)/.tmp.binary.S
# cpp $(DEFS) $(MOD_DIR)/.tmp.binary.S
+CFLAGS := -fno-stack-protector -Wall -O -Werror -fPIC -mno-red-zone
module: FORCE
cpp -undef $(DEFS) binary.S -o $(MOD_DIR)/.tmp.binary.S
- gcc $(DEFS) -c $(MOD_DIR)/.tmp.binary.S -o $(MOD_DIR)/$(MOD_NAME).vo
+ gcc $(CFLAGS) $(DEFS) -c $(MOD_DIR)/.tmp.binary.S -o $(MOD_DIR)/$(MOD_NAME).vo
rm -f $(MOD_DIR)/.tmp.binary.S
FORCE:
PALACIOSDIR := $(PWD)/../../capsule
V3_MOD_TYPE := V3_LINUX_MOD
-default:
+
+linux: FORCE
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
+
+capsule: FORCE
$(MAKE) -C $(PALACIOSDIR) MOD_NAME=$(V3_MOD_NAME) MOD_DIR=$(PWD) \
MOD_OBJ=$(V3_MOD_OBJ) MOD_TYPE=$(V3_MOD_TYPE)
+default: linux capsule
+
+FORCE:
+
endif