Commit e1cef62b authored by Charles Jacobsen's avatar Charles Jacobsen Committed by Vikram Narayanan

libasync-integration: All the code builds with libfipc and libasync.

parent 1a7821fb
......@@ -48,9 +48,12 @@
# Common top-level vars used throughout
LCD_DOMAINS_TOP_SRC_DIR=$(PWD)
export LCD_DOMAINS_TOP_SRC_DIR
export LCD_DOMAINS_CFLAGS=-Werror \
-DLCD_DOMAINS \
-DLCD_TEST_MODS_PATH="\"$(PWD)/build/test_mods\""
export LCD_DOMAINS_CFLAGS=\
-Werror \
-Wall \
-DLCD_DOMAINS \
-DLINUX_KERNEL \
-DLCD_TEST_MODS_PATH=\"$(PWD)/build/test_mods\"
# Don't print "Entering directory..." etc.
MAKEFLAGS += --no-print-directory
......@@ -85,6 +88,17 @@ all:
MICROKERNEL_BUILD_DIR=$(LCD_BUILD_DIR)/microkernel_build
export MICROKERNEL_BUILD_DIR
MICROKERNEL_CFLAGS= \
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(MICROKERNEL_BUILD_DIR)/libcap.install/include \
-I$(MICROKERNEL_BUILD_DIR)/libfipc.install/include \
-I$(MICROKERNEL_BUILD_DIR)/libasync.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated \
-DLINUX_KERNEL_MODULE
export MICROKERNEL_CFLAGS
MICROKERNEL_DIRS= \
microkernel \
kliblcd \
......@@ -99,12 +113,11 @@ MICROKERNEL_DIRS= \
MICROKERNEL_BUILD_DIRS=$(foreach dir,$(MICROKERNEL_DIRS),\
$(MICROKERNEL_BUILD_DIR)/$(dir))
MICROKERNEL_LIB_CFLAGS= \
"-Wall -DLCD_DOMAINS -I$(LCD_DOMAINS_TOP_SRC_DIR)/include -I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include -I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated"
MICROKERNEL_LIB_CFLAGS= $(MICROKERNEL_CFLAGS)
MICROKERNEL_LIBCAP=$(MICROKERNEL_BUILD_DIR)/libcap.install/lib/libcap.a
MICROKERNEL_LIBFIPC=$(MICROKERNEL_BUILD_DIR)/libfipc.install/lib/libfipc.a
MICROKERNEL_LIBASYNC=$(MICROKERNEL_BUILD_DIR)/libcap.install/lib/libasync.a
MICROKERNEL_LIBASYNC=$(MICROKERNEL_BUILD_DIR)/libasync.install/lib/libasync.a
microkernel: $(MICROKERNEL_BUILD_DIR)/Kbuild | \
$(MICROKERNEL_LIBCAP) $(MICROKERNEL_LIBFIPC) $(MICROKERNEL_LIBASYNC) \
......@@ -113,7 +126,7 @@ microkernel: $(MICROKERNEL_BUILD_DIR)/Kbuild | \
libcap.microkernel: $(MICROKERNEL_BUILD_DIR)/libcap.build/Makefile
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libcap.build \
CFLAGS=$(MICROKERNEL_LIB_CFLAGS) $(MAKEFLAGS) && \
CFLAGS="$(MICROKERNEL_LIB_CFLAGS)" $(MAKEFLAGS) && \
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libcap.build install $(MAKEFLAGS)
$(MICROKERNEL_BUILD_DIR)/libcap.build/Makefile: libcap/configure | \
......@@ -130,20 +143,20 @@ $(MICROKERNEL_BUILD_DIR)/libcap.build/Makefile: libcap/configure | \
libfipc.microkernel: $(MICROKERNEL_BUILD_DIR)/libfipc.build/Makefile
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libfipc.build \
CFLAGS=$(MICROKERNEL_LIB_CFLAGS) $(MAKEFLAGS) && \
CFLAGS="$(MICROKERNEL_LIB_CFLAGS)" $(MAKEFLAGS) && \
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libfipc.build install $(MAKEFLAGS)
$(MICROKERNEL_BUILD_DIR)/libfipc.build/Makefile: \
libasync/fast-ipc-module/configure | \
$(MICROKERNEL_BUILD_DIRS)
cd $(MICROKERNEL_BUILD_DIR)/libfipc.build && \
$(LCD_DOMAINS_TOP_SRC_DIR)/libfipc/configure \
$(LCD_DOMAINS_TOP_SRC_DIR)/libasync/fast-ipc-module/configure \
--with-kernel-headers=$(LCD_DOMAINS_TOP_SRC_DIR)/.. \
--prefix=$(MICROKERNEL_BUILD_DIR)/libfipc.install
libasync.microkernel: $(MICROKERNEL_BUILD_DIR)/libasync.build/Makefile
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libasync.build \
CFLAGS=$(MICROKERNEL_LIB_CFLAGS) $(MAKEFLAGS) && \
CFLAGS="$(MICROKERNEL_LIB_CFLAGS)" $(MAKEFLAGS) && \
$(MAKE) -C $(MICROKERNEL_BUILD_DIR)/libasync.build install $(MAKEFLAGS)
$(MICROKERNEL_BUILD_DIR)/libasync.build/Makefile: libasync/configure | \
......@@ -168,10 +181,24 @@ $(MICROKERNEL_BUILD_DIRS):
LIBLCD_BUILD_DIR=$(LCD_BUILD_DIR)/liblcd_build
export LIBLCD_BUILD_DIR
LIBLCD_CFLAGS=\
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(LIBLCD_BUILD_DIR)/libcap.install/include \
-I$(LIBLCD_BUILD_DIR)/libfipc.install/include \
-I$(LIBLCD_BUILD_DIR)/libasync.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated \
-DCONFIG_LAZY_THC \
-DMODULE \
-DLCD_ISOLATE \
-DCPTR_CACHE_LOCK_PADDING_SIZE=8
export LIBLCD_CFLAGS
LIBLCD_DIRS=$(shell cd liblcd && find . -mindepth 1 -type d)
LIBLCD_DIRS:=$(foreach d,$(LIBLCD_DIRS),liblcd/$(d))
LIBLCD_DIRS:= \
$(LIBLCD_DIRS)
$(LIBLCD_DIRS) \
libcap.build \
libcap.install \
libfipc.build \
......@@ -186,8 +213,7 @@ LIBLCD_LIBCAP=$(LIBLCD_BUILD_DIR)/libcap.install/lib/libcap.a
LIBLCD_LIBFIPC=$(LIBLCD_BUILD_DIR)/libfipc.install/lib/libfipc.a
LIBLCD_LIBFIPC=$(LIBLCD_BUILD_DIR)/libasync.install/lib/libasync.a
LIBLCD_LIB_CFLAGS= \
"-Wall -DLCD_DOMAINS -DLCD_ISOLATE -DCPTR_CACHE_LOCK_PADDING_SIZE=8 -I$(LCD_DOMAINS_TOP_SRC_DIR)/include -I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include -I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated"
LIBLCD_LIB_CFLAGS= $(LIBLCD_CFLAGS)
# There isn't a nice easy way to multiline this, and I want access to the
# LIBLCD_BUILD_DIR variable (so I don't want to create a separate file); so
......@@ -205,7 +231,7 @@ $(LIBLCD_BUILD_DIR)/lib.a: $(LIBLCD_BUILD_DIR)/Kbuild | \
libcap.liblcd: $(LIBLCD_BUILD_DIR)/libcap.build/Makefile
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libcap.build \
CFLAGS=$(LIBLCD_LIB_CFLAGS) $(MAKEFLAGS) && \
CFLAGS="$(LIBLCD_LIB_CFLAGS)" $(MAKEFLAGS) && \
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libcap.build install $(MAKEFLAGS)
$(LIBLCD_BUILD_DIR)/libcap.build/Makefile: libcap/configure | \
......@@ -221,20 +247,20 @@ $(LIBLCD_BUILD_DIR)/libcap.build/Makefile: libcap/configure | \
libfipc.liblcd: $(LIBLCD_BUILD_DIR)/libfipc.build/Makefile
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libfipc.build \
CFLAGS=$(LIBLCD_LIB_CFLAGS) $(MAKEFLAGS) && \
CFLAGS="$(LIBLCD_LIB_CFLAGS)" $(MAKEFLAGS) && \
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libfipc.build install $(MAKEFLAGS)
$(LIBLCD_BUILD_DIR)/libfipc.build/Makefile: \
libasync/fast-ipc-module/configure | \
$(LIBLCD_BUILD_DIRS)
cd $(LIBLCD_BUILD_DIR)/libfipc.build && \
$(LCD_DOMAINS_TOP_SRC_DIR)/libfipc/configure \
$(LCD_DOMAINS_TOP_SRC_DIR)/libasync/fast-ipc-module/configure \
--with-kernel-headers=$(LCD_DOMAINS_TOP_SRC_DIR)/.. \
--prefix=$(LIBLCD_BUILD_DIR)/libfipc.install
libasync.liblcd: $(LIBLCD_BUILD_DIR)/libasync.build/Makefile
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libasync.build \
CFLAGS=$(LIBLCD_LIB_CFLAGS) $(MAKEFLAGS) && \
CFLAGS="$(LIBLCD_LIB_CFLAGS)" $(MAKEFLAGS) && \
$(MAKE) -C $(LIBLCD_BUILD_DIR)/libasync.build install $(MAKEFLAGS)
$(LIBLCD_BUILD_DIR)/libasync.build/Makefile: libasync/configure | \
......
......@@ -7,6 +7,7 @@
#include <libcap.h>
#include <liblcd/liblcd.h>
#include <lcd_domains/microkernel.h>
#include <thc.h>
int lcd_enter(void)
{
......@@ -85,7 +86,11 @@ int lcd_enter(void)
LCD_ERR("creating resource tree");
goto fail8;
}
current->lcd_resource_trees[1] = t;
current->lcd_resource_trees[1] = t;
/*
* Set up thc runtime
*/
thc_init();
return 0;
......@@ -138,10 +143,14 @@ void lcd_exit(int retval)
lcd_destroy_free_resource_tree(current->lcd_resource_trees[0]);
if (current->lcd_resource_trees[1])
lcd_destroy_free_resource_tree(current->lcd_resource_trees[1]);
if (current->ptstate)
thc_done();
current->lcd = NULL;
current->cptr_cache = NULL;
current->lcd_resource_trees[0] = NULL;
current->lcd_resource_trees[1] = NULL;
current->ptstate = NULL;
/* (Call endpoint should be auto-destroyed when we destroy
* the LCD because this will destroy its cspace. So long as
* the LCD didn't grant the endpoint to someone.) */
......
Subproject commit 4e5c8fa7edc07b501c6938cd19bccdcccd34f265
Subproject commit 2f13590cf0e76ba4d2d13a731dc673bdd0d90adf
......@@ -10,6 +10,7 @@
#include <liblcd/enter_exit.h>
#include <thc.h>
#include <libfipc.h>
#include <lcd_domains/liblcd.h>
#include <asm/lcd_domains/liblcd.h>
......@@ -70,9 +71,22 @@ int lcd_enter(void)
goto fail;
}
LIBLCD_MSG("libcap initialized");
/*
* Initialize libfipc
*/
ret = fipc_init();
if (ret) {
LIBLCD_ERR("failed to init libfipc");
goto fail;
}
/*
* Set up async runtime
*/
ret = thc_global_init();
if (ret) {
LIBLCD_ERR("failed to init libasync");
goto fail;
}
thc_init();
thc_initialized = 1;
LIBLCD_MSG("async runtime initialized");
......
......@@ -21,6 +21,9 @@
#include <uapi/lcd_domains.h>
#include <lcd_domains/microkernel.h>
#include <asm/lcd_domains/init.h>
#include <libcap.h>
#include <libfipc.h>
#include <thc.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("LCD driver");
......@@ -139,11 +142,25 @@ static int __init lcd_init(void)
LCD_ERR("misc device register failed, ret = %d", ret);
goto fail8;
}
ret = fipc_init();
if (ret) {
LCD_ERR("error initializing libfipc, ret = %d", ret);
goto fail9;
}
ret = thc_global_init();
if (ret) {
LCD_ERR("error initialing libasync, ret = %d", ret);
goto fail10;
}
LCD_MSG("lcd microkernel initialized");
return 0;
fail10:
fipc_fini();
fail9:
misc_deregister(&lcd_dev);
fail8:
__lcd_console_exit();
fail7:
......@@ -166,6 +183,8 @@ fail0:
static void __exit lcd_exit(void)
{
thc_global_fini();
fipc_fini();
misc_deregister(&lcd_dev);
__lcd_console_exit();
__lcd_run_exit();
......
......@@ -52,14 +52,4 @@ lib-y += $(addprefix common/, \
# libcap is linked in with ar script
# Extra includes
ccflags-y += \
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(LIBLCD_BUILD_DIR)/libcap.install/include \
-I$(LIBLCD_BUILD_DIR)/libfipc.install/include \
-I$(LIBLCD_BUILD_DIR)/libasync.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated \
-DCONFIG_LAZY_THC \
-DMODULE \
-DLCD_ISOLATE
ccflags-y += $(LIBLCD_CFLAGS)
......@@ -59,12 +59,9 @@ lcd_domains-y += $(addprefix common/, \
# because this build of libcap does not use global cap types.)
lcd_domains-y += libcap.install/lib/libcap.a
# libfipc and libasync
lcd_domains-y += libfipc.install/lib/libfipc.a
lcd_domains-y += libasync.install/lib/libasync.a
# Extra includes
ccflags-y += \
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include \
-I$(MICROKERNEL_BUILD_DIR)/libcap.install/include \
-I$(MICROKERNEL_BUILD_DIR)/libfipc.install/include \
-I$(MICROKERNEL_BUILD_DIR)/libasync.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated
\ No newline at end of file
ccflags-y += $(MICROKERNEL_CFLAGS)
......@@ -4,28 +4,9 @@
# Some of these variables are exported from the top-level Makefile.
#
COMMON_CC_FLAGS= \
$(LCD_DOMAINS_CFLAGS) \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/arch/$(ARCH)/include
export ISOLATED_CC_FLAGS= $(LIBLCD_CFLAGS)
export ISOLATED_CC_FLAGS= \
$(COMMON_CC_FLAGS) \
-I$(LIBLCD_BUILD_DIR)/libcap.install/include \
-I$(LIBLCD_BUILD_DIR)/libfipc.install/include \
-I$(LIBLCD_BUILD_DIR)/libasync.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/isolated \
-DLCD_ISOLATE \
-DCONFIG_LAZY_THC \
-DCPTR_CACHE_LOCK_PADDING_SIZE=8
export NON_ISOLATED_CC_FLAGS= \
$(COMMON_CC_FLAGS) \
-I$(MICROKERNEL_BUILD_DIR)/libcap.install/include \
-I$(MICROKERNEL_BUILD_DIR)/libfipc.install/include \
-I$(MICROKERNEL_BUILD_DIR)/libasync.install/include \
-I$(LCD_DOMAINS_TOP_SRC_DIR)/config/non_isolated
export NON_ISOLATED_CC_FLAGS= $(MICROKERNEL_CFLAGS)
# Examples
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment