Linux-kernel mailing list archive 1999-34,: Re: complicated inline assembly

# Re: complicated inline assembly

Jeff Epler (jepler@inetnebr.com)
Mon, 23 Aug 1999 19:44:43 -0500

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Richard B. Johnson: "Re: complicated inline assembly"
- Previous message: Oliver Xymoron: "Re: complicated inline assembly"

On Mon, Aug 23, 1999 at 05:17:59PM -0700, Mehta, Hiren wrote:
> Can anybody explain the following complicated assembly that I found
> include/asm-i386/unistd.h file ?
>
> #define _syscall0(type,name) \
[snip]

Look at the code generated by this (by syscall0(int sync)):
sync:
movl $36,%eax
int $0x80
testl %eax,%eax
jge .L3
negl %eax
movl %eax,errno
movl $-1,%eax
ret

Perform a syscall with __NR_sync in eax. If the result is >=0 (success),
then return that value. Else, set errno to -eax and return -1.

Other syscalls are similar, except some other values are loaded into
registers (up to 5 or 6 values -- not eax or esp, probably not ebp).

Jeff

    --
    \/ http://incolor.inetnebr.com/jepler/           Jeff Epler jepler@inetnebr.com
    You have acquired a scroll entitled 'irk gleknow mizk'(n).--More--

    This is an IBM Manual scroll.--More--

    You are permanently confused.
    		-- Dave Decot

    -
    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/

- Next message: Richard B. Johnson: "Re: complicated inline assembly"
- Previous message: Oliver Xymoron: "Re: complicated inline assembly"