diff --git a/usr/src/sp1/Makefile b/usr/src/sp1/Makefile index a7e3496..fd4f73e 100644 --- a/usr/src/sp1/Makefile +++ b/usr/src/sp1/Makefile @@ -1,4 +1,3 @@ -#!/bin/sh # # Copyright (c) 2026, Mirocom Laboratories # All rights reserved. @@ -11,7 +10,11 @@ # .PHONY: all -all: $(ARCH) +all: common $(ARCH) + +.PHONY: common +common: + cd common; $(MAKE) .PHONY: $(ARCH) $(ARCH): diff --git a/usr/src/sp1/amd64/Makefile b/usr/src/sp1/amd64/Makefile index 6cfd22f..b6103a4 100644 --- a/usr/src/sp1/amd64/Makefile +++ b/usr/src/sp1/amd64/Makefile @@ -11,8 +11,7 @@ ASMFILES = $(shell find . -name "*.S") ASMOFILES = $(ASMFILES:.S=.S.o) - -MISC_OFILES = $(shell find ../../ -name "*.o") +MISC_OFILES = $(shell find ../common -name "*.o") CC = \ ../../../../$(SYS_CC) @@ -25,7 +24,11 @@ CFLAGS = \ .PHONY: all all: $(ASMOFILES) - $(LD) -Tconf/link.ld $(MISC_OFILES) -o ../../../../sp1.sys + $(LD) \ + -Tconf/link.ld \ + $(MISC_OFILES) \ + $(ASMOFILES) \ + -o ../../../../sp1.sys %.S.o: %.S $(CC) -c $(CFLAGS) $< -o $@ diff --git a/usr/src/sp1/amd64/cpu/locore.S b/usr/src/sp1/amd64/cpu/locore.S index 0bfde71..dcea44c 100644 --- a/usr/src/sp1/amd64/cpu/locore.S +++ b/usr/src/sp1/amd64/cpu/locore.S @@ -11,11 +11,13 @@ .text .globl _start + .extern main _start: cli cld xor %rbp, %rbp + call main cli 1: hlt diff --git a/usr/src/sp1/common/Makefile b/usr/src/sp1/common/Makefile new file mode 100644 index 0000000..181a6bf --- /dev/null +++ b/usr/src/sp1/common/Makefile @@ -0,0 +1,28 @@ +# +# Copyright (c) 2026, Mirocom Laboratories +# All rights reserved. +# +# The following sources are CONFIDENTIAL and PROPRIETARY +# property of Mirocom Laboratories. Unauthorized copying, +# use, distrubution or modification of this file, in whole +# and in part, is strictly prohibited without the prior written +# consent from Mirocom Laboratories. +# + +CFILES = $(shell find os/ -name "*.c") +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) + +%.o: %.c + $(CC) -c $< $(CFLAGS) -o $@ diff --git a/usr/src/sp1/common/os/main.c b/usr/src/sp1/common/os/main.c new file mode 100644 index 0000000..f24f343 --- /dev/null +++ b/usr/src/sp1/common/os/main.c @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2026, Mirocom Laboratories + * All rights reserved. + * + * The following sources are CONFIDENTIAL and PROPRIETARY + * property of Mirocom Laboratories. Unauthorized copying, + * use, distribution or modification of this file, in whole + * and in part, is strictly prohibited without the prior written + * consent from Mirocom Laboratories. + */ + +void +main(void) +{ +}