diff options
| author | Ian Moffett <ian@osmora.org> | 2025-12-21 17:20:10 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-12-21 17:20:10 -0500 |
| commit | 1e2bf71bb692cc6f622f4c57181d0dd87eb66f7c (patch) | |
| tree | c0e90a823b17e5563a6cfaa8417bdbc28824a6c2 | |
| parent | ea8882dd7c024db436e25e86ac3d3fa3b3e43aa0 (diff) | |
mos: Add initial C entrypoint
Signed-off-by: Ian Moffett <ian@osmora.org>
| -rw-r--r-- | mos/sys/Makefile | 6 | ||||
| -rw-r--r-- | mos/sys/arch/x86_64/cpu/locore.S | 4 | ||||
| -rw-r--r-- | mos/sys/kern/Makefile | 16 | ||||
| -rw-r--r-- | mos/sys/kern/kern_init.c | 12 |
4 files changed, 37 insertions, 1 deletions
diff --git a/mos/sys/Makefile b/mos/sys/Makefile index 59b4a84..47f70b7 100644 --- a/mos/sys/Makefile +++ b/mos/sys/Makefile @@ -10,7 +10,11 @@ SYS_CFLAGS = ARCH = .PHONY: all -all: arch +all: kern arch + +.PHONY: kern +kern: + cd kern/; make CC=$(CC) LD=$(LD) SYS_CFLAGS="$(SYS_CFLAGS)" .PHONY: arch arch: diff --git a/mos/sys/arch/x86_64/cpu/locore.S b/mos/sys/arch/x86_64/cpu/locore.S index c8ffc4c..d96170b 100644 --- a/mos/sys/arch/x86_64/cpu/locore.S +++ b/mos/sys/arch/x86_64/cpu/locore.S @@ -5,10 +5,14 @@ .text .globl _start + .globl kern_main _start: cli cld + xor %rbp, %rbp /* Terminate callstack */ + call kern_main /* Call kernel main */ + 1: cli hlt jmp 1b diff --git a/mos/sys/kern/Makefile b/mos/sys/kern/Makefile new file mode 100644 index 0000000..1ee87c2 --- /dev/null +++ b/mos/sys/kern/Makefile @@ -0,0 +1,16 @@ +# +# Copyright (c) 2025, Ian Moffett. +# Provided under the BSD-3 clause. +# + +CFILES = $(shell find . -name "*.c") +OFILES = $(CFILES:.c=.o) + +SYS_CFLAGS = +CFLAGS = $(SYS_CFLAGS) -I../../../usr/sdk/inc/ + +.PHONY: all +all: $(OFILES) + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ diff --git a/mos/sys/kern/kern_init.c b/mos/sys/kern/kern_init.c new file mode 100644 index 0000000..62d73fb --- /dev/null +++ b/mos/sys/kern/kern_init.c @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2025, Ian Moffett. + * Provided under the BSD-3 clause. + */ + +/* Forward declaration */ +void kern_main(void); + +void +kern_main(void) +{ +} |
