x86: unify load_segment macro
authorGlauber de Oliveira Costa <gcosta@redhat.com>
Wed, 30 Jan 2008 12:31:08 +0000 (13:31 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:31:08 +0000 (13:31 +0100)
This patch unifies the load_segment() macro, making them equal in both
x86_64 and i386 architectures. The common version goes to system.h,
and the old are deleted.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/asm-x86/system.h
include/asm-x86/system_32.h
include/asm-x86/system_64.h

index d0803f8c70c41806481d66e80f86301d352e0376..3740bada097cca3af5317c244bd090f08780ffab 100644 (file)
@@ -38,6 +38,27 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
 #define set_base(ldt, base) _set_base(((char *)&(ldt)) , (base))
 #define set_limit(ldt, limit) _set_limit(((char *)&(ldt)) , ((limit)-1))
 
+/*
+ * Load a segment. Fall back on loading the zero
+ * segment if something goes wrong..
+ */
+#define loadsegment(seg, value)                        \
+       asm volatile("\n"                       \
+               "1:\t"                          \
+               "movl %k0,%%" #seg "\n"         \
+               "2:\n"                          \
+               ".section .fixup,\"ax\"\n"      \
+               "3:\t"                          \
+               "movl %k1, %%" #seg "\n\t"      \
+               "jmp 2b\n"                      \
+               ".previous\n"                   \
+               ".section __ex_table,\"a\"\n\t" \
+               _ASM_ALIGN "\n\t"               \
+               _ASM_PTR " 1b,3b\n"             \
+               ".previous"                     \
+               : :"r" (value), "r" (0))
+
+
 /*
  * Save a segment register away
  */
index fb457642ac58013b222b3d46d7037229043be9d4..8db478984ed1e3622c8d88c13dfd527649be3293 100644 (file)
@@ -34,28 +34,6 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
                      "2" (prev), "d" (next));                          \
 } while (0)
 
-/*
- * Load a segment. Fall back on loading the zero
- * segment if something goes wrong..
- */
-#define loadsegment(seg,value)                 \
-       asm volatile("\n"                       \
-               "1:\t"                          \
-               "mov %0,%%" #seg "\n"           \
-               "2:\n"                          \
-               ".section .fixup,\"ax\"\n"      \
-               "3:\t"                          \
-               "pushl $0\n\t"                  \
-               "popl %%" #seg "\n\t"           \
-               "jmp 2b\n"                      \
-               ".previous\n"                   \
-               ".section __ex_table,\"a\"\n\t" \
-               ".align 4\n\t"                  \
-               ".long 1b,3b\n"                 \
-               ".previous"                     \
-               : :"rm" (value))
-
-
 static inline void native_clts(void)
 {
        asm volatile ("clts");
index cc5b2666a0446c612c2095c1c09ba0d6a6846401..0885caace5d488e66ba83869c84f5c055147e5fa 100644 (file)
     
 extern void load_gs_index(unsigned); 
 
-/*
- * Load a segment. Fall back on loading the zero
- * segment if something goes wrong..
- */
-#define loadsegment(seg,value) \
-       asm volatile("\n"                       \
-               "1:\t"                          \
-               "movl %k0,%%" #seg "\n"         \
-               "2:\n"                          \
-               ".section .fixup,\"ax\"\n"      \
-               "3:\t"                          \
-               "movl %1,%%" #seg "\n\t"        \
-               "jmp 2b\n"                      \
-               ".previous\n"                   \
-               ".section __ex_table,\"a\"\n\t" \
-               ".align 8\n\t"                  \
-               ".quad 1b,3b\n"                 \
-               ".previous"                     \
-               : :"r" (value), "r" (0))
-
 /*
  * Clear and set 'TS' bit respectively
  */