summary refs log tree commit diff
path: root/src/start.s
diff options
context:
space:
mode:
authorDruid520 <r.ustydruid520@proton.me>2026-08-17 10:47:46 -0700
committerDruid520 <r.ustydruid520@proton.me>2026-08-17 10:47:46 -0700
commit848c0c6a3fcd3a05a2d8d5fbb3eb550bc423f807 (patch)
treece887d52b87656b16f8b82a2aa95082cd8529428 /src/start.s
ADD: charge basics stuff.
Diffstat (limited to 'src/start.s')
-rw-r--r--src/start.s17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/start.s b/src/start.s new file mode 100644 index 0000000..58efed0 --- /dev/null +++ b/src/start.s
@@ -0,0 +1,17 @@
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 movl (%rsp), %edi # argc = first 4 bytes of stack.
8 leaq 8(%rsp), %rsi # argv = address of first arg ptr.
9
10 call main # see main.c.
11
12 movl %eax, %edi # status = ret val.
13 movl $1, %eax # SYS_exit = 1.
14 syscall
15
16 .size _start, .-_start
17 hlt # if syscall fails hang.