diff options
38 files changed, 37 insertions, 35 deletions
@@ -8,13 +8,13 @@ CHECK = sparse CFLAGS += -g -std=gnu99 -O2 -ftrack-macro-expansion=0 CFLAGS += -Wall -Wextra -Wold-style-definition -Werror=implicit-function-declaration CFLAGS += -Wno-address-of-packed-member -Werror=incompatible-pointer-types -CFLAGS += -Isrc/ -Isrc/shared/include/ +CFLAGS += -Isrc/shared/include/ -KERNEL_CFLAGS = $(CFLAGS) -ffreestanding -mno-sse -mgeneral-regs-only -LIBC_CFLAGS = $(CFLAGS) -Isrc/user/lib/include/ -ffreestanding +KERNEL_CFLAGS = $(CFLAGS) -ffreestanding -mno-sse -mgeneral-regs-only -Isrc/ +LIBC_CFLAGS = $(CFLAGS) -Isrc/user/lib/include/ -ffreestanding -Isrc/ USER_CFLAGS = $(CFLAGS) -Isrc/user/lib/include/ -SPARSEFLAGS = -Wno-non-pointer-null +SPARSEFLAGS = -$(KERNEL_CFLAGS) -Wno-non-pointer-null LFLAGS = -ffreestanding -O2 -nostdlib -lgcc -Wl,-zmax-page-size=4096 -Wl,--no-warn-mismatch # TODO optimize memory use QFLAGS = -no-reboot -m 1g -gdb tcp::12366 @@ -62,7 +62,7 @@ test: all @cat out/qemu.out check: $(shell find src/kernel/ -type f -name *.c) - @echo $^ | xargs -n 1 sparse $(CFLAGS) $(SPARSEFLAGS) + @echo $^ | xargs -n 1 sparse $(SPARSEFLAGS) @tools/linter/main.rb clean: diff --git a/src/kernel/arch/amd64/driver/util.h b/src/kernel/arch/amd64/driver/util.h index 0f7db7a..4b8bb04 100644 --- a/src/kernel/arch/amd64/driver/util.h +++ b/src/kernel/arch/amd64/driver/util.h @@ -1,6 +1,6 @@ #pragma once #include <kernel/types.h> -#include <shared/container/ring.h> +#include <shared/ring.h> #include <stdbool.h> #include <stddef.h> diff --git a/src/shared/mem.h b/src/shared/include/shared/mem.h index 3597edf..3597edf 100644 --- a/src/shared/mem.h +++ b/src/shared/include/shared/mem.h diff --git a/src/shared/printf.h b/src/shared/include/shared/printf.h index 45fd358..45fd358 100644 --- a/src/shared/printf.h +++ b/src/shared/include/shared/printf.h diff --git a/src/shared/container/ring.h b/src/shared/include/shared/ring.h index dbaf331..dbaf331 100644 --- a/src/shared/container/ring.h +++ b/src/shared/include/shared/ring.h diff --git a/src/shared/container/ring.c b/src/shared/ring.c index 9bf8d61..44c73f6 100644 --- a/src/shared/container/ring.c +++ b/src/shared/ring.c @@ -1,4 +1,4 @@ -#include <shared/container/ring.h> +#include <shared/ring.h> #include <shared/mem.h> #include <stdbool.h> diff --git a/src/user/app/drawmouse/drawmouse.c b/src/user/app/drawmouse/drawmouse.c index 24aa55e..31a1255 100644 --- a/src/user/app/drawmouse/drawmouse.c +++ b/src/user/app/drawmouse/drawmouse.c @@ -1,11 +1,11 @@ #include <camellia.h> #include <camellia/syscalls.h> -#include <shared/container/ring.h> +#include <shared/ring.h> #include <stdbool.h> #include <stdio.h> #include <string.h> #include <unistd.h> -#include <user/lib/draw/draw.h> +#include <draw.h> #define MOUSE_SIZE 10 diff --git a/src/user/app/dvd/dvd.c b/src/user/app/dvd/dvd.c index 70adc8b..a15b440 100644 --- a/src/user/app/dvd/dvd.c +++ b/src/user/app/dvd/dvd.c @@ -4,7 +4,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <user/lib/draw/draw.h> +#include <draw.h> #define eprintf(fmt, ...) fprintf(stderr, "vterm: "fmt"\n" __VA_OPT__(,) __VA_ARGS__) diff --git a/src/user/app/init/driver/ps2.c b/src/user/app/init/driver/ps2.c index a5cdb07..4fee60a 100644 --- a/src/user/app/init/driver/ps2.c +++ b/src/user/app/init/driver/ps2.c @@ -1,6 +1,6 @@ #include "driver.h" #include <camellia/syscalls.h> -#include <shared/container/ring.h> +#include <shared/ring.h> #include <stdbool.h> #include <stdlib.h> #include <camellia/compat.h> diff --git a/src/user/app/netdog/nd.c b/src/user/app/netdog/nd.c index fdc8361..af5c264 100644 --- a/src/user/app/netdog/nd.c +++ b/src/user/app/netdog/nd.c @@ -2,7 +2,7 @@ #include <camellia/syscalls.h> #include <stdio.h> #include <string.h> -#include <user/lib/thread.h> +#include <thread.h> #define eprintf(fmt, ...) fprintf(stderr, "netdog: "fmt"\n" __VA_OPT__(,) __VA_ARGS__) diff --git a/src/user/app/netstack/netstack.c b/src/user/app/netstack/netstack.c index c2e9223..296fee2 100644 --- a/src/user/app/netstack/netstack.c +++ b/src/user/app/netstack/netstack.c @@ -6,7 +6,7 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> -#include <user/lib/thread.h> +#include <thread.h> struct net_state state = { // TODO dynamically get mac diff --git a/src/user/app/netstack/tcp.c b/src/user/app/netstack/tcp.c index 490ad5b..d1adeab 100644 --- a/src/user/app/netstack/tcp.c +++ b/src/user/app/netstack/tcp.c @@ -5,7 +5,7 @@ #include "proto.h" #include "util.h" #include <assert.h> -#include <shared/container/ring.h> +#include <shared/ring.h> enum { SrcPort = 0, diff --git a/src/user/app/tests/kernel/threads.c b/src/user/app/tests/kernel/threads.c index abca41c..b3c1c06 100644 --- a/src/user/app/tests/kernel/threads.c +++ b/src/user/app/tests/kernel/threads.c @@ -2,8 +2,8 @@ #include <camellia/flags.h> #include <camellia/syscalls.h> #include <string.h> -#include <user/lib/esemaphore.h> -#include <user/lib/thread.h> +#include <esemaphore.h> +#include <thread.h> int global_n; static void basic_thread(void *sem) { diff --git a/src/user/app/tests/libc/esemaphore.c b/src/user/app/tests/libc/esemaphore.c index 2f1d4bc..f089f4f 100644 --- a/src/user/app/tests/libc/esemaphore.c +++ b/src/user/app/tests/libc/esemaphore.c @@ -4,7 +4,7 @@ #include <stdio.h> #include <string.h> #include <unistd.h> -#include <user/lib/esemaphore.h> +#include <esemaphore.h> static void odd(hid_t out, struct evil_sem *sem1, struct evil_sem *sem2) { _sys_write(out, "1", 1, -1, 0); diff --git a/src/user/app/tests/shared/ringbuf.c b/src/user/app/tests/shared/ringbuf.c index d4e8dc9..d2a35a1 100644 --- a/src/user/app/tests/shared/ringbuf.c +++ b/src/user/app/tests/shared/ringbuf.c @@ -1,5 +1,5 @@ #include "../tests.h" -#include <shared/container/ring.h> +#include <shared/ring.h> #include <string.h> static void test_ringbuf(void) { diff --git a/src/user/app/vterm/vterm.h b/src/user/app/vterm/vterm.h index b006ede..72c1fd0 100644 --- a/src/user/app/vterm/vterm.h +++ b/src/user/app/vterm/vterm.h @@ -2,7 +2,7 @@ #include <camellia/types.h> #include <stdint.h> #include <stdio.h> -#include <user/lib/draw/draw.h> +#include <draw.h> #define eprintf(fmt, ...) fprintf(stderr, "vterm: "fmt"\n" __VA_OPT__(,) __VA_ARGS__) diff --git a/src/user/bootstrap/main.c b/src/user/bootstrap/main.c index b6d30f4..c12989e 100644 --- a/src/user/bootstrap/main.c +++ b/src/user/bootstrap/main.c @@ -3,7 +3,7 @@ #include <camellia/syscalls.h> #include <stdio.h> #include <string.h> -#include <user/lib/elfload.h> +#include <elfload.h> #include <camellia/fs/misc.h> #include "tar.h" diff --git a/src/user/lib/_start2.c b/src/user/lib/_start2.c index 648c0c6..954fcb4 100644 --- a/src/user/lib/_start2.c +++ b/src/user/lib/_start2.c @@ -5,7 +5,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <user/lib/elfload.h> +#include <elfload.h> int main(int argc, char **argv, char **envp); diff --git a/src/user/lib/draw/draw.c b/src/user/lib/draw/draw.c index 3fb6a99..1c2a371 100644 --- a/src/user/lib/draw/draw.c +++ b/src/user/lib/draw/draw.c @@ -4,7 +4,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <user/lib/draw/draw.h> +#include <draw.h> void dirty_reset(struct rect *d) { d->x1 = ~0; d->y1 = ~0; diff --git a/src/user/lib/draw/flush.c b/src/user/lib/draw/flush.c index 3b4a978..88bf3d6 100644 --- a/src/user/lib/draw/flush.c +++ b/src/user/lib/draw/flush.c @@ -1,6 +1,6 @@ #include <camellia/execbuf.h> #include <camellia/syscalls.h> -#include <user/lib/draw/draw.h> +#include <draw.h> static void flush_combined(struct rect pix, struct framebuf *fb) { size_t low = fb->pitch * pix.y1 + 4 * pix.x1; diff --git a/src/user/lib/elfload.c b/src/user/lib/elfload.c index 3862534..7b92d35 100644 --- a/src/user/lib/elfload.c +++ b/src/user/lib/elfload.c @@ -6,8 +6,8 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <user/lib/elf.h> -#include <user/lib/elfload.h> +#include "elf.h" +#include <elfload.h> void elf_execf(FILE *f, char **argv, char **envp) { void *buf; diff --git a/src/user/lib/elfreloc.c b/src/user/lib/elfreloc.c index b6e3844..cf740f5 100644 --- a/src/user/lib/elfreloc.c +++ b/src/user/lib/elfreloc.c @@ -1,5 +1,5 @@ #include <stdio.h> -#include <user/lib/elf.h> +#include "elf.h" __attribute__((visibility("hidden"))) extern struct Elf64_Dyn _DYNAMIC[]; diff --git a/src/user/lib/esemaphore.c b/src/user/lib/esemaphore.c index 3a3aa7f..2707d11 100644 --- a/src/user/lib/esemaphore.c +++ b/src/user/lib/esemaphore.c @@ -2,7 +2,7 @@ #include <camellia/syscalls.h> #include <stdlib.h> #include <unistd.h> -#include <user/lib/esemaphore.h> +#include <esemaphore.h> void esem_signal(struct evil_sem *sem) { _sys_write(sem->signal, NULL, 0, 0, 0); diff --git a/src/user/lib/panic.h b/src/user/lib/include/bits/panic.h index 91aec5f..91aec5f 100644 --- a/src/user/lib/panic.h +++ b/src/user/lib/include/bits/panic.h diff --git a/src/user/lib/draw/draw.h b/src/user/lib/include/draw.h index 5e614be..5e614be 100644 --- a/src/user/lib/draw/draw.h +++ b/src/user/lib/include/draw.h diff --git a/src/user/lib/elfload.h b/src/user/lib/include/elfload.h index 825f765..825f765 100644 --- a/src/user/lib/elfload.h +++ b/src/user/lib/include/elfload.h diff --git a/src/user/lib/esemaphore.h b/src/user/lib/include/esemaphore.h index 9cc85e0..9cc85e0 100644 --- a/src/user/lib/esemaphore.h +++ b/src/user/lib/include/esemaphore.h diff --git a/src/user/lib/include/getopt.h b/src/user/lib/include/getopt.h new file mode 120000 index 0000000..4890ceb --- /dev/null +++ b/src/user/lib/include/getopt.h @@ -0,0 +1 @@ +../vendor/getopt/getopt.h
\ No newline at end of file diff --git a/src/user/lib/include/malloc.h b/src/user/lib/include/malloc.h new file mode 120000 index 0000000..80b9bf5 --- /dev/null +++ b/src/user/lib/include/malloc.h @@ -0,0 +1 @@ +../vendor/dlmalloc/malloc.h
\ No newline at end of file diff --git a/src/user/lib/include/setjmp.h b/src/user/lib/include/setjmp.h index 298939c..6d05d79 100644 --- a/src/user/lib/include/setjmp.h +++ b/src/user/lib/include/setjmp.h @@ -1,5 +1,5 @@ #pragma once -#include <user/lib/panic.h> +#include <bits/panic.h> typedef uint64_t jmp_buf[8]; /* rbx, rsp, rbp, r12, r13, r14, r15, rip */ typedef char sigjmp_buf[1]; diff --git a/src/user/lib/include/stdlib.h b/src/user/lib/include/stdlib.h index 050ca80..4a44bf6 100644 --- a/src/user/lib/include/stdlib.h +++ b/src/user/lib/include/stdlib.h @@ -3,7 +3,7 @@ #include <stdlib.h> #ifndef NO_MALLOC_H -#include <user/lib/vendor/dlmalloc/malloc.h> +#include <malloc.h> #endif #define EXIT_SUCCESS 0 diff --git a/src/user/lib/thread.h b/src/user/lib/include/thread.h index 5a5ddc0..5a5ddc0 100644 --- a/src/user/lib/thread.h +++ b/src/user/lib/include/thread.h diff --git a/src/user/lib/include/unistd.h b/src/user/lib/include/unistd.h index c55cd29..a1c18e8 100644 --- a/src/user/lib/include/unistd.h +++ b/src/user/lib/include/unistd.h @@ -1,6 +1,6 @@ #pragma once #include <camellia/types.h> // TODO only needed because of hid_t -#include <user/lib/vendor/getopt/getopt.h> +#include <getopt.h> int fork(void); int close(hid_t h); diff --git a/src/user/lib/math.c b/src/user/lib/math.c index bf7c039..4f8eda4 100644 --- a/src/user/lib/math.c +++ b/src/user/lib/math.c @@ -1,5 +1,5 @@ #include <math.h> -#include <user/lib/panic.h> +#include <bits/panic.h> // TODO port a libm #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/src/user/lib/stdio/file.c b/src/user/lib/stdio/file.c index 49ff861..cbacfdd 100644 --- a/src/user/lib/stdio/file.c +++ b/src/user/lib/stdio/file.c @@ -6,7 +6,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <user/lib/panic.h> +#include <bits/panic.h> static FILE _stdin_null = { .fd = STDIN_FILENO }; static FILE _stdout_null = { .fd = STDOUT_FILENO }; diff --git a/src/user/lib/stdlib.c b/src/user/lib/stdlib.c index 85afb25..2d1f224 100644 --- a/src/user/lib/stdlib.c +++ b/src/user/lib/stdlib.c @@ -3,7 +3,7 @@ #include <camellia/syscalls.h> #include <errno.h> #include <string.h> -#include <user/lib/panic.h> +#include <bits/panic.h> _Noreturn void abort(void) { _sys_exit(1); diff --git a/src/user/lib/string/string.c b/src/user/lib/string/string.c index 126d175..8fdc7c7 100644 --- a/src/user/lib/string/string.c +++ b/src/user/lib/string/string.c @@ -48,7 +48,7 @@ long strtol(const char *restrict s, char **restrict end, int base) { return res * sign; } -#include <user/lib/panic.h> +#include <bits/panic.h> double strtod(const char *restrict s, char **restrict end) { (void)s; (void)end; __libc_panic("unimplemented"); diff --git a/src/user/lib/unistd.c b/src/user/lib/unistd.c index f8edd25..f81e7d8 100644 --- a/src/user/lib/unistd.c +++ b/src/user/lib/unistd.c @@ -6,7 +6,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <user/lib/elfload.h> +#include <elfload.h> int errno = 0; |