summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authordzwdz2022-07-16 13:33:00 +0200
committerdzwdz2022-07-16 13:33:00 +0200
commit912d2e3c7eb1baa71dda2c0a28aa5809eaa96f27 (patch)
tree4e27f3538466d5fd63a311d50916039a7a15a485 /Makefile
parent1eeb66af44ab335888410d716d604e569f20866e (diff)
amd64: barely boot into kernel code
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 14 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index f28ba8b..9d7b069 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,13 @@
PATH := $(shell pwd)/toolchain/bin/:$(PATH)
-AS = i686-elf-as
-CC = i686-elf-gcc
+AS = x86_64-elf-as
+CC = x86_64-elf-gcc
CHECK = sparse
CFLAGS += -g -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wold-style-definition -Werror=implicit-function-declaration -ftrack-macro-expansion=0
CFLAGS += -mgeneral-regs-only
CFLAGS += -Isrc/
SPARSEFLAGS = -Wno-non-pointer-null
-LFLAGS = -ffreestanding -O2 -nostdlib -lgcc
+LFLAGS = -ffreestanding -O2 -nostdlib -lgcc -Wl,-zmax-page-size=4096 -Wl,--no-warn-mismatch
QFLAGS = -no-reboot
ifndef QEMU_DISPLAY
QFLAGS += -display none
@@ -23,12 +23,12 @@ endef
all: out/boot.iso check
boot: all out/hdd
- qemu-system-i386 -drive file=out/boot.iso,format=raw,media=disk $(QFLAGS) -serial stdio
+ qemu-system-x86_64 -drive file=out/boot.iso,format=raw,media=disk $(QFLAGS) -serial stdio
test: all
@# pipes for the serial
@mkfifo out/qemu.in out/qemu.out 2> /dev/null || true
- qemu-system-i386 -drive file=out/boot.iso,format=raw,media=disk $(QFLAGS) -serial pipe:out/qemu &
+ qemu-system-x86_64 -drive file=out/boot.iso,format=raw,media=disk $(QFLAGS) -serial pipe:out/qemu &
@# for some reason the first sent character doesn't go through to the shell
@# the empty echo takes care of that, so the next echos will work just fine
@echo > out/qemu.in
@@ -38,7 +38,7 @@ test: all
@cat out/qemu.out
debug: all
- qemu-system-i386 -cdrom out/boot.iso $(QFLAGS) -serial stdio -s -S &
+ qemu-system-x86_64 -cdrom out/boot.iso $(QFLAGS) -serial stdio -s -S &
@sleep 1
gdb
@@ -87,5 +87,13 @@ out/obj/%.c.o: src/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -c $^ -o $@
+out/obj/kernel/arch/amd64/32/%.c.o: src/kernel/arch/amd64/32/%.c
+ @mkdir -p $(@D)
+ @$(CC) $(CFLAGS) -m32 -c $^ -o $@
+
+out/obj/kernel/arch/amd64/32/%.s.o: src/kernel/arch/amd64/32/%.s
+ @mkdir -p $(@D)
+ @$(CC) -m32 -c $^ -o $@
+
src/user/lib/syscall.c: src/user/lib/syscall.c.awk src/shared/syscalls.h
awk -f $^ > $@