From 8a44a71f3d7094d0ccc632096edbe6a83bb0c51a Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sat, 28 May 2016 17:32:47 +0200 Subject: [PATCH] Library: Add stdio-free crt0 for 6809 Signed-off-by: Tormod Volden --- Library/libs/Makefile.6809 | 2 +- Library/libs/crt0nostdio_6809.s | 40 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Library/libs/crt0nostdio_6809.s diff --git a/Library/libs/Makefile.6809 b/Library/libs/Makefile.6809 index d965d8e7..81d3964f 100644 --- a/Library/libs/Makefile.6809 +++ b/Library/libs/Makefile.6809 @@ -11,7 +11,7 @@ ASM_OPT = -o KRN_HEADERS = userstructs.h KRN_HEADERS_SRC = $(addprefix ../../Kernel/include/,$(KRN_HEADERS)) KRN_HEADERS_COPY = $(addprefix ../include/sys/,$(KRN_HEADERS)) -SRC_CRT0 = crt0_$(PLATFORM).s +SRC_CRT0 = crt0_$(PLATFORM).s crt0nostdio_$(PLATFORM).s OBJ_CRT0 = $(SRC_CRT0:.s=.o) SRC_ASM = setjmp_6809.s ashlsi3_6809.s OBJ_ASM = $(SRC_ASM:.s=.o) diff --git a/Library/libs/crt0nostdio_6809.s b/Library/libs/crt0nostdio_6809.s new file mode 100644 index 00000000..844084a7 --- /dev/null +++ b/Library/libs/crt0nostdio_6809.s @@ -0,0 +1,40 @@ + .module crt0 + + .globl _main + .globl _exit + .globl _environ + .globl ___argv + + .area .header + +start: jmp start2 + .db 'F' + .db 'Z' + .db 'X' + .db '1' + .db __sectionbase_.header__/256 ; page to load at + .dw 0 ; chmem ("0 - 'all'") + .dw __sectionlen_.text__ ; gives us code size info + .dw __sectionlen_.data__ ; gives us data size info + .dw __sectionlen_.bss__ ; bss size info + .dw 0 ; spare + + .area .text + +start2: + ; we don't clear BSS since the kernel already did + + ; pass environ, argc and argv to main + ; pointers and data stuffed above stack by execve() + leax 4,s + stx _environ + leax 2,s + stx ___argv + puls x ; argc + ldy #_exit ; return vector + pshs y + jmp _main ; go + + .area .data + +_environ: .dw 0 -- 2.34.1