Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

static inline code

0 views
Skip to first unread message

mavi

unread,
Apr 10, 2002, 10:05:04 AM4/10/02
to
this macro (at belove) is in unistd.h in the linux kernel...
i read some docement but i cant understand what "=a" means... what do you think
about what this macro does... i cant resolve...
.........................................................................
##define _syscall0(type,name) \
type name(void) \
{ \
long __res; \
__asm__ volatile ("int $0x80" \
: "=a" (__res) \
: "0" (__NR_##name)); \
__syscall_return(type,__res); \
}
............................................................................

Andy Isaacson

unread,
Apr 10, 2002, 2:11:55 PM4/10/02
to
In article <1018447565...@news.ege.edu.tr>,

mavi <ne...@news.ege.edu.tr> wrote:
>this macro (at belove) is in unistd.h in the linux kernel...
>i read some docement but i cant understand what "=a" means... what do you think
>about what this macro does... i cant resolve...
>.........................................................................
>##define _syscall0(type,name) \
>type name(void) \
>{ \
>long __res; \
>__asm__ volatile ("int $0x80" \
> : "=a" (__res) \
> : "0" (__NR_##name)); \
>__syscall_return(type,__res); \
>}

This is a GNU C inline assembly statement. Check the 'info' pages for
GNU C for documentation of its syntax, by typing "info gcc" at your
Linux shell prompt. You're interested in "C Extensions:Extended asm"
and "Machine Desc:Constraints:Machine Constraints".

In this case, it means that the C variable __res is an output argument
in the 'a' register.

-andy

Barry Margolin

unread,
Apr 10, 2002, 12:51:12 PM4/10/02
to
>this macro (at belove) is in unistd.h in the linux kernel...
>i read some docement but i cant understand what "=a" means... what do you think
>about what this macro does... i cant resolve...

It's mostly Intel assembly language, as indicated by the __asm__ token. My
guess is that "=a" has something to do with inserting the address of __res
into the assembly code.

>.........................................................................
>##define _syscall0(type,name) \
>type name(void) \
>{ \
>long __res; \
>__asm__ volatile ("int $0x80" \
> : "=a" (__res) \
> : "0" (__NR_##name)); \
>__syscall_return(type,__res); \
>}
>............................................................................


--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

0 new messages