linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* sycall asm inline
@ 2002-06-16 14:51 Samuel Rydh
  2002-06-19  3:24 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Rydh @ 2002-06-16 14:51 UTC (permalink / raw)
  To: linuxppc-dev


I noticed that neither "memory" nor "cc" is listed in the clobber
list of the _syscallN asm inline in asm/unistd.h. Is this safe?
The macro looks like this:

#define _syscall1(type,name,type1,arg1)                                 \
type name(type1 arg1)                                                   \
{                                                                       \
        unsigned long __sc_ret, __sc_err;                               \
        {                                                               \
                register unsigned long __sc_0 __asm__ ("r0");           \
                register unsigned long __sc_3 __asm__ ("r3");           \
                                                                        \
                __sc_3 = (unsigned long) (arg1);                        \
                __sc_0 = __NR_##name;                                   \
                __asm__ __volatile__                                    \
                        ("sc           \n\t"                            \
                         "mfcr %1      "                                \
                        : "=&r" (__sc_3), "=&r" (__sc_0)                \
                        : "0"   (__sc_3), "1"   (__sc_0)                \
                        : __syscall_clobbers);                          \
                __sc_ret = __sc_3;                                      \
                __sc_err = __sc_0;                                      \
        }                                                               \
        __syscall_return (type);                                        \
}

where __syscall_clobbers is just r4-r12. At a later point, some syscalls
are instantiated as inline functions:

	static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)

Of course, as long as the syscall reside in a separate function,
the ABI guarantees that nothing bad will happen. But when the
function is inlined the undeclared side effects could cause problems,
or am I missing something?

Cheers,

/Samuel

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-06-20 15:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-16 14:51 sycall asm inline Samuel Rydh
2002-06-19  3:24 ` Benjamin Herrenschmidt
2002-06-20  1:07   ` Gabriel Paubert
2002-06-19  3:39     ` Benjamin Herrenschmidt
2002-06-20 13:46       ` Gabriel Paubert
2002-06-20 15:18         ` Tom Rini
2002-06-20 15:32           ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).