From: Zachary Amsden <zach@vmware.com>

Use an early clobber on addr to avoid the extra rorl instruction at the end of
_set_tssldt_desc.

Also, get some C type checking on the descriptor struct here.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 include/asm-i386/desc.h |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff -puN include/asm-i386/desc.h~i386--use-early-clobber-to-eliminate-rotate-in-desc include/asm-i386/desc.h
--- 25/include/asm-i386/desc.h~i386--use-early-clobber-to-eliminate-rotate-in-desc	Wed Aug 17 13:33:46 2005
+++ 25-akpm/include/asm-i386/desc.h	Wed Aug 17 13:33:46 2005
@@ -34,16 +34,20 @@ extern struct Xgt_desc_struct idt_descr,
 extern struct desc_struct default_ldt[];
 extern void set_intr_gate(unsigned int irq, void * addr);
 
-#define _set_tssldt_desc(n,addr,limit,type) \
-__asm__ __volatile__ ("movw %w3,0(%2)\n\t" \
-	"movw %w1,2(%2)\n\t" \
-	"rorl $16,%1\n\t" \
-	"movb %b1,4(%2)\n\t" \
-	"movb %4,5(%2)\n\t" \
-	"movb $0,6(%2)\n\t" \
-	"movb %h1,7(%2)\n\t" \
-	"rorl $16,%1" \
-	: "=m"(*(n)) : "q" (addr), "r"(n), "ir"(limit), "i"(type))
+#define _set_tssldt_desc(desc,addr,limit,type) \
+do { \
+	unsigned long __tmp; \
+	typecheck(struct desc_struct *, desc); \
+	asm volatile ("movw %w4,0(%3)\n\t" \
+		      "movw %w2,2(%3)\n\t" \
+		      "rorl $16,%2\n\t" \
+		      "movb %b2,4(%3)\n\t" \
+		      "movb %5,5(%3)\n\t" \
+		      "movb $0,6(%3)\n\t" \
+		      "movb %h2,7(%3)\n\t" \
+		      : "=m"(*(desc)), "=&q" (__tmp) \
+		      : "1" (addr), "r"(desc), "ir"(limit), "i"(type)); \
+} while (0)
 
 #include <mach_desc.h>
 
_