diff --git a/paw/stos/Makefile b/paw/stos/Makefile index b47037f..7765b95 100644 --- a/paw/stos/Makefile +++ b/paw/stos/Makefile @@ -10,7 +10,11 @@ include ../mk/stos.mk .PHONY: all -all: machine +all: ke machine + +.PHONY: ke +ke: + cd ke/; $(MAKE) $(PASSDOWN_ARGS) .PHONY: machine machine: diff --git a/paw/stos/arch/amd64/Makefile b/paw/stos/arch/amd64/Makefile index 182de7c..1c6b0aa 100644 --- a/paw/stos/arch/amd64/Makefile +++ b/paw/stos/arch/amd64/Makefile @@ -12,6 +12,9 @@ include ../../../mk/stos.mk ASMFILES = $(shell find . -name "*.S") ASMOFILES = $(ASMFILES:.S=.S.o) +MISC_OFILES = $(ASMOFILES) +MISC_OFILES += $(shell find $(ST_PROJECT_ROOT)/paw/stos/ -name "*.o" | grep -v "arch") + KERNEL_PATH = \ $(ST_PROJECT_ROOT)/artifacts/stoskrnl.sys CFLAGS = \ @@ -23,7 +26,7 @@ all: bin .PHONY: bin bin: $(ASMOFILES) $(PROMPT) "LD" $(KERNEL_PATH) - $(SYS_LD) -Tdevel/link.ld $(ASMOFILES) -o $(KERNEL_PATH) + $(SYS_LD) -Tdevel/link.ld $(MISC_OFILES) -o $(KERNEL_PATH) %.S.o: %.S $(PROMPT) "AS" $< diff --git a/paw/stos/arch/amd64/cpu/locore.S b/paw/stos/arch/amd64/cpu/locore.S index 648f552..aa2b88b 100644 --- a/paw/stos/arch/amd64/cpu/locore.S +++ b/paw/stos/arch/amd64/cpu/locore.S @@ -8,12 +8,14 @@ .text .globl _start + .extern KiKernelEntry _start: cli /* Just in case */ xor %rbp, %rbp /* Terminate callstack */ lea g_GDTR(%rip), %rdi call MdGdtLoad + call KiKernelEntry mfence /* Flush caches */ 1: cli /* Disable interrupts */ diff --git a/paw/stos/init/init.c b/paw/stos/init/init.c new file mode 100644 index 0000000..4b15bf9 --- /dev/null +++ b/paw/stos/init/init.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2026, Chloe M. + * Provided under the BSD-3 clause. + * + * Description: Where your machine gets turned on~ + * Author: Chloe M. + */ + +#include + +VOID +KiKernelEntry(VOID) +{ +} diff --git a/paw/stos/ke/Makefile b/paw/stos/ke/Makefile new file mode 100644 index 0000000..8f1e30d --- /dev/null +++ b/paw/stos/ke/Makefile @@ -0,0 +1,31 @@ +# +# Copyright (c) 2026, Chloe M. +# Provided under the BSD-3 clause +# +# Description: OS core build script +# Author: Chloe M. +# + +.SILENT: +include ../../mk/stos.mk + +CFILES = $(shell find ../init -name "*.c") +DFILES = $(CFILES:.c=.d) +OFILES = $(CFILES:.c=.o) + +CFLAGS = \ + $(SYS_CFLAGS) \ + -MMD \ + -D_KERNEL \ + -MMD \ + -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T \ + -DPRINTF_DISABLE_SUPPORT_FLOAT \ + -I../head \ + -I$(ST_PROJECT_ROOT)/sdk/head + +.PHONY: all +all: $(OFILES) + +%.o: %.c + $(PROMPT) "CC" $< + $(SYS_CC) -c $(CFLAGS) $< -o $@