diff --git a/lib/libc/runtime/x86_64/Scrt1.s b/lib/libc/runtime/x86_64/Scrt1.s new file mode 100644 index 0000000..385e81c --- /dev/null +++ b/lib/libc/runtime/x86_64/Scrt1.s @@ -0,0 +1,22 @@ +.code64 + +.global _start +.type _start, @function + +.extern __libc_init +.type __libc_init, @function + +_start: + # %rdi: (struct rosetta_bootstrap *)bs_info + mov %rdi, %rbx + call __libc_init + + mov 0(%rbx), %rdi # argc + mov 8(%rbx), %rsi # argv + mov 24(%rbx), %rdx # envp + call main + + mov %rax, %rdi + mov $9, %rax + syscall +1: jmp 1b diff --git a/lib/libc/runtime/x86_64/crt0.s b/lib/libc/runtime/x86_64/crt0.s index b36fb27..098403c 100644 --- a/lib/libc/runtime/x86_64/crt0.s +++ b/lib/libc/runtime/x86_64/crt0.s @@ -1,24 +1 @@ .code64 - -.global _start -.type _start, @function - -.extern __libc_init -.type __libc_init, @function - -.extern task_exit -.type task_exit, @function - -_start: - # %rdi: (struct rosetta_bootstrap *)bs_info - mov %rdi, %rbx - call __libc_init - - mov 0(%rbx), %rdi # argc - mov 8(%rbx), %rsi # argv - mov 24(%rbx), %rdx # envp - call main - - mov %rax, %rdi - call task_exit -1: jmp 1b diff --git a/lib/libc/runtime/x86_64/crt1.s b/lib/libc/runtime/x86_64/crt1.s new file mode 100644 index 0000000..385e81c --- /dev/null +++ b/lib/libc/runtime/x86_64/crt1.s @@ -0,0 +1,22 @@ +.code64 + +.global _start +.type _start, @function + +.extern __libc_init +.type __libc_init, @function + +_start: + # %rdi: (struct rosetta_bootstrap *)bs_info + mov %rdi, %rbx + call __libc_init + + mov 0(%rbx), %rdi # argc + mov 8(%rbx), %rsi # argv + mov 24(%rbx), %rdx # envp + call main + + mov %rax, %rdi + mov $9, %rax + syscall +1: jmp 1b diff --git a/lib/libc/runtime/x86_64/crtbeginS.s b/lib/libc/runtime/x86_64/crtbeginS.s new file mode 100644 index 0000000..0f1d4c0 --- /dev/null +++ b/lib/libc/runtime/x86_64/crtbeginS.s @@ -0,0 +1,7 @@ +.code64 + +.global _crtbeginS +.type _crtbeginS, @function + +_crtbeginS: + ret diff --git a/lib/libc/runtime/x86_64/crtendS.s b/lib/libc/runtime/x86_64/crtendS.s new file mode 100644 index 0000000..bee244b --- /dev/null +++ b/lib/libc/runtime/x86_64/crtendS.s @@ -0,0 +1,7 @@ +.code64 + +.global _crtendS +.type _crtendS, @function + +_crtendS: + ret