From 50392995d6e7f3a10fb74bb2f9073a4790f8933c Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Mon, 11 Mar 2024 21:40:28 -0400 Subject: simple env with basic test init program --- lib/crt/x86_64/crt0.s | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lib/crt/x86_64/crt0.s (limited to 'lib/crt/x86_64/crt0.s') diff --git a/lib/crt/x86_64/crt0.s b/lib/crt/x86_64/crt0.s new file mode 100644 index 0000000..c5a0ba9 --- /dev/null +++ b/lib/crt/x86_64/crt0.s @@ -0,0 +1,22 @@ +.section .text +.global _start +_start: + #Setup start of stack frame + xorq %rbp, %rbp + pushq %rbp + pushq %rbp + movq %rsp, %rbp + + #Save arguments passed to main + pushq %rdi + pushq %rsi + + #Setup libc and call global constructors + + #Call main + call main + + #Exit + movq %rax, %rdi + call exit +.size _start, . - _start -- cgit v1.2.1