From 355bb650b0b9548b604040ca6725937538ff5ff7 Mon Sep 17 00:00:00 2001 From: Druid520 Date: Mon, 17 Aug 2026 16:32:37 -0700 Subject: MOD: add better linux support and fix argv/argc. --- src/netbsd-start.s | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/netbsd-start.s (limited to 'src/netbsd-start.s') diff --git a/src/netbsd-start.s b/src/netbsd-start.s new file mode 100644 index 0000000..e4e960e --- /dev/null +++ b/src/netbsd-start.s @@ -0,0 +1,16 @@ +.section .text +.globl _start +.type _start, @function +_start: + xorq %rbp, %rbp # frame ptr (%rbp) = null. marks stack bottom. + + movq (%rsp), %rdi # argc = first 4 bytes of stack. + leaq 8(%rsp), %rsi # argv = address of first arg ptr. + + call main + + movl %eax, %edi # status = ret val. + movl $1, %eax # SYS_exit = 1. + syscall + + hlt # if syscall fails hang. -- cgit 1.4.1