diff options
| author | Ian Moffett <ian@osmora.org> | 2025-11-15 13:32:41 -0500 |
|---|---|---|
| committer | Ian Moffett <ian@osmora.org> | 2025-11-15 13:32:41 -0500 |
| commit | fa3c60da8207b724d292b7a44633872c6bfec4c8 (patch) | |
| tree | 195af6554fe5ead88cda54a8361963666c923251 /sys/arch | |
initial commit
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/arch')
| -rw-r--r-- | sys/arch/amd64/Makefile | 17 | ||||
| -rw-r--r-- | sys/arch/amd64/boot.S | 5 | ||||
| -rw-r--r-- | sys/arch/amd64/conf/link.ld | 42 |
3 files changed, 64 insertions, 0 deletions
diff --git a/sys/arch/amd64/Makefile b/sys/arch/amd64/Makefile new file mode 100644 index 0000000..1090a38 --- /dev/null +++ b/sys/arch/amd64/Makefile @@ -0,0 +1,17 @@ +CC = +LD = +SYS_CFLAGS = +ASMFILES = $(shell find . -name "*.S") +ASMOBJS = $(ASMFILES:.S=.S.o) +MISC_OFILES = $(shell find ../../ -name "*.o") + +.PHONY: all +all: $(ASMOBJS) + $(LD) -Tconf/link.ld $(MISC_OFILES) -o ../../rv7 + +%.S.o: %.S + $(CC) -c $(SYS_CFLAGS) $< -o $@ + +.PHONY: clean +clean: + rm $(MISC_OFILES) diff --git a/sys/arch/amd64/boot.S b/sys/arch/amd64/boot.S new file mode 100644 index 0000000..0d2e0d2 --- /dev/null +++ b/sys/arch/amd64/boot.S @@ -0,0 +1,5 @@ + .globl _start +_start: +1: cli + hlt + jmp 1b diff --git a/sys/arch/amd64/conf/link.ld b/sys/arch/amd64/conf/link.ld new file mode 100644 index 0000000..92222b0 --- /dev/null +++ b/sys/arch/amd64/conf/link.ld @@ -0,0 +1,42 @@ +OUTPUT_FORMAT(elf64-x86-64) +OUTPUT_ARCH(i386:x86-64) +ENTRY(_start) + +PHDRS +{ + text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; + rodata PT_LOAD FLAGS((1 << 2)) ; + data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; +} + +SECTIONS +{ + . = 0xFFFFFFFF80000000; + + .text : { + *(.text .text.*) + } :text + + . += CONSTANT(MAXPAGESIZE); + + .rodata : { + *(.rodata .rodata.*) + } :rodata + + . += CONSTANT(MAXPAGESIZE); + + .data : { + *(.data) + } :data + + .bss : { + *(COMMON) + *(.bss .bss.*) + } :data + + /DISCARD/ : { + *(.eh_frame .eh_frame.*) + *(.note .note.*) + } +} + |
