linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Samuel Rydh <samuel@ibrium.se>
To: linuxppc-dev@lists.linuxppc.org
Subject: sycall asm inline
Date: Sun, 16 Jun 2002 16:51:29 +0200	[thread overview]
Message-ID: <20020616145129.GA11923@ibrium.se> (raw)


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/

             reply	other threads:[~2002-06-16 14:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-16 14:51 Samuel Rydh [this message]
2002-06-19  3:24 ` sycall asm inline 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020616145129.GA11923@ibrium.se \
    --to=samuel@ibrium.se \
    --cc=linuxppc-dev@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).