From e758e02f0781e45f91674aeb5c2259ce4add3b88 Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Thu, 3 Sep 2026 01:22:45 +0000 Subject: initial commit Signed-off-by: Chloe M. --- boot/amd64/generic/stage3/Makefile | 22 ++++++++++++++++++++++ boot/amd64/generic/stage3/entry.c | 7 +++++++ boot/amd64/generic/stage3/link.ld | 26 ++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 boot/amd64/generic/stage3/Makefile create mode 100644 boot/amd64/generic/stage3/entry.c create mode 100644 boot/amd64/generic/stage3/link.ld (limited to 'boot/amd64/generic/stage3') diff --git a/boot/amd64/generic/stage3/Makefile b/boot/amd64/generic/stage3/Makefile new file mode 100644 index 0000000..08e159e --- /dev/null +++ b/boot/amd64/generic/stage3/Makefile @@ -0,0 +1,22 @@ +# +# Copyright (c) 2026, Apollo Telephone Laboratories. +# Provided under the BSD-3 clause. +# + +include ../mk/build.mk + +CFLAGS = $(INTERNAL_CFLAGS) -MMD +CFILES = $(shell find . -name "*.c") +OFILES = $(CFILES:.c=.o) +DFILES = $(CFILES:.c=.d) + +.PHONY: all +all: stage3 + +.PHONY: stage3 +stage3: $(OFILES) + $(CC) $(CFLAGS) -Tlink.ld $(OFILES) -o stage3.bin + +-include $(DFILES) +%.o: %.c + $(CC) -c $< $(CFLAGS) -o $@ diff --git a/boot/amd64/generic/stage3/entry.c b/boot/amd64/generic/stage3/entry.c new file mode 100644 index 0000000..3e4b95b --- /dev/null +++ b/boot/amd64/generic/stage3/entry.c @@ -0,0 +1,7 @@ +void +main(void) +{ + for (;;) { + __asm__ __volatile__("cli; hlt"); + } +} diff --git a/boot/amd64/generic/stage3/link.ld b/boot/amd64/generic/stage3/link.ld new file mode 100644 index 0000000..abbd785 --- /dev/null +++ b/boot/amd64/generic/stage3/link.ld @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2026, Apollo Telephone Laboratories. + * Provided under the BSD-3 clause. + */ + +OUTPUT_FORMAT(binary) + +SECTIONS { + . = 0x0000; + + .text : { + *(.text) + } + + .data : { + *(.data) + } + + .rodata : { + *(.rodata) + } + + .bss : { + *(.bss) + } +} -- cgit v1.2.3