Merge branch 'x86/asm' into x86/atomic
authorH. Peter Anvin <hpa@zytor.com>
Thu, 29 Apr 2010 23:53:17 +0000 (16:53 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 29 Apr 2010 23:53:17 +0000 (16:53 -0700)
Merge reason:
Conflict between LOCK_PREFIX_HERE and relative alternatives
pointers

Resolved Conflicts:
arch/x86/include/asm/alternative.h
arch/x86/kernel/alternative.c

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1  2 
arch/x86/include/asm/alternative.h
arch/x86/kernel/alternative.c
arch/x86/lib/Makefile
lib/Kconfig.debug
lib/Makefile

   */
  
  #ifdef CONFIG_SMP
 -#define LOCK_PREFIX \
 +#define LOCK_PREFIX_HERE \
                ".section .smp_locks,\"a\"\n"   \
-               _ASM_ALIGN "\n"                 \
-               _ASM_PTR "671f\n" /* address */ \
+               ".balign 4\n"                   \
 -              ".long 661f - .\n" /* offset */ \
++              ".long 671f - .\n" /* offset */ \
                ".previous\n"                   \
 -              "661:\n\tlock; "
 +              "671:"
 +
 +#define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; "
  
  #else /* ! CONFIG_SMP */
 +#define LOCK_PREFIX_HERE ""
  #define LOCK_PREFIX ""
  #endif
  
@@@ -233,19 -235,19 +235,20 @@@ void __init_or_module apply_alternative
  
  #ifdef CONFIG_SMP
  
- static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
+ static void alternatives_smp_lock(const s32 *start, const s32 *end,
+                                 u8 *text, u8 *text_end)
  {
-       u8 **ptr;
+       const s32 *poff;
  
        mutex_lock(&text_mutex);
-       for (ptr = start; ptr < end; ptr++) {
-               if (*ptr < text)
-                       continue;
-               if (*ptr > text_end)
+       for (poff = start; poff < end; poff++) {
+               u8 *ptr = (u8 *)poff + *poff;
+               if (!*poff || ptr < text || ptr >= text_end)
                        continue;
                /* turn DS segment override prefix into lock prefix */
-               if (**ptr == 0x3e)
-                       text_poke(*ptr, ((unsigned char []){0xf0}), 1);
 -              text_poke(ptr, ((unsigned char []){0xf0}), 1);
++              if (*ptr == 0x3e)
++                      text_poke(ptr, ((unsigned char []){0xf0}), 1);
        };
        mutex_unlock(&text_mutex);
  }
@@@ -258,14 -261,13 +262,14 @@@ static void alternatives_smp_unlock(con
                return;
  
        mutex_lock(&text_mutex);
-       for (ptr = start; ptr < end; ptr++) {
-               if (*ptr < text)
-                       continue;
-               if (*ptr > text_end)
+       for (poff = start; poff < end; poff++) {
+               u8 *ptr = (u8 *)poff + *poff;
+               if (!*poff || ptr < text || ptr >= text_end)
                        continue;
                /* turn lock prefix into DS segment override prefix */
-               if (**ptr == 0xf0)
-                       text_poke(*ptr, ((unsigned char []){0x3E}), 1);
 -              text_poke(ptr, ((unsigned char []){0x3E}), 1);
++              if (*ptr == 0xf0)
++                      text_poke(ptr, ((unsigned char []){0x3E}), 1);
        };
        mutex_unlock(&text_mutex);
  }
Simple merge
Simple merge
diff --cc lib/Makefile
Simple merge