summary refs log tree commit diff
path: root/src/netbsd-start.s
diff options
context:
space:
mode:
authorDruid520 <r.ustydruid520@proton.me>2026-08-17 16:32:37 -0700
committerDruid520 <r.ustydruid520@proton.me>2026-08-17 16:32:37 -0700
commit355bb650b0b9548b604040ca6725937538ff5ff7 (patch)
tree14220c455572fcc9ffea2106a2192037114ec482 /src/netbsd-start.s
parentfd9e51b838f454894940940110f2f18bedf5e621 (diff)
MOD: add better linux support and fix argv/argc.
Diffstat (limited to 'src/netbsd-start.s')
-rw-r--r--src/netbsd-start.s16
1 files changed, 16 insertions, 0 deletions
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 @@
1.section .text
2.globl _start
3.type _start, @function
4_start:
5 xorq %rbp, %rbp # frame ptr (%rbp) = null. marks stack bottom.
6
7 movq (%rsp), %rdi # argc = first 4 bytes of stack.
8 leaq 8(%rsp), %rsi # argv = address of first arg ptr.
9
10 call main
11
12 movl %eax, %edi # status = ret val.
13 movl $1, %eax # SYS_exit = 1.
14 syscall
15
16 hlt # if syscall fails hang.