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> Index: linux-2.6.13/include/asm-i386/desc.h ==================================================================--- linux-2.6.13.orig/include/asm-i386/desc.h 2005-08-08 15:41:11.000000000 -0700 +++ linux-2.6.13/include/asm-i386/desc.h 2005-08-08 15:47:01.000000000 -0700 @@ -51,17 +51,21 @@ 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) + static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void *addr) { _set_tssldt_desc(&per_cpu(cpu_gdt_table, cpu)[entry], (int)addr,