mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: zach@vmware.com
To: akpm@osdl.org, chrisl@vmware.com, chrisw@osdl.org, hpa@zytor.com,
	Keir.Fraser@cl.cam.ac.uk, linux-kernel@vger.kernel.org,
	m+Ian.Pratt@cl.cam.ac.uk, mbligh@mbligh.org, pratap@vmware.com,
	virtualization@lists.osdl.org, zach@vmware.com,
	zwame@arm.linux.org.uk
Subject: [PATCH 5/14] i386 / Use early clobber to eliminate rotate in desc
Date: Wed, 10 Aug 2005 21:54:11 -0700	[thread overview]
Message-ID: <200508110454.j7B4sBDK019538@zach-dev.vmware.com> (raw)

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.

Patch-base: 2.6.13-rc5-mm1
Patch-keys: i386 desc cleanup optimize
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-09 18:59:10.000000000 -0700
+++ linux-2.6.13/include/asm-i386/desc.h	2005-08-10 20:42:20.000000000 -0700
@@ -34,17 +34,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)
+  
 #include <mach_desc.h>
 
 #define set_tss_desc(cpu,addr) __set_tss_desc(cpu, GDT_ENTRY_TSS, addr)

             reply	other threads:[~2005-08-11  4:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-11  4:54 zach [this message]
2005-08-16 23:45 ` Andi Kleen
2005-08-16 23:56   ` Zachary Amsden
2005-08-17  0:06     ` H. Peter Anvin
2005-08-17 14:22       ` Alan Cox
2005-08-17 15:54         ` H. Peter Anvin

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=200508110454.j7B4sBDK019538@zach-dev.vmware.com \
    --to=zach@vmware.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=chrisl@vmware.com \
    --cc=chrisw@osdl.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=mbligh@mbligh.org \
    --cc=pratap@vmware.com \
    --cc=virtualization@lists.osdl.org \
    --cc=zwame@arm.linux.org.uk \
    /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

Powered by JetHome