diff options
Diffstat (limited to 'src/sys/arch/amd64')
-rw-r--r-- | src/sys/arch/amd64/Makefile | 33 | ||||
-rwxr-xr-x | src/sys/arch/amd64/amd64 | bin | 0 -> 13576 bytes | |||
-rw-r--r-- | src/sys/arch/amd64/conf/sys.ld | 35 | ||||
-rw-r--r-- | src/sys/arch/amd64/locore.S | 42 |
4 files changed, 110 insertions, 0 deletions
diff --git a/src/sys/arch/amd64/Makefile b/src/sys/arch/amd64/Makefile new file mode 100644 index 0000000..f4f4f48 --- /dev/null +++ b/src/sys/arch/amd64/Makefile @@ -0,0 +1,33 @@ +include ../../conf/sys.mk + +override PROMPT := printf "%s\t\t%s\n" + +TARGET_BIN = ../../l5 +TARGET_INC = -I../../target/header/ +CFLAGS = -I../../include/ -I../../include/lib/ $(TARGET_INC) $(MI_CFLAGS) $(MD_CFLAGS) +CFILES = $(shell find . -name "*.c") + +ASMFILES = $(shell find . -name "*.S") +ASMOBJECTS = $(ASMFILES:.S=.S.o) + +DEPS = $(CFILES:.c=.d) +ASMDEPS = $(ASMFILES:.S=.S.d) +OBJECTS = $(CFILES:%.c=%.o) +LD_FLAGS = -Tconf/sys.ld -L../../target -lkern + +.PHONY: all +all: $(OBJECTS) $(ASMOBJECTS) + $(LD) $(OBJECTS) $(ASMOBJECTS) -o $(TARGET_BIN) $(LD_FLAGS) + +-include $(DEPS) +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +-include $(ASMDEPS) +%.S.o: %.S + $(PROMPT) " MD.AS " $< + $(CC) -c $< -o $@ $(CFLAGS) $(MD_CFLAGS) + +.PHONY: clean +clean: + rm -f $(DEPS) $(ASMDEPS) $(OBJECTS) $(ASMOBJECTS) diff --git a/src/sys/arch/amd64/amd64 b/src/sys/arch/amd64/amd64 Binary files differnew file mode 100755 index 0000000..de0e4ea --- /dev/null +++ b/src/sys/arch/amd64/amd64 diff --git a/src/sys/arch/amd64/conf/sys.ld b/src/sys/arch/amd64/conf/sys.ld new file mode 100644 index 0000000..b5d1cf0 --- /dev/null +++ b/src/sys/arch/amd64/conf/sys.ld @@ -0,0 +1,35 @@ +ENTRY(_start) + +SECTIONS { + . = 1M; + + .boot : + { + *(.multiboot_header) + } + + . = ALIGN(4K); + .text : + { + *(.text .text.*) + } + + . = ALIGN(4K); + .rodata : + { + *(.rodata .rodata.*) + } + + . = ALIGN(4K); + .data : + { + *(.data .data.*) + } + + . = ALIGN(4K); + .bss : + { + *(.bss .bss.*) + } +} + diff --git a/src/sys/arch/amd64/locore.S b/src/sys/arch/amd64/locore.S new file mode 100644 index 0000000..5f7c3df --- /dev/null +++ b/src/sys/arch/amd64/locore.S @@ -0,0 +1,42 @@ + .set MAGIC, 0xe85250d6 + .set ARCH, 0x00 // i386, protected mode + .set LEN, hdr_end - hdr_start + .set CHECKSUM, 0x100000000 - (0xe85250d6 + 0 + (hdr_end - hdr_start)) + + .section .multiboot + .align 4 +hdr_start: + .long MAGIC + .long ARCH + .long LEN + .long CHECKSUM +hdr_end: + +fbtag_start: + .word 5 // Type + .word 1 // Flags + .long fbtag_end - fbtag_start // Length + .long 800 // Width + .long 600 // Height + .long 32 // Depth +fbtag_end: + + .align 8 +endtag: + .word 0 + .word 0 + .word 8 + + .text + .code32 + .globl _start +_start: + cli + mov stack_bottom, %esp + push %ebx + push %eax + jmp main + + .section .bss +stack_bottom: + .fill 4096 * 16, 0 |