stos: init: Add kernel C entry

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-22 00:43:03 +00:00
parent d46ce89f83
commit 6f222ae96c
5 changed files with 56 additions and 2 deletions
+5 -1
View File
@@ -10,7 +10,11 @@
include ../mk/stos.mk include ../mk/stos.mk
.PHONY: all .PHONY: all
all: machine all: ke machine
.PHONY: ke
ke:
cd ke/; $(MAKE) $(PASSDOWN_ARGS)
.PHONY: machine .PHONY: machine
machine: machine:
+4 -1
View File
@@ -12,6 +12,9 @@ include ../../../mk/stos.mk
ASMFILES = $(shell find . -name "*.S") ASMFILES = $(shell find . -name "*.S")
ASMOFILES = $(ASMFILES:.S=.S.o) ASMOFILES = $(ASMFILES:.S=.S.o)
MISC_OFILES = $(ASMOFILES)
MISC_OFILES += $(shell find $(ST_PROJECT_ROOT)/paw/stos/ -name "*.o" | grep -v "arch")
KERNEL_PATH = \ KERNEL_PATH = \
$(ST_PROJECT_ROOT)/artifacts/stoskrnl.sys $(ST_PROJECT_ROOT)/artifacts/stoskrnl.sys
CFLAGS = \ CFLAGS = \
@@ -23,7 +26,7 @@ all: bin
.PHONY: bin .PHONY: bin
bin: $(ASMOFILES) bin: $(ASMOFILES)
$(PROMPT) "LD" $(KERNEL_PATH) $(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 %.S.o: %.S
$(PROMPT) "AS" $< $(PROMPT) "AS" $<
+2
View File
@@ -8,12 +8,14 @@
.text .text
.globl _start .globl _start
.extern KiKernelEntry
_start: _start:
cli /* Just in case */ cli /* Just in case */
xor %rbp, %rbp /* Terminate callstack */ xor %rbp, %rbp /* Terminate callstack */
lea g_GDTR(%rip), %rdi lea g_GDTR(%rip), %rdi
call MdGdtLoad call MdGdtLoad
call KiKernelEntry
mfence /* Flush caches */ mfence /* Flush caches */
1: cli /* Disable interrupts */ 1: cli /* Disable interrupts */
+14
View File
@@ -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 <stdef.h>
VOID
KiKernelEntry(VOID)
{
}
+31
View File
@@ -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 $@