commit 7a8e1cc50999275573d97c4d408aeb80f3edef2c
parent 4cf23365482ef11c4a0b856c0601648c05d04e44
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