lkml.org 
[lkml]   [1999]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: complicated inline assembly
On Mon, 23 Aug 1999, Mehta, Hiren wrote:

> Can anybody explain the following complicated assembly that I found
> include/asm-i386/unistd.h file ?
>
> #define _syscall0(type,name) \
> type name(void) \
> { \
> long __res; \
> __asm__ volatile ("int $0x80" \
> : "=a" (__res) \
> : "0" (__NR_##name)); \
> if (__res >= 0) \
> return (type) __res; \
> errno = -__res; \
> return -1; \
> }

_syscall0(foo_t, foo) expands into approximately:
foo_t foo(void)
{
long result;

/* make the call */
result=call_interrupt_vector_0x80(__NR_foo);

if(result>=0) return (foo_t) result;

errno=result;

return -1;
}

--
"Love the dolphins," she advised him. "Write by W.A.S.T.E.."


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.375 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site