Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2000 14:10:23 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        Marc Tardif <intmktg@CAM.ORG>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: syscall assembly
Message-ID:  <20001213141023.O16205@fw.wintelcom.net>
In-Reply-To: <Pine.LNX.4.10.10012131620390.12420-100000@Gloria.CAM.ORG>; from intmktg@CAM.ORG on Wed, Dec 13, 2000 at 04:25:46PM -0500
References:  <Pine.LNX.4.10.10012131620390.12420-100000@Gloria.CAM.ORG>

next in thread | previous in thread | raw e-mail | index | archive | help
* Marc Tardif <intmktg@CAM.ORG> [001213 13:30] wrote:
> Considering the following C code:
> 
> #include <fcntl.h>
> int main() {
>   open("file", O_RDONLY);
>   return 0;
> }
> 
> compiled with gcc -S -O2, the following
> assembly code is generated:
> 
> main:
>         pushl %ebp
>         movl %esp,%ebp
>         subl $8,%esp
>         addl $-8,%esp
>         pushl $0
>         pushl $.LC0
>         call open
>         xorl %eax,%eax
>         leave
>      
> What is the purpose of the subl and addl
> instructions? On Linux, they are simply
> unexistent..

FreeBSD passes syscall args on the stack, Linux uses registers.

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]
"I have the heart of a child; I keep it in a jar on my desk."


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?20001213141023.O16205>