diff options
| -rw-r--r-- | Makefile | 48 | ||||
| -rw-r--r-- | include/litmus.h | 6 | ||||
| -rw-r--r-- | src/syscalls.c | 11 |
3 files changed, 50 insertions, 15 deletions
| @@ -19,9 +19,8 @@ LITMUS_KERNEL ?= ../litmus2010 | |||
| 19 | # Internal configuration. | 19 | # Internal configuration. |
| 20 | 20 | ||
| 21 | # compiler flags | 21 | # compiler flags |
| 22 | flags-debug = -Wall -g -Wdeclaration-after-statement | 22 | flags-debug = -Wall -Werror -g -Wdeclaration-after-statement |
| 23 | flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE | 23 | flags-api = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE |
| 24 | flags-link-rt = -static | ||
| 25 | 24 | ||
| 26 | # architecture-specific flags | 25 | # architecture-specific flags |
| 27 | flags-i386 = -m32 | 26 | flags-i386 = -m32 |
| @@ -36,13 +35,17 @@ include-sparc64 = sparc | |||
| 36 | # default: the arch name | 35 | # default: the arch name |
| 37 | include-${ARCH} ?= ${ARCH} | 36 | include-${ARCH} ?= ${ARCH} |
| 38 | 37 | ||
| 38 | # name of the file(s) that holds the actual system call numbers | ||
| 39 | unistd-i386 = unistd.h unistd_32.h | ||
| 40 | unistd-x86_64 = unistd.h unistd_64.h | ||
| 41 | # default: unistd.h | ||
| 42 | unistd-${ARCH} ?= unistd.h | ||
| 43 | |||
| 39 | # where to find header files | 44 | # where to find header files |
| 40 | headers = -Iinclude \ | 45 | headers = -Iinclude -Iarch/${include-${ARCH}}/include |
| 41 | -I${LITMUS_KERNEL}/include/ \ | ||
| 42 | -I${LITMUS_KERNEL}/arch/${include-${ARCH}}/include | ||
| 43 | 46 | ||
| 44 | # combine options | 47 | # combine options |
| 45 | CPPFLAGS = ${flags-api} ${flags-${ARCH}} ${headers} | 48 | CPPFLAGS = ${flags-api} ${flags-${ARCH}} -DARCH=${ARCH} ${headers} |
| 46 | CFLAGS = ${flags-debug} | 49 | CFLAGS = ${flags-debug} |
| 47 | LDFLAGS = ${flags-${ARCH}} | 50 | LDFLAGS = ${flags-${ARCH}} |
| 48 | 51 | ||
| @@ -78,6 +81,7 @@ dump-config: | |||
| 78 | LITMUS_KERNEL "${LITMUS_KERNEL}" \ | 81 | LITMUS_KERNEL "${LITMUS_KERNEL}" \ |
| 79 | CROSS_COMPILE "${CROSS_COMPILE}" \ | 82 | CROSS_COMPILE "${CROSS_COMPILE}" \ |
| 80 | headers "${headers}" \ | 83 | headers "${headers}" \ |
| 84 | "kernel headers" "${imported-headers}" \ | ||
| 81 | CFLAGS "${CFLAGS}" \ | 85 | CFLAGS "${CFLAGS}" \ |
| 82 | LDFLAGS "${LDFLAGS}" \ | 86 | LDFLAGS "${LDFLAGS}" \ |
| 83 | CPPFLAGS "${CPPFLAGS}" \ | 87 | CPPFLAGS "${CPPFLAGS}" \ |
| @@ -90,7 +94,35 @@ dump-config: | |||
| 90 | clean: | 94 | clean: |
| 91 | rm -f ${rt-apps} | 95 | rm -f ${rt-apps} |
| 92 | rm -f *.o *.d *.a test_catalog.inc | 96 | rm -f *.o *.d *.a test_catalog.inc |
| 97 | rm -f ${imported-headers} | ||
| 98 | |||
| 99 | # ############################################################################## | ||
| 100 | # Kernel headers. | ||
| 101 | # The kernel does not like being #included directly, so let's | ||
| 102 | # copy out the parts that we need. | ||
| 103 | |||
| 104 | # Litmus headers | ||
| 105 | include/litmus/%.h: ${LITMUS_KERNEL}/include/litmus/%.h | ||
| 106 | @mkdir -p ${dir $@} | ||
| 107 | cp $< $@ | ||
| 108 | |||
| 109 | # asm headers | ||
| 110 | arch/${include-${ARCH}}/include/asm/%.h: \ | ||
| 111 | ${LITMUS_KERNEL}/arch/${include-${ARCH}}/include/asm/%.h | ||
| 112 | @mkdir -p ${dir $@} | ||
| 113 | cp $< $@ | ||
| 114 | |||
| 115 | litmus-headers = include/litmus/rt_param.h include/litmus/unistd_32.h \ | ||
| 116 | include/litmus/unistd_64.h | ||
| 117 | |||
| 118 | unistd-headers = \ | ||
| 119 | $(foreach file,${unistd-${ARCH}},arch/${include-${ARCH}}/include/asm/$(file)) | ||
| 120 | |||
| 121 | |||
| 122 | imported-headers = ${litmus-headers} ${unistd-headers} | ||
| 93 | 123 | ||
| 124 | # Let's not copy these twice. | ||
| 125 | .SECONDARY: ${imported-headers} | ||
| 94 | 126 | ||
| 95 | # ############################################################################## | 127 | # ############################################################################## |
| 96 | # liblitmus | 128 | # liblitmus |
| @@ -159,8 +191,8 @@ vpath %.c bin/ src/ tests/ | |||
| 159 | 191 | ||
| 160 | obj-all = ${sort ${foreach target,${all},${obj-${target}}}} | 192 | obj-all = ${sort ${foreach target,${all},${obj-${target}}}} |
| 161 | 193 | ||
| 162 | # rule to generate dependency files (straight from make manual) | 194 | # rule to generate dependency files |
| 163 | %.d: %.c | 195 | %.d: %.c ${imported-headers} |
| 164 | @set -e; rm -f $@; \ | 196 | @set -e; rm -f $@; \ |
| 165 | $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \ | 197 | $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \ |
| 166 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ | 198 | sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ |
diff --git a/include/litmus.h b/include/litmus.h index b798c92..c4c4129 100644 --- a/include/litmus.h +++ b/include/litmus.h | |||
| @@ -5,13 +5,13 @@ | |||
| 5 | extern "C" { | 5 | extern "C" { |
| 6 | #endif | 6 | #endif |
| 7 | 7 | ||
| 8 | #include <sys/types.h> | ||
| 9 | |||
| 8 | /* Include kernel header. | 10 | /* Include kernel header. |
| 9 | * This is required for the rt_param | 11 | * This is required for the rt_param |
| 10 | * and control_page structures. | 12 | * and control_page structures. |
| 11 | */ | 13 | */ |
| 12 | #include <litmus/rt_param.h> | 14 | #include "litmus/rt_param.h" |
| 13 | |||
| 14 | #include <sys/types.h> | ||
| 15 | 15 | ||
| 16 | #include "cycles.h" /* for null_call() */ | 16 | #include "cycles.h" /* for null_call() */ |
| 17 | 17 | ||
diff --git a/src/syscalls.c b/src/syscalls.c index 77a6277..c738ac4 100644 --- a/src/syscalls.c +++ b/src/syscalls.c | |||
| @@ -1,13 +1,16 @@ | |||
| 1 | /* To get syscall() we need to define _GNU_SOURCE | 1 | /* To get syscall() we need to define _GNU_SOURCE |
| 2 | * in modern glibc versions. | 2 | * in modern glibc versions. |
| 3 | */ | 3 | */ |
| 4 | |||
| 5 | /* imported from the kernel source tree */ | ||
| 6 | #include "asm/unistd.h" | ||
| 7 | |||
| 8 | /* for syscall() */ | ||
| 4 | #include <unistd.h> | 9 | #include <unistd.h> |
| 5 | #include <linux/unistd.h> | ||
| 6 | #include <sys/types.h> | ||
| 7 | 10 | ||
| 8 | #include "litmus.h" | 11 | //#include <sys/types.h> |
| 9 | 12 | ||
| 10 | struct np_flag; | 13 | #include "litmus.h" |
| 11 | 14 | ||
| 12 | /* Syscall stub for setting RT mode and scheduling options */ | 15 | /* Syscall stub for setting RT mode and scheduling options */ |
| 13 | 16 | ||
