On Friday, July 29, 2005, at 01:23 PM, Kean Johnston wrote:
[ cough ]
#if _FILE_OFFSET_BITS - 0 == 32
 int open (const char *, int, int) asm ("open32");
#elif _FILE_OFFSET_BITS - 0 == 64
 int open (const char *, int, int) asm ("open64");
#else
 int open (const char *, int, int) asm ("__open");
#endif

That's a pretty neat trick.

I know, we've filed a patent for it, wait for it, no, wait, ok, just kidding... :-)

I dont suppose I could trouble you to give me the voodoo required for
inserting an extra pushl before the call could I?

Not sure exactly what you want, but with the below I think it will be obvious how to do it.

void ioctl(int, unsigned long, char *) __attribute__((always_inline));
asm inline void ioctl(int fd, unsigned long m, char *buf) {
        movl    #42, 12($esp)
        movl    fd, 8($esp)
        movl    m, 4($esp)
        movl    buf, ($esp)
        call    _xioctl
        xorl    $eax, $eax
        leave
        ret
}

main() {
  ioctl (0, 0, "hi");
}

though, you may need nakky and to spell the inline slightly differently, the above uses CW style assembly.

Reply via email to