All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about missing "cld" in x86 string assembly code
@ 2011-12-17 14:58 ` Nai Xia
  0 siblings, 0 replies; 12+ messages in thread
From: Nai Xia @ 2011-12-17 14:58 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Linus Torvalds, Linux-MM, LKML

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

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

* Question about missing "cld" in x86 string assembly code
@ 2011-12-17 14:58 ` Nai Xia
  0 siblings, 0 replies; 12+ messages in thread
From: Nai Xia @ 2011-12-17 14:58 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Linus Torvalds, Linux-MM, LKML

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, 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>

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

* Re: Question about missing "cld" in x86 string assembly code
  2011-12-17 14:58 ` Nai Xia
@ 2011-12-17 17:08   ` Brian Gerst
  -1 siblings, 0 replies; 12+ messages in thread
From: Brian Gerst @ 2011-12-17 17:08 UTC (permalink / raw)
  To: nai.xia; +Cc: Andi Kleen, Linus Torvalds, Linux-MM, LKML

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
‘‘forward’’ (that is, zero) direction before entry and upon exit from
a function."  Therefore it can be assumed to be clear, unless
explicitly set.

--
Brian Gerst

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

* Re: Question about missing "cld" in x86 string assembly code
@ 2011-12-17 17:08   ` Brian Gerst
  0 siblings, 0 replies; 12+ messages in thread
From: Brian Gerst @ 2011-12-17 17:08 UTC (permalink / raw)
  To: nai.xia; +Cc: Andi Kleen, Linus Torvalds, Linux-MM, LKML

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
‘‘forward’’ (that is, zero) direction before entry and upon exit from
a function."  Therefore it can be assumed to be clear, unless
explicitly set.

--
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>

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

* Re: Question about missing "cld" in x86 string assembly code
  2011-12-17 17:08   ` Brian Gerst
@ 2011-12-17 18:39     ` Linus Torvalds
  -1 siblings, 0 replies; 12+ messages in thread
From: Linus Torvalds @ 2011-12-17 18:39 UTC (permalink / raw)
  To: Brian Gerst; +Cc: nai.xia, Andi Kleen, Linux-MM, LKML

On Sat, Dec 17, 2011 at 9:08 AM, Brian Gerst <brgerst@gmail.com> wrote:
>
> The i386 ELF ABI states "The direction flag must be set to the
> ‘‘forward’’ (that is, zero) direction before entry and upon exit from
> a function."  Therefore it can be assumed to be clear, unless
> explicitly set.

The exception, of course, being bootup, fault and interrupt handlers,
and after we've called out to foreign code (ie BIOS).

So there *are* a few cld's sprinkled around, they are just fairly rare.

                    Linus

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

* Re: Question about missing "cld" in x86 string assembly code
@ 2011-12-17 18:39     ` Linus Torvalds
  0 siblings, 0 replies; 12+ messages in thread
From: Linus Torvalds @ 2011-12-17 18:39 UTC (permalink / raw)
  To: Brian Gerst; +Cc: nai.xia, Andi Kleen, Linux-MM, LKML

On Sat, Dec 17, 2011 at 9:08 AM, Brian Gerst <brgerst@gmail.com> wrote:
>
> The i386 ELF ABI states "The direction flag must be set to the
> ‘‘forward’’ (that is, zero) direction before entry and upon exit from
> a function."  Therefore it can be assumed to be clear, unless
> explicitly set.

The exception, of course, being bootup, fault and interrupt handlers,
and after we've called out to foreign code (ie BIOS).

So there *are* a few cld's sprinkled around, they are just fairly rare.

                    Linus

--
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>

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

* Re: Question about missing "cld" in x86 string assembly code
  2011-12-17 17:08   ` Brian Gerst
@ 2011-12-22 15:34     ` nai.xia
  -1 siblings, 0 replies; 12+ messages in thread
From: nai.xia @ 2011-12-22 15:34 UTC (permalink / raw)
  To: Brian Gerst; +Cc: Andi Kleen, Linus Torvalds, Linux-MM, LKML



On 2011年12月18日 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
> ‘‘forward’’ (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

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

* Re: Question about missing "cld" in x86 string assembly code
@ 2011-12-22 15:34     ` nai.xia
  0 siblings, 0 replies; 12+ messages in thread
From: nai.xia @ 2011-12-22 15:34 UTC (permalink / raw)
  To: Brian Gerst; +Cc: Andi Kleen, Linus Torvalds, Linux-MM, LKML



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>

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

* Re: Question about missing "cld" in x86 string assembly code
  2011-12-17 18:39     ` Linus Torvalds
@ 2011-12-22 15:52       ` nai.xia
  -1 siblings, 0 replies; 12+ messages in thread
From: nai.xia @ 2011-12-22 15:52 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Brian Gerst, Andi Kleen, Linux-MM, LKML



On 2011年12月18日 02:39, Linus Torvalds wrote:
> On Sat, Dec 17, 2011 at 9:08 AM, Brian Gerst<brgerst@gmail.com>  wrote:
>>
>> The i386 ELF ABI states "The direction flag must be set to the
>> ‘‘forward’’ (that is, zero) direction before entry and upon exit from
>> a function."  Therefore it can be assumed to be clear, unless
>> explicitly set.
>
> The exception, of course, being bootup, fault and interrupt handlers,
> and after we've called out to foreign code (ie BIOS).

Yeah, I think I see these cld's now. Thanks for the answers!


Nai
>
> So there *are* a few cld's sprinkled around, they are just fairly rare.
>
>                      Linus

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

* Re: Question about missing "cld" in x86 string assembly code
@ 2011-12-22 15:52       ` nai.xia
  0 siblings, 0 replies; 12+ messages in thread
From: nai.xia @ 2011-12-22 15:52 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Brian Gerst, Andi Kleen, Linux-MM, LKML



On 2011a1'12ae??18ae?JPY 02:39, Linus Torvalds wrote:
> On Sat, Dec 17, 2011 at 9:08 AM, Brian Gerst<brgerst@gmail.com>  wrote:
>>
>> 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.
>
> The exception, of course, being bootup, fault and interrupt handlers,
> and after we've called out to foreign code (ie BIOS).

Yeah, I think I see these cld's now. Thanks for the answers!


Nai
>
> So there *are* a few cld's sprinkled around, they are just fairly rare.
>
>                      Linus

--
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>

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

* Question about missing "cld" in x86 string assembly code
@ 2011-12-17 14:52 ` Nai Xia
  0 siblings, 0 replies; 12+ messages in thread
From: Nai Xia @ 2011-12-17 14:52 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Linus Torvalds, Linux-MM, LKML

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

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

* Question about missing "cld" in x86 string assembly code
@ 2011-12-17 14:52 ` Nai Xia
  0 siblings, 0 replies; 12+ messages in thread
From: Nai Xia @ 2011-12-17 14:52 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Linus Torvalds, Linux-MM, LKML

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, 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>

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

end of thread, other threads:[~2011-12-22 15:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-17 14:58 Question about missing "cld" in x86 string assembly code Nai Xia
2011-12-17 14:58 ` Nai Xia
2011-12-17 17:08 ` Brian Gerst
2011-12-17 17:08   ` Brian Gerst
2011-12-17 18:39   ` Linus Torvalds
2011-12-17 18:39     ` Linus Torvalds
2011-12-22 15:52     ` nai.xia
2011-12-22 15:52       ` nai.xia
2011-12-22 15:34   ` nai.xia
2011-12-22 15:34     ` nai.xia
  -- strict thread matches above, loose matches on Subject: below --
2011-12-17 14:52 Nai Xia
2011-12-17 14:52 ` Nai Xia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.