Commit 9cebed42 authored by H. Peter Anvin's avatar H. Peter Anvin

x86, alternative: Use .pushsection/.popsection

.section/.previous doesn't nest.  Use .pushsection/.popsection in
<asm/alternative.h> so that they can be properly nested.
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
Link: http://lkml.kernel.org/r/1348256595-29119-5-git-send-email-hpa@linux.intel.com
parent 85fdf05c
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
.macro LOCK_PREFIX .macro LOCK_PREFIX
672: lock 672: lock
.section .smp_locks,"a" .pushsection .smp_locks,"a"
.balign 4 .balign 4
.long 672b - . .long 672b - .
.previous .popsection
.endm .endm
#else #else
.macro LOCK_PREFIX .macro LOCK_PREFIX
......
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
#define LOCK_PREFIX_HERE \ #define LOCK_PREFIX_HERE \
".section .smp_locks,\"a\"\n" \ ".pushsection .smp_locks,\"a\"\n" \
".balign 4\n" \ ".balign 4\n" \
".long 671f - .\n" /* offset */ \ ".long 671f - .\n" /* offset */ \
".previous\n" \ ".popsection\n" \
"671:" "671:"
#define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; " #define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; "
...@@ -99,30 +99,30 @@ static inline int alternatives_text_reserved(void *start, void *end) ...@@ -99,30 +99,30 @@ static inline int alternatives_text_reserved(void *start, void *end)
/* alternative assembly primitive: */ /* alternative assembly primitive: */
#define ALTERNATIVE(oldinstr, newinstr, feature) \ #define ALTERNATIVE(oldinstr, newinstr, feature) \
OLDINSTR(oldinstr) \ OLDINSTR(oldinstr) \
".section .altinstructions,\"a\"\n" \ ".pushsection .altinstructions,\"a\"\n" \
ALTINSTR_ENTRY(feature, 1) \ ALTINSTR_ENTRY(feature, 1) \
".previous\n" \ ".popsection\n" \
".section .discard,\"aw\",@progbits\n" \ ".pushsection .discard,\"aw\",@progbits\n" \
DISCARD_ENTRY(1) \ DISCARD_ENTRY(1) \
".previous\n" \ ".popsection\n" \
".section .altinstr_replacement, \"ax\"\n" \ ".pushsection .altinstr_replacement, \"ax\"\n" \
ALTINSTR_REPLACEMENT(newinstr, feature, 1) \ ALTINSTR_REPLACEMENT(newinstr, feature, 1) \
".previous" ".popsection"
#define ALTERNATIVE_2(oldinstr, newinstr1, feature1, newinstr2, feature2)\ #define ALTERNATIVE_2(oldinstr, newinstr1, feature1, newinstr2, feature2)\
OLDINSTR(oldinstr) \ OLDINSTR(oldinstr) \
".section .altinstructions,\"a\"\n" \ ".pushsection .altinstructions,\"a\"\n" \
ALTINSTR_ENTRY(feature1, 1) \ ALTINSTR_ENTRY(feature1, 1) \
ALTINSTR_ENTRY(feature2, 2) \ ALTINSTR_ENTRY(feature2, 2) \
".previous\n" \ ".popsection\n" \
".section .discard,\"aw\",@progbits\n" \ ".pushsection .discard,\"aw\",@progbits\n" \
DISCARD_ENTRY(1) \ DISCARD_ENTRY(1) \
DISCARD_ENTRY(2) \ DISCARD_ENTRY(2) \
".previous\n" \ ".popsection\n" \
".section .altinstr_replacement, \"ax\"\n" \ ".pushsection .altinstr_replacement, \"ax\"\n" \
ALTINSTR_REPLACEMENT(newinstr1, feature1, 1) \ ALTINSTR_REPLACEMENT(newinstr1, feature1, 1) \
ALTINSTR_REPLACEMENT(newinstr2, feature2, 2) \ ALTINSTR_REPLACEMENT(newinstr2, feature2, 2) \
".previous" ".popsection"
/* /*
* This must be included *after* the definition of ALTERNATIVE due to * This must be included *after* the definition of ALTERNATIVE due to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment