public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/14] i386 / Clean up asm and volatile keywords in desc
@ 2005-08-11  4:53 zach
  2005-08-16 23:42 ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: zach @ 2005-08-11  4:53 UTC (permalink / raw)
  To: akpm, chrisl, chrisw, hpa, Keir.Fraser, linux-kernel, m+Ian.Pratt,
	mbligh, pratap, virtualization, zach, zwame

Stop using extra underscores on asm and volatiles, that is just silly.
Also, make lgdt/lidt/sgdt/sldt explicitly "l".

Patch-base: 2.6.13-rc5-mm1
Patch-keys: i386 desc cleanup
Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.13/include/asm-i386/mach-default/mach_desc.h
===================================================================
--- linux-2.6.13.orig/include/asm-i386/mach-default/mach_desc.h	2005-08-09 18:38:14.000000000 -0700
+++ linux-2.6.13/include/asm-i386/mach-default/mach_desc.h	2005-08-10 20:42:03.000000000 -0700
@@ -24,30 +24,30 @@
 #ifndef __MACH_DESC_H
 #define __MACH_DESC_H
 
-#define load_TR_desc() __asm__ __volatile__("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
-#define load_LDT_desc() __asm__ __volatile__("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
+#define load_TR_desc() asm volatile("ltr %w0"::"q" (GDT_ENTRY_TSS*8))
+#define load_LDT_desc() asm volatile("lldt %w0"::"q" (GDT_ENTRY_LDT*8))
 
-#define load_gdt(dtr) __asm__ __volatile("lgdt %0"::"m" (*dtr))
-#define load_idt(dtr) __asm__ __volatile("lidt %0"::"m" (*dtr))
-#define load_tr(tr) __asm__ __volatile("ltr %0"::"mr" (tr))
-#define load_ldt(ldt) __asm__ __volatile("lldt %0"::"mr" (ldt))
-
-#define store_gdt(dtr) __asm__ ("sgdt %0":"=m" (*dtr))
-#define store_idt(dtr) __asm__ ("sidt %0":"=m" (*dtr))
-#define store_tr(tr) __asm__ ("str %0":"=mr" (tr))
-#define store_ldt(ldt) __asm__ ("sldt %0":"=mr" (ldt))
+#define load_gdt(dtr) asm volatile("lgdtl %0"::"m" (*dtr))
+#define load_idt(dtr) asm volatile("lidtl %0"::"m" (*dtr))
+#define load_tr(tr) asm volatile("ltr %0"::"mr" (tr))
+#define load_ldt(ldt) asm volatile("lldt %0"::"mr" (ldt))
+
+#define store_gdt(dtr) asm ("sgdtl %0":"=m" (*dtr))
+#define store_idt(dtr) asm ("sidtl %0":"=m" (*dtr))
+#define store_tr(tr) asm ("str %0":"=mr" (tr))
+#define store_ldt(ldt) asm ("sldt %0":"=mr" (ldt))
 
 static inline unsigned int get_TR_desc(void)
 {
 	unsigned int tr;
-	__asm__ ("str %w0":"=q" (tr));
+	asm ("str %w0":"=q" (tr));
 	return tr;
 }
 
 static inline unsigned int get_LDT_desc(void)
 {
 	unsigned int ldt;
-	__asm__ ("sldt %w0":"=q" (ldt));
+	asm ("sldt %w0":"=q" (ldt));
 	return ldt;
 }
 

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

* Re: [PATCH 4/14] i386 / Clean up asm and volatile keywords in desc
  2005-08-11  4:53 [PATCH 4/14] i386 / Clean up asm and volatile keywords in desc zach
@ 2005-08-16 23:42 ` Andi Kleen
  2005-08-16 23:49   ` H. Peter Anvin
  2005-08-16 23:52   ` Chris Wright
  0 siblings, 2 replies; 4+ messages in thread
From: Andi Kleen @ 2005-08-16 23:42 UTC (permalink / raw)
  To: zach
  Cc: akpm, chrisl, chrisw, hpa, Keir.Fraser, linux-kernel, m+Ian.Pratt,
	mbligh, pratap, virtualization, zwame

On Wed, Aug 10, 2005 at 09:53:51PM -0700, zach@vmware.com wrote:
> Stop using extra underscores on asm and volatiles, that is just silly.

Actually the volatiles might be still useful. Or if you drop them
at least add memory clobbers. I had sometimes bugs  on x86-64
with the compiler moving such assembly statements with invisible 
side effects around too aggressively and causing weird problems.

Agreed on the underscores, I hate them too :)

-Andi

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

* Re: [PATCH 4/14] i386 / Clean up asm and volatile keywords in desc
  2005-08-16 23:42 ` Andi Kleen
@ 2005-08-16 23:49   ` H. Peter Anvin
  2005-08-16 23:52   ` Chris Wright
  1 sibling, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2005-08-16 23:49 UTC (permalink / raw)
  To: Andi Kleen
  Cc: zach, akpm, chrisl, chrisw, Keir.Fraser, linux-kernel,
	m+Ian.Pratt, mbligh, pratap, virtualization, zwame

Andi Kleen wrote:
> On Wed, Aug 10, 2005 at 09:53:51PM -0700, zach@vmware.com wrote:
> 
>>Stop using extra underscores on asm and volatiles, that is just silly.
> 
> Actually the volatiles might be still useful. Or if you drop them
> at least add memory clobbers. I had sometimes bugs  on x86-64
> with the compiler moving such assembly statements with invisible 
> side effects around too aggressively and causing weird problems.
> 
> Agreed on the underscores, I hate them too :)
> 

Well, put volatiles in *unless* the only effect of an asm statement is 
producing the output values.

	-hpa


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

* Re: [PATCH 4/14] i386 / Clean up asm and volatile keywords in desc
  2005-08-16 23:42 ` Andi Kleen
  2005-08-16 23:49   ` H. Peter Anvin
@ 2005-08-16 23:52   ` Chris Wright
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Wright @ 2005-08-16 23:52 UTC (permalink / raw)
  To: Andi Kleen
  Cc: zach, akpm, chrisl, chrisw, hpa, Keir.Fraser, linux-kernel,
	m+Ian.Pratt, mbligh, pratap, virtualization, zwame

* Andi Kleen (ak@suse.de) wrote:
> On Wed, Aug 10, 2005 at 09:53:51PM -0700, zach@vmware.com wrote:
> > Stop using extra underscores on asm and volatiles, that is just silly.
> 
> Actually the volatiles might be still useful. Or if you drop them
> at least add memory clobbers.

They are still there, just the underscores on both asm and volatile got
pulled.

> I had sometimes bugs  on x86-64
> with the compiler moving such assembly statements with invisible 
> side effects around too aggressively and causing weird problems.
> 
> Agreed on the underscores, I hate them too :)

Heh, same here ;-)

thanks,
-chris

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

end of thread, other threads:[~2005-08-16 23:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-11  4:53 [PATCH 4/14] i386 / Clean up asm and volatile keywords in desc zach
2005-08-16 23:42 ` Andi Kleen
2005-08-16 23:49   ` H. Peter Anvin
2005-08-16 23:52   ` Chris Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox