[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: (E)GLIBC: inline syscalls



There are two different macros INTERNAL_SYSCALL and INLINE_SYSCALL.
It remains to persuade Ulrich Drepper to distinct between them :-(

Unfortunately he his not someone easy to convince...

I know ...

But in fact, the HAVE_INLINED_SYSCALLS currently
means only HAVE_INTERNAL_SYSCALLS ...

The calls to INLINE_SYSCALL is not the part that worries me the most. It's
rather the code between #ifdef HAVE_INLINED_SYSCALLS in the elf/
directory. Not something we can workaround easily from our ports/sysdeps/directory.

I would suggest declare HAVE_INLINED_SYSCALLS, but keep current
"#define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)"

and only provide INTERNAL_SYSCALL as
#define INTERNAL_SYSCALL(name, err, nr, args...) INTERNAL_SYSCALL_##name(err, args...)

Currently there is only one needed - INTERNAL_SYSCALL_writev due to
dl-misc.c:  INTERNAL_SYSCALL (writev, err, 3, fd, &iov, niov)

It can be implemented similarly as in kfreebsd/i386/linuxthreads/tls.h

#  define TLS_DO_SET_GSBASE(descr)              \
({                                              \
  long base = (long) descr;                     \
  int result;                                   \
  asm volatile (                                \
                "pushl %3\n\t"                  \
                "pushl %2\n\t"                  \
                "pushl %1\n\t"                  \
                "int $0x80\n\t"                 \
                "popl %3\n\t"                   \
                "popl %3\n\t"                   \
                "popl %3\n\t"                   \
                : "=a" (result)                 \
                : "0" (SYS_sysarch),            \
                  "i" (I386_SET_GSBASE),        \
                  "d" (&base)                   \
                : "memory", "cc" );             \
  result;                                       \
})

Petr


Reply to: