[PATCH 9/12] base-into-desc

zach@vmware.com
Wed, 18 Apr 2007 13:02:11 -0000

Move base / limit accessors into desc.h, where they properly belong.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Index: linux-2.6.13/include/asm-i386/system.h
==================================================================---
linux-2.6.13.orig/include/asm-i386/system.h	2005-08-08 17:58:03.000000000 -0700
+++ linux-2.6.13/include/asm-i386/system.h	2005-08-08 18:01:31.000000000 -0700
@@ -29,40 +29,6 @@
 		      "2" (prev), "d" (next));				\
 } while (0)

-#define _set_base(desc,base) do {					\
-	unsigned long __tmp;						\
-	typecheck(struct desc_struct *, desc);				\
-	asm volatile("movw %w5,%2\n\t"					\
-		     "rorl $16,%5\n\t"					\
-		     "movb %b5,%3\n\t"					\
-		     "movb %h5,%4"					\
-		     :"=m"(*(desc)),					\
-		      "=&q" (__tmp)					\
-		     :"m" (*((char *)(desc)+2)),			\
-		      "m" (*((char *)(desc)+4)),			\
-		      "m" (*((char *)(desc)+7)),			\
-		      "1" (base));					\
-} while(0)
-
-#define _set_limit(desc,limit) do {					\
-	unsigned long __tmp;						\
-	typecheck(struct desc_struct *, desc);				\
-	asm volatile("movw %w4,%2\n\t"					\
-		     "rorl $16,%4\n\t"					\
-		     "movb %3,%h4\n\t"					\
-		     "andb $0xf0,%h4\n\t"				\
-		     "orb %h4,%b4\n\t"					\
-		     "movb %b4,%3"					\
-		     :"=m"(*(desc)),					\
-		      "=&q" (__tmp)					\
-		     :"m" (*(desc)),					\
-		      "m" (*((char *)(desc)+6)),			\
-		      "1" (limit));					\
-} while(0)
-
-#define set_base(desc,base) _set_base((desc), (base))
-#define set_limit(desc,limit) _set_limit((desc), ((limit)-1)>>12)
-
 /*
  * Load a segment. Fall back on loading the zero
  * segment if something goes wrong..
Index: linux-2.6.13/include/asm-i386/desc.h
==================================================================---
linux-2.6.13.orig/include/asm-i386/desc.h	2005-08-08 18:00:50.000000000 -0700
+++ linux-2.6.13/include/asm-i386/desc.h	2005-08-08 18:01:57.000000000 -0700
@@ -68,6 +68,40 @@
 		      : "1" (addr), "r"(desc), "ir"(limit),
"i"(type)); \
 } while (0)

+#define _set_base(desc,base) do {					\
+	unsigned long __tmp;						\
+	typecheck(struct desc_struct *, desc);				\
+	asm volatile("movw %w5,%2\n\t"					\
+		     "rorl $16,%5\n\t"					\
+		     "movb %b5,%3\n\t"					\
+		     "movb %h5,%4"					\
+		     :"=m"(*(desc)),					\
+		      "=&q" (__tmp)					\
+		     :"m" (*((char *)(desc)+2)),			\
+		      "m" (*((char *)(desc)+4)),			\
+		      "m" (*((char *)(desc)+7)),			\
+		      "1" (base));					\
+} while(0)
+
+#define _set_limit(desc,limit) do {					\
+	unsigned long __tmp;						\
+	typecheck(struct desc_struct *, desc);				\
+	asm volatile("movw %w4,%2\n\t"					\
+		     "rorl $16,%4\n\t"					\
+		     "movb %3,%h4\n\t"					\
+		     "andb $0xf0,%h4\n\t"				\
+		     "orb %h4,%b4\n\t"					\
+		     "movb %b4,%3"					\
+		     :"=m"(*(desc)),					\
+		      "=&q" (__tmp)					\
+		     :"m" (*(desc)),					\
+		      "m" (*((char *)(desc)+6)),			\
+		      "1" (limit));					\
+} while(0)
+
+#define set_base(desc,base) _set_base((desc), (base))
+#define set_limit(desc,limit) _set_limit((desc), ((limit)-1)>>12)
+
 static inline void __set_tss_desc(unsigned int cpu, unsigned int entry, void
*addr)
 {
 	_set_tssldt_desc(&get_cpu_gdt_table(cpu)[entry], (int)addr,