From: H. Peter Anvin Date: Thu, 29 Apr 2010 23:53:17 +0000 (-0700) Subject: Merge branch 'x86/asm' into x86/atomic X-Git-Tag: v3.12-rc1~10323^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9c5841e22231e4e49fd0a1004164e6fce59b7a6;p=kernel%2Fkernel-generic.git Merge branch 'x86/asm' into x86/atomic 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 --- d9c5841e22231e4e49fd0a1004164e6fce59b7a6 diff --cc arch/x86/include/asm/alternative.h index e29a6c9,714bf24..92a9033 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@@ -28,17 -28,14 +28,17 @@@ */ #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 diff --cc arch/x86/kernel/alternative.c index 80b222e,9367384..7023773 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@@ -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); }