commit a94bf959708854d93cb82e4d73eeffa108633036
parent 074d2d430db947164948e6778259504aed29778c
Author: zerous Naveen Narayanan <zerous@nocebo.space>
Date: Sat, 16 Nov 2019 13:43:48 +0100
Update crt-posix.s for i386/linux
According to i386 ABI, function parameters should be passed over the
stack.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/libc/arch/i386/crt-posix.s b/src/libc/arch/i386/crt-posix.s
@@ -4,14 +4,17 @@ _environ:
.long 0
.text
- .global start
+ .globl _start
_start:
movl %esp,%ebp
- movl (%ebp),%edi
- leal 8(%ebp),%esi
leal 16(%ebp,%edi,8),%edx
movl %edx,_environ
+ pushl %edx
+ leal 8(%ebp),%esi
+ pushl %esi
+ movl (%ebp),%edi
+ pushl %edi
call main
movl %eax,%edi