mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jian-Xin Lai" <laijx03@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: wrong constraints "=g" at include/asm-i386/string.h, line 186?
Date: Thu, 26 Jul 2007 19:58:58 +0800	[thread overview]
Message-ID: <824323160707260458h490e9ae5la44aabcfa413bba7@mail.gmail.com> (raw)

Hi,

The kernel version is 2.6.20.7. In include/asm-i386/string.h, line 169~185:
static inline char * strrchr(const char * s, int c)
{
int d0, d1;
register char * __res;
__asm__ __volatile__(
        "movb %%al,%%ah\n"
        "1:\tlodsb\n\t"
        "cmpb %%ah,%%al\n\t"
        "jne 2f\n\t"
        "leal -1(%%esi),%0\n"                                    (*)
        "2:\ttestb %%al,%%al\n\t"
        "jne 1b"
        :"=g" (__res), "=&S" (d0), "=&a" (d1)               (**)
        :"0" (0),"1" (s),"2" (c)
        :"memory");
return __res;
}

The 'lea' instruction needs a register here (*), but "g" (**) means
any registers, memory or immediate integer. Is it correct? If the
compiler do not place the __res into a register, the compilation will
fail. Should it be "r"?
Thank you very much.

-- 
Regards,
Lai Jian-Xin

             reply	other threads:[~2007-07-26 11:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 11:58 Jian-Xin Lai [this message]
2007-07-26 15:21 ` H. Peter Anvin
2007-07-27  2:45   ` Jian-Xin Lai
2007-07-27  4:32     ` H. Peter Anvin

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=824323160707260458h490e9ae5la44aabcfa413bba7@mail.gmail.com \
    --to=laijx03@gmail.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®