diff --git a/arch/x86/elfboot/Makefile b/arch/x86/elfboot/Makefile index fba5f87a..d4f98122 100644 --- a/arch/x86/elfboot/Makefile +++ b/arch/x86/elfboot/Makefile @@ -1,28 +1,29 @@ CFLAGS=-c -Wall -O CFLAGS_TEST=-DTEST -all: elfboot elfboot_test +all: elfboot elfboot: elfboot.bin cp $^ $@ truncate -s $(shell expr '(' `stat -c '%s' $^` + 4095 ')' / 4096 '*' 4096) $@ elfboot.bin: elfboot.elf - objcopy -O binary $^ $@ + $(OBJCOPY) -O binary $^ $@ elfboot.elf: head.o elfboot.raw.o raw.lds - ld $(LDFLAGS_RAW) -T raw.lds -o $@ $^ + $(LD) $(LDFLAGS_RAW) -T raw.lds -o $@ $^ elfboot_test: elfboot.test.o test_main.o - gcc $(LDFLAGS) -o $@ $^ + $(CC) -o $@ $^ elfboot.raw.o: elfboot.c - gcc $(CFLAGS) -o $@ $^ + $(CC) $(CFLAGS) -o $@ $^ + elfboot.test.o: elfboot.c - gcc $(CFLAGS) $(CFLAGS_TEST) -o $@ $^ + $(CC) $(CFLAGS) $(CFLAGS_TEST) -o $@ $^ clean: $(RM) elfboot *.bin *.elf elfboot_test *.o disas: - objdump -b binary -m i386:x86-64 -D elfboot.bin + $(OBJDUMP) -b binary -m i386:x86-64 -D elfboot.bin diff --git a/arch/x86/kernel/cpu.c b/arch/x86/kernel/cpu.c index 45785c23..7508842f 100644 --- a/arch/x86/kernel/cpu.c +++ b/arch/x86/kernel/cpu.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include diff --git a/arch/x86/kernel/include/arch-lock.h b/arch/x86/kernel/include/arch-lock.h index 7b811f16..a342eb87 100644 --- a/arch/x86/kernel/include/arch-lock.h +++ b/arch/x86/kernel/include/arch-lock.h @@ -4,7 +4,7 @@ #ifndef __HEADER_X86_COMMON_ARCH_LOCK #define __HEADER_X86_COMMON_ARCH_LOCK -#include +#include //#define DEBUG_SPINLOCK diff --git a/arch/x86/kernel/include/ihk/ikc.h b/arch/x86/kernel/include/ihk/ikc.h index 24e2bd40..7cdf834c 100644 --- a/arch/x86/kernel/include/ihk/ikc.h +++ b/arch/x86/kernel/include/ihk/ikc.h @@ -1,7 +1,7 @@ #ifndef HEADER_X86_COMMON_AAL_IKC_H #define HEADER_X86_COMMON_AAL_IKC_H -#include +#include /* manycore side */ int aal_mc_ikc_init_first(struct aal_ikc_channel_desc *, diff --git a/arch/x86/kernel/local.c b/arch/x86/kernel/local.c index 0f811a84..aba8a0b9 100644 --- a/arch/x86/kernel/local.c +++ b/arch/x86/kernel/local.c @@ -1,8 +1,8 @@ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/arch/x86/kernel/lock.c b/arch/x86/kernel/lock.c index 43cfa0fc..9307b848 100644 --- a/arch/x86/kernel/lock.c +++ b/arch/x86/kernel/lock.c @@ -1,4 +1,4 @@ -#include +#include #if 0 diff --git a/arch/x86/kernel/memory.c b/arch/x86/kernel/memory.c index bae2b717..e2170736 100644 --- a/arch/x86/kernel/memory.c +++ b/arch/x86/kernel/memory.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/arch/x86/kernel/mikc.c b/arch/x86/kernel/mikc.c index 64e25305..da8c9754 100644 --- a/arch/x86/kernel/mikc.c +++ b/arch/x86/kernel/mikc.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include #include diff --git a/arch/x86/kernel/perfctr.c b/arch/x86/kernel/perfctr.c index 3a617ecb..bc0d5b03 100644 --- a/arch/x86/kernel/perfctr.c +++ b/arch/x86/kernel/perfctr.c @@ -1,7 +1,7 @@ -#include +#include #include #include -#include +#include #include extern unsigned int *x86_march_perfmap; diff --git a/executer/kernel/Makefile b/executer/kernel/Makefile index 64b76d37..72ef552c 100644 --- a/executer/kernel/Makefile +++ b/executer/kernel/Makefile @@ -1,17 +1,12 @@ - -#ifeq ($(K),"current") -KDIR=/lib/modules/`uname -r `/build -#else -#KDIR=../target -#endif - +KDIR ?= /lib/modules/`uname -r `/build obj-m += mcctrl.o mcctrl-objs := driver.o control.o ikc.o syscall.o -AALBASE ?= $(src)/../../../aal -EXTRA_CFLAGS = -I$(AALBASE)/host/include -I$(AALBASE)/host/driver/knf -I$(AALBASE)/include -I$(AALBASE)/ikc/include -I$(src)/../include +IHK_BASE=$(src)/../../../ihk +EXTRA_CFLAGS = -I$(IHK_BASE)/linux/include -I$(IHK_BASE)/ikc/include -I$(IHK_BASE)/include -I$(src)/../include +KBUILD_EXTRA_SYMBOLS = $(IHK_BASE)/linux/core/Module.symvers .PHONY: clean install diff --git a/executer/kernel/control.c b/executer/kernel/control.c index 6080fbf2..1722ad87 100644 --- a/executer/kernel/control.c +++ b/executer/kernel/control.c @@ -8,7 +8,6 @@ #include #include #include -#include #include "mcctrl.h" #ifdef DEBUG diff --git a/executer/kernel/driver.c b/executer/kernel/driver.c index 8f3bf9c5..93e74475 100644 --- a/executer/kernel/driver.c +++ b/executer/kernel/driver.c @@ -7,7 +7,6 @@ #include #include #include -#include #include "mcctrl.h" extern long __mcctrl_control(aal_os_t, unsigned int, unsigned long); diff --git a/executer/kernel/ikc.c b/executer/kernel/ikc.c index 67be93c5..db2f1558 100644 --- a/executer/kernel/ikc.c +++ b/executer/kernel/ikc.c @@ -4,9 +4,9 @@ #include #include #include "mcctrl.h" -#include +#include #include -#include +#include #define REQUEST_SHIFT 16 diff --git a/executer/kernel/mcctrl.h b/executer/kernel/mcctrl.h index 8f9d604a..26157228 100644 --- a/executer/kernel/mcctrl.h +++ b/executer/kernel/mcctrl.h @@ -1,7 +1,7 @@ #ifndef HEADER_MCCTRL_H #define HEADER_MCCTRL_H -#include +#include #include #include diff --git a/executer/user/Makefile b/executer/user/Makefile index f23ce6c1..d74f1d68 100644 --- a/executer/user/Makefile +++ b/executer/user/Makefile @@ -1,9 +1,16 @@ -CFLAGS = -O3 -Wall -g -pthread +#CC=/usr/linux-k1om-4.7/bin/x86_64-k1om-linux-gcc +CC=gcc +CFLAGS=-Wall -O +TARGET=mcexec -all: mcexec +all: $(TARGET) mcexec: mcexec.c - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^ $(EXTRA_OBJS) + $(CC) $(CFLAGS) -pthread -o $@ $^ clean: - rm -f mcexec + $(RM) $(TARGET) *.o + +.PHONY: all clean + + diff --git a/kernel/Makefile b/kernel/Makefile index 489d4e67..8a416e14 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -1,8 +1,8 @@ -#BUILD_TARGET = mee knf -BUILD_TARGET = knf +#BUILD_TARGET = builtin-mic attached-mic +BUILD_TARGET = attached-mic SRC = $(CURDIR) -AALBASE ?= $(SRC)/../../aal/manycore +IHKBASE ?= $(SRC)/../../ihk/cokernel O ?= $(KBUILD_OUTPUT) V ?= $(VERBOSE) @@ -12,8 +12,8 @@ KERNELS = $(addsuffix /$(KERNEL),$(addprefix $(O)/,$(BUILD_TARGET))) SUBCMD_OPTS = V='$(V)' $(if $(O),,$(error Specify the compilation target directory)) -$(if $(shell ls $(AALBASE)/Makefile),,\ - $(error AAL is not found in $(AALBASE))) +#$(if $(shell ls $(IHKBASE)/Makefile),,\ +# $(error IHK is not found in $(IHKBASE))) .PHONY: all clean depend @@ -26,8 +26,9 @@ all: $(KERNELS) %/Makefile: Makefile.build FORCE @mkdir -p $(dir $@) @echo 'SRC = $(SRC)' > $@ - @echo 'AALBASE = $(AALBASE)' >> $@ + @echo 'IHKBASE = $(IHKBASE)' >> $@ @echo 'TARGET = $(notdir $(patsubst %/,%,$(dir $@)))' >> $@ + @echo 'TARGETDIR = $$(shell echo $$(TARGET) | sed "s/-/\//")' >> $@ @cat Makefile.build >> $@ @rm -f $(dir $@)/Makefile.dep diff --git a/kernel/Makefile.build b/kernel/Makefile.build index d5f3f4d4..77ce92ef 100644 --- a/kernel/Makefile.build +++ b/kernel/Makefile.build @@ -1,42 +1,44 @@ -AALDIR=$(AALBASE)/$(TARGET) +IHKDIR=$(IHKBASE)/$(TARGETDIR) OBJS = init.o mem.o debug.o mikc.o listeners.o ap.o syscall.o cls.o host.o OBJS += process.o copy.o waitq.o futex.o timer.o DEPSRCS=$(wildcard $(SRC)/*.c) CFLAGS += -I$(SRC)/include -mcmodel=kernel -D__KERNEL__ LDFLAGS += -e arch_start -AALOBJ = aal/aal.o +IHKOBJ = ihk/ihk.o -include $(SRC)/configs/config.$(TARGET) -include $(AALBASE)/Makefile.common +include $(SRC)/config/config.$(TARGET) +include $(IHKBASE)/Makefile.common -SUBCMD_OPTS = TARGET=$(TARGET) O=$(CURDIR)/aal CC=$(CC) LD=$(LD) +# CFLAGS += -I$(SRC)/../arch/$(IHKARCH)/kernel/include -I$(SRC)/../lib/include + +SUBCMD_OPTS = TARGET=$(TARGET) O=$(CURDIR)/ihk CC=$(CC) LD=$(LD) SRC=$(SRC) ld_kern_cmd_base = $(LD) $(LDFLAGS) -o $@.elf $^ -mkimage_cmd_base = [ -f $(SRC)/scripts/mkimage.$(TARGET) ] && CC=$(CC) LD=$(LD) LDFLAGS="$(LDFLAGS_MKIMAGE)" sh $(SRC)/scripts/mkimage.$(TARGET) '$@.elf' '$@' '$(SRC)' || cp $@.elf $@ +mkimage_cmd_base = [ -f $(SRC)/script/mkimage.$(TARGET) ] && CC=$(CC) LD=$(LD) LDFLAGS="$(LDFLAGS_MKIMAGE)" OBJDUMP=$(OBJDUMP) OBJCOPY=$(OBJCOPY) sh $(SRC)/script/mkimage.$(TARGET) '$@.elf' '$@' '$(SRC)' || cp $@.elf $@ ld_kern_cmd = $(call echo_cmd,LDKERN,$@)$(ld_kern_cmd_base) mkimage_cmd = $(call echo_cmd,MKIMAGE,$@)$(mkimage_cmd_base) all: depend kernel.img -kernel.img: $(OBJS) $(AALOBJ) +kernel.img: $(OBJS) $(IHKOBJ) $(ld_kern_cmd) $(mkimage_cmd) clean: $(rm_cmd) $(OBJS) kernel.img kernel.img.elf Makefile.dep - @$(submake) -C $(AALBASE) $(SUBCMD_OPTS) clean + @$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) clean depend: Makefile.dep Makefile.dep: $(call dep_cmd,$(DEPSRCS)) -$(AALOBJ): FORCE - @mkdir -p $(dir $(AALOBJ)) - $(call echo_cmd,BUILD AAL,$(TARGET))$(submake) -C $(AALBASE) $(SUBCMD_OPTS) prepare - $(call echo_cmd,BUILD AAL,$(TARGET))$(submake) -C $(AALBASE) $(SUBCMD_OPTS) +$(IHKOBJ): FORCE + @mkdir -p $(dir $(IHKOBJ)) + $(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) prepare + $(call echo_cmd,BUILD IHK,$(TARGET))$(submake) -C $(IHKBASE) $(SUBCMD_OPTS) %.o: $(SRC)/%.c $(cc_cmd) diff --git a/kernel/ap.c b/kernel/ap.c index 15d8f953..635673e8 100644 --- a/kernel/ap.c +++ b/kernel/ap.c @@ -1,8 +1,8 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kernel/cls.c b/kernel/cls.c index 2a664bf1..9b84569c 100644 --- a/kernel/cls.c +++ b/kernel/cls.c @@ -1,10 +1,10 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include diff --git a/kernel/config/config.attached-mic b/kernel/config/config.attached-mic index fc0f89fb..ab475226 100644 --- a/kernel/config/config.attached-mic +++ b/kernel/config/config.attached-mic @@ -2,5 +2,5 @@ CC = /opt/knc/linux-k1om-4.7/bin/x86_64-k1om-linux-gcc LD = /opt/knc/linux-k1om-4.7/bin/x86_64-k1om-linux-ld CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -LDFLAGS += -m elf_k1om -T $(SRC)/knf.lds +LDFLAGS += -m elf_k1om -T $(SRC)/config/attached-mic.lds LDFLAGS_MKIMAGE = -m elf_k1om diff --git a/kernel/config/config.builtin-x86 b/kernel/config/config.builtin-x86 index af80a7d3..9cf1b0c6 100644 --- a/kernel/config/config.builtin-x86 +++ b/kernel/config/config.builtin-x86 @@ -1,2 +1,2 @@ CFLAGS += -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -LDFLAGS += -T $(SRC)/mee.lds +LDFLAGS += -T $(SRC)/config/builtin-x86.lds diff --git a/kernel/copy.c b/kernel/copy.c index c4f28885..ba98a0d1 100644 --- a/kernel/copy.c +++ b/kernel/copy.c @@ -1,4 +1,4 @@ -#include +#include #include int memcpy_async(unsigned long dest, unsigned long src, diff --git a/kernel/debug.c b/kernel/debug.c index 1d5c8026..3f4f5b62 100644 --- a/kernel/debug.c +++ b/kernel/debug.c @@ -1,8 +1,8 @@ #include #include #include -#include -#include +#include +#include struct aal_kmsg_buf kmsg_buf AAL_KMSG_ALIGN; diff --git a/kernel/futex.c b/kernel/futex.c index 5d2c0fd3..09d15303 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -58,7 +58,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kernel/host.c b/kernel/host.c index 13e3c1c6..9e6e420c 100644 --- a/kernel/host.c +++ b/kernel/host.c @@ -1,9 +1,9 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/kernel/include/amemcpy.h b/kernel/include/amemcpy.h index 891c0b48..c1652843 100644 --- a/kernel/include/amemcpy.h +++ b/kernel/include/amemcpy.h @@ -1,7 +1,7 @@ #ifndef HEADER_AMEMCPY_H #define HEADER_AMEMCPY_H -#include +#include static void memcpy_async_wait(unsigned long *notify) { diff --git a/kernel/include/cls.h b/kernel/include/cls.h index 17c7f86b..e64796a0 100644 --- a/kernel/include/cls.h +++ b/kernel/include/cls.h @@ -12,7 +12,7 @@ struct malloc_header { unsigned long size; }; -#include +#include #define CPU_STATUS_DISABLE (0) #define CPU_STATUS_IDLE (1) #define CPU_STATUS_RUNNING (2) diff --git a/kernel/include/futex.h b/kernel/include/futex.h index 72a5e1ac..f537a353 100644 --- a/kernel/include/futex.h +++ b/kernel/include/futex.h @@ -55,7 +55,7 @@ #ifdef __KERNEL__ -#include +#include #include #include #include diff --git a/kernel/include/kmalloc.h b/kernel/include/kmalloc.h index 7370ae7c..3c7402d7 100644 --- a/kernel/include/kmalloc.h +++ b/kernel/include/kmalloc.h @@ -1,7 +1,7 @@ #ifndef __HEADER_KMALLOC_H #define __HEADER_KMALLOC_H -#include +#include void *kmalloc(int size, enum aal_mc_ap_flag flag); void kfree(void *ptr); diff --git a/kernel/include/process.h b/kernel/include/process.h index 1b0543f5..3fe93fb9 100644 --- a/kernel/include/process.h +++ b/kernel/include/process.h @@ -1,10 +1,10 @@ #ifndef HEADER_PROCESS_H #define HEADER_PROCESS_H -#include -#include -#include -#include +#include +#include +#include +#include #include #define VR_STACK 0x1 diff --git a/kernel/include/syscall.h b/kernel/include/syscall.h index db944400..170c5bf9 100644 --- a/kernel/include/syscall.h +++ b/kernel/include/syscall.h @@ -1,7 +1,7 @@ #ifndef __HEADER_SYSCALL_H #define __HEADER_SYSCALL_H -#include +#include #define NUM_SYSCALLS 255 diff --git a/kernel/include/timer.h b/kernel/include/timer.h index c32a863c..b4c1984f 100644 --- a/kernel/include/timer.h +++ b/kernel/include/timer.h @@ -1,17 +1,17 @@ #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include #include #include #include #include -#include +#include #include #include #include diff --git a/kernel/include/waitq.h b/kernel/include/waitq.h index 235b99cd..caff0153 100644 --- a/kernel/include/waitq.h +++ b/kernel/include/waitq.h @@ -3,7 +3,7 @@ /* Kitten waitqueue adaptation */ -#include +#include #include struct process; diff --git a/kernel/init.c b/kernel/init.c index 55fc3bbb..0048b4a5 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -1,11 +1,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include diff --git a/kernel/listeners.c b/kernel/listeners.c index e9c4bb44..57165826 100644 --- a/kernel/listeners.c +++ b/kernel/listeners.c @@ -1,9 +1,9 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include static unsigned long read_tsc(void) diff --git a/kernel/mem.c b/kernel/mem.c index 34e54829..1a535215 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -1,14 +1,14 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include -#include +#include +#include #include //#define DEBUG_PRINT_MEM diff --git a/kernel/mikc.c b/kernel/mikc.c index 56be9937..2ecbdc53 100644 --- a/kernel/mikc.c +++ b/kernel/mikc.c @@ -1,7 +1,7 @@ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/kernel/process.c b/kernel/process.c index 6fb62c04..1564fa9e 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kernel/script/mkimage.attached-mic b/kernel/script/mkimage.attached-mic index 155e0a3f..e84438a1 100644 --- a/kernel/script/mkimage.attached-mic +++ b/kernel/script/mkimage.attached-mic @@ -4,7 +4,7 @@ set -e O=`pwd` -make -C $3/../kboot O=$O clean -make -C $3/../kboot O=$O KIMAGE="$O/$1" LOAD_PA=0x401000 CC=${CC} LD=${LD} LDFLAGS="${LDFLAGS}" +make -C $3/../arch/x86/kboot O=$O clean +make -C $3/../arch/x86/kboot O=$O KIMAGE="$O/$1" LOAD_PA=0x401000 CC=${CC} LD=${LD} LDFLAGS="${LDFLAGS}" cp kboot/kboot.elf $2 diff --git a/kernel/syscall.c b/kernel/syscall.c index 83079b78..2ec16750 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -1,23 +1,23 @@ #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include #include #include #include #include -#include +#include #include #include #include #include #include -#include +#include /* Headers taken from kitten LWK */ #include diff --git a/kernel/timer.c b/kernel/timer.c index b4be9616..14eb0b74 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1,17 +1,17 @@ #include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include #include #include #include #include #include -#include +#include #include #include #include diff --git a/lib/abort.c b/lib/abort.c index 59a9ab81..47d8d6a8 100644 --- a/lib/abort.c +++ b/lib/abort.c @@ -1,5 +1,5 @@ -#include -#include +#include +#include void panic(const char *msg) { diff --git a/lib/include/ihk/cpu.h b/lib/include/ihk/cpu.h index 7949f247..e1607c15 100644 --- a/lib/include/ihk/cpu.h +++ b/lib/include/ihk/cpu.h @@ -2,7 +2,7 @@ #define AAL_CPU_H #include -#include +#include void cpu_enable_interrupt(void); void cpu_disable_interrupt(void); diff --git a/lib/include/ihk/debug.h b/lib/include/ihk/debug.h index bbc7ddc3..4d284153 100644 --- a/lib/include/ihk/debug.h +++ b/lib/include/ihk/debug.h @@ -1,7 +1,7 @@ #ifndef AAL_DEBUG_H #define AAL_DEBUG_H -#include +#include struct aal_kmsg_buf { int tail; diff --git a/lib/include/ihk/dma.h b/lib/include/ihk/dma.h index 2b1ca130..b25dcd51 100644 --- a/lib/include/ihk/dma.h +++ b/lib/include/ihk/dma.h @@ -1,7 +1,7 @@ #ifndef __HEADER_GENERIC_INCLUDE_DMA_H #define __HEADER_GENERIC_INCLUDE_DMA_H -#include +#include struct aal_dma_request { aal_os_t src_os; diff --git a/lib/include/types.h b/lib/include/types.h index 3690dd8c..846fa036 100644 --- a/lib/include/types.h +++ b/lib/include/types.h @@ -1,7 +1,7 @@ #ifndef TYPES_H #define TYPES_H -#include +#include #endif diff --git a/lib/page_alloc.c b/lib/page_alloc.c index 7a5358ce..090bf666 100644 --- a/lib/page_alloc.c +++ b/lib/page_alloc.c @@ -4,10 +4,10 @@ */ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include