linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "nai.xia" <nai.xia@gmail.com>
To: Brian Gerst <brgerst@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Question about missing "cld" in x86 string assembly code
Date: Thu, 22 Dec 2011 23:34:54 +0800	[thread overview]
Message-ID: <4EF34E1E.6000805@gmail.com> (raw)
In-Reply-To: <CAMzpN2inHxaSnaYaYXZ4Ya3rK+MWXqR6dN5NVNZy3=OvP04uQA@mail.gmail.com>



On 2011a1'12ae??18ae?JPY 01:08, Brian Gerst wrote:
> On Sat, Dec 17, 2011 at 9:58 AM, Nai Xia<nai.xia@gmail.com>  wrote:
>> Hi Andi,
>>
>> Seems I used a stale email address of you from a related git commit log,
>> so this is a resend, sorry.
>>
>> =======
>> Hi,
>>
>> I notice that all x86 assembly code for string operations containing
>> "scasb, lodsb", etc does not have "cld" at the beginning.
>> Is this 100% safe?
>> Or in other words, how could we be sure that
>> there is no "std" generated by compiler somewhere just before
>> the string operations?
>>
>>
>> Thanks,
>>
>> Nai
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>
> The i386 ELF ABI states "The direction flag must be set to the
> a??a??forwarda??a?? (that is, zero) direction before entry and upon exit from
> a function."  Therefore it can be assumed to be clear, unless
> explicitly set.

Hmm, I get those lines now. Thanks for reply.
Seems gcc started to strictly conform to this ABI since 4.3 . But glibc
seems still have some leading "cld" string code, maybe just prepared for
non-conforming kernels other than Linux.

>
> --
> Brian Gerst

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2011-12-22 15:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-17 14:58 Question about missing "cld" in x86 string assembly code Nai Xia
2011-12-17 17:08 ` Brian Gerst
2011-12-17 18:39   ` Linus Torvalds
2011-12-22 15:52     ` nai.xia
2011-12-22 15:34   ` nai.xia [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-12-17 14:52 Nai Xia

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=4EF34E1E.6000805@gmail.com \
    --to=nai.xia@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=torvalds@linux-foundation.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).