m1x: Add initial kernel C files

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-03-25 00:47:04 -04:00
parent 75c7300480
commit fb2a2955c8
4 changed files with 40 additions and 1 deletions

View File

@@ -6,7 +6,11 @@
include ../mk/default.mk include ../mk/default.mk
.PHONY: all .PHONY: all
all: arch all: kern arch
.PHONY: kern
kern:
cd kern/; make $(PASSDOWN_ARGS)
.PHONY: arch .PHONY: arch
arch: arch:

View File

@@ -5,11 +5,13 @@
.text .text
.globl _start .globl _start
.extern kmain
_start: _start:
cli cli
cld cld
xor %rbp, %rbp xor %rbp, %rbp
call kmain
1: hlt 1: hlt
jmp 1b jmp 1b

23
src/m1x/kern/Makefile Normal file
View File

@@ -0,0 +1,23 @@
#
# Copyright (c) 2026, Ian Moffett.
# Provided under the BSD-3 clause.
#
CFILES = $(shell find . -name "*.c")
DFILES = $(CFILES:.c=.d)
OFILES = $(CFILES:.c=.o)
CC = ../../$(SYS_CC)
CFLAGS = \
$(SYS_CFLAGS) \
-D_KERNEL \
-MMD \
-DPRINTF_DISABLE_SUPPORT_PTRDIFF_T \
-DPRINTF_DISABLE_SUPPORT_FLOAT
.PHONY: all
all: $(OFILES)
-include $(DFILES)
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@

10
src/m1x/kern/kern_init.c Normal file
View File

@@ -0,0 +1,10 @@
/*
* Copyright (c) 2026, Mirocom Laboratories
* Provided under the BSD-3 clause
*/
void
kmain(void)
{
for (;;);
}