Messages in this thread | | | Date | Wed, 25 Aug 1999 10:19:32 +0100 (BST) | From | Mike <> | Subject | Re: complicated inline assembly |
| |
On Mon, 23 Aug 1999, Oliver Xymoron wrote:
> 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;
ITYM errno=-result; :)
> > return -1; > } >
-- Mike <rickettm@ox.compsoc.net>
When we are planning for posterity, we ought to remember that virtue is not hereditary. -- Thomas Paine
- 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/
| |