Date: Thu, 14 Dec 2000 09:51:42 +1100 (EST) From: Iain Templeton <iain@research.canon.com.au> To: freebsd-hackers@FreeBSD.ORG Cc: Alfred Perlstein <bright@wintelcom.net>, Drew Eckhardt <drew@PoohSticks.ORG>, Marc Tardif <intmktg@CAM.ORG> Subject: Re: syscall assembly Message-ID: <Pine.LNX.4.10.10012140949390.22824-100000@blow.research.canon.com.au> In-Reply-To: <20001213142539.R16205@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 13 Dec 2000, Alfred Perlstein wrote:
> David, can you look at this?
>
> #include <fcntl.h>
>
> int foo() {
> open("file", O_RDONLY);
> return 0;
> }
> int main() {
> int x;
> x = foo();
> return 0;
> }
>
> results in:
>
> foo:
> pushl %ebp
> movl %esp,%ebp
> subl $8,%esp
> addl $-8,%esp
> pushl $0
> pushl $.LC0
> call open
> xorl %eax,%eax
> leave
> ret
>
> why the subl then addl?
>
Well, as a thoroughly rough guess, the subl is probably to create space
on the stack for the args, and the addl is to align the stack to a 16
byte address?
I know that the PowerPC ABI wants that, but no idea about x86.
Iain
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.10.10012140949390.22824-100000>
