diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/Makefile | 15 | ||||
| -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 | ||||
| -rwxr-xr-x | sys/rv7 | bin | 0 -> 4520 bytes |
5 files changed, 79 insertions, 0 deletions
diff --git a/sys/Makefile b/sys/Makefile new file mode 100644 index 0000000..bfac75a --- /dev/null +++ b/sys/Makefile @@ -0,0 +1,15 @@ +CC = +LD = +SYS_CFLAGS = +ARCH = + +.PHONY: all +all: arch + +.PHONY: arch +arch: + cd arch/$(ARCH); make CC=$(CC) LD=$(LD) SYS_CFLAGS="$(SYS_CFLAGS)" + +.PHONY: clean +clean: + cd arch/$(ARCH); make clean 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.*) + } +} + Binary files differ |
