diff options
author | nthnluu <nate1299@me.com> | 2024-01-28 21:20:27 -0500 |
---|---|---|
committer | nthnluu <nate1299@me.com> | 2024-01-28 21:20:27 -0500 |
commit | c63f340d90800895f007de64b7d2d14624263331 (patch) | |
tree | 2c0849fa597dd6da831c8707b6f2603403778d7b /user/lib/libc/entry.S |
Created student weenix repository
Diffstat (limited to 'user/lib/libc/entry.S')
-rw-r--r-- | user/lib/libc/entry.S | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/user/lib/libc/entry.S b/user/lib/libc/entry.S new file mode 100644 index 0000000..e642fe4 --- /dev/null +++ b/user/lib/libc/entry.S @@ -0,0 +1,17 @@ +#ifndef __DYNAMIC__ + +.globl __libc_static_entry + +__libc_static_entry: + add $8, %rsp /* Make sure when we overwrite dummy return address + with the correct one, so args will be in the right + place when we call main */ + movq (%rsp), %rdi /* Copy arguments from stack into registers */ + movq 8(%rsp), %rsi + movq 16(%rsp), %rdx + movq 24(%rsp), %rcx + call main + mov %rax, %rdi + call exit + +#endif |