From 81ee834a99c9d069c2f5fc8cc323d45883c7590d Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Fri, 10 Jul 2026 01:38:43 +0000 Subject: [PATCH] ptos: ke: Add kernel C groundwork Signed-off-by: Chloe M. --- service/ptos/Makefile | 6 +++++- service/ptos/arch/amd64/cpu/locore.S | 1 + service/ptos/ke/Makefile | 32 ++++++++++++++++++++++++++++ service/ptos/ke/init.c | 18 ++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 service/ptos/ke/Makefile create mode 100644 service/ptos/ke/init.c diff --git a/service/ptos/Makefile b/service/ptos/Makefile index 43ee0e4..d7d9228 100644 --- a/service/ptos/Makefile +++ b/service/ptos/Makefile @@ -9,7 +9,11 @@ include ../mk/ptos.mk .PHONY: all -all: machine +all: ke machine + +.PHONY: ke +ke: + cd ke/; $(MAKE) $(PASSDOWN_ARGS) .PHONY: machine machine: diff --git a/service/ptos/arch/amd64/cpu/locore.S b/service/ptos/arch/amd64/cpu/locore.S index bc9c5fd..cf7a8f7 100644 --- a/service/ptos/arch/amd64/cpu/locore.S +++ b/service/ptos/arch/amd64/cpu/locore.S @@ -15,6 +15,7 @@ MdBspEntry: lea g_GDTR(%rip), %rdi call MdGdtLoad + call KiKernelInit /* Kick off system init */ 1: hlt jmp 1b diff --git a/service/ptos/ke/Makefile b/service/ptos/ke/Makefile new file mode 100644 index 0000000..2271328 --- /dev/null +++ b/service/ptos/ke/Makefile @@ -0,0 +1,32 @@ +# +# Copyright (c) 2026, Chloe M. +# Provided under the BSD-3 clause +# +# Description: Kernel executive build script +# Author: Chloe M. +# + +.SILENT: +include ../../mk/ptos.mk + +CFILES = $(shell find . -name "*.c") +DFILES = $(CFILES:.c=.d) +OFILES = $(CFILES:.c=.o) + +CFLAGS = \ + $(SYS_CFLAGS) \ + -MMD \ + -D_KERNEL \ + -DPRINTF_DISABLE_SUPPORT_PTRDIFF_T \ + -DPRINTF_DISABLE_SUPPORT_FLOAT \ + -I../xt/flanterm/src \ + -I../head \ + -I../target \ + -I$(PT_PROJECT_ROOT)/sdk/head + +.PHONY: all +all: $(OFILES) + +%.o: %.c + $(PROMPT) "CC" $< + $(SYS_CC) -c $(CFLAGS) $< -o $@ diff --git a/service/ptos/ke/init.c b/service/ptos/ke/init.c new file mode 100644 index 0000000..456241f --- /dev/null +++ b/service/ptos/ke/init.c @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2026, Chloe M., et al + * Provided under the BSD-3 clause. + * + * Description: System bringup core + * Author: Chloe M. + */ + +#include + +/* + * Starting here is where the world is brought up and system + * components are initialized. + */ +VOID +KiKernelInit(VOID) +{ +}