initial commit master
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 14 Aug 2016 13:47:06 +0000 (13:47 +0000)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sun, 14 Aug 2016 13:47:06 +0000 (13:47 +0000)
Makefile [new file with mode: 0644]
src/boot/lboot.S [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..e44b643
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+csrc = $(wildcard src/boot/*.c) $(wildcard src/*.c) $(wildcard src/klibc/*.c)
+asmsrc = $(wildcard src/boot/*.S) $(wildcard src/*.S) $(wildcard src/klibc/*.S)
+dep = $(asmsrc:.S=.d) $(csrc:.c=.d)
+obj = $(asmsrc:.S=.o) $(csrc:.c=.o)
+
+inc = -Isrc -Isrc/klibc -Isrc/boot -Iinclude
+
+CFLAGS = $(ccemu) -Wall -g -nostdinc -fno-builtin $(inc) -DKERNEL
+ASFLAGS = $(ccemu) -g -nostdinc -fno-builtin $(inc)
+
+bin = kernel.elf
+
+$(bin): $(obj)
+       ld $(ldemu) -o $@ -Ttext 0x8000 -e kentry $(obj) -Map link.map
+
+%.s: %.c
+       $(CC) $(CFLAGS) -S -o $@ $<
+
+-include $(dep)
+
+%.d: %.c
+       @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@
+
+%.d: %.S
+       @$(CPP) $(ASFLAGS) -MM -MT $(@:.d=.o) $< >$@
+
+.PHONY: clean
+clean:
+       rm -f $(obj) $(bin)
+
+.PHONY: cleandep
+cleandep:
+       rm -f $(dep)
diff --git a/src/boot/lboot.S b/src/boot/lboot.S
new file mode 100644 (file)
index 0000000..1e56e95
--- /dev/null
@@ -0,0 +1,12 @@
+#define STACK_SIZE     0x4000
+
+       .text
+       .align 4
+
+       .globl kentry
+kentry:
+       ldr sp, =$(stack + STACK_SIZE)
+
+       bl kmain
+
+       .comm stack, STACK_SIZE