Skip to content

Commit 9cebed4

Browse files
author
H. Peter Anvin
committed
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: H. Peter Anvin <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
1 parent 85fdf05 commit 9cebed4

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

arch/x86/include/asm/alternative-asm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
#ifdef CONFIG_SMP
66
.macro LOCK_PREFIX
77
672: lock
8-
.section .smp_locks,"a"
8+
.pushsection .smp_locks,"a"
99
.balign 4
1010
.long 672b - .
11-
.previous
11+
.popsection
1212
.endm
1313
#else
1414
.macro LOCK_PREFIX

arch/x86/include/asm/alternative.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929

3030
#ifdef CONFIG_SMP
3131
#define LOCK_PREFIX_HERE \
32-
".section .smp_locks,\"a\"\n" \
33-
".balign 4\n" \
34-
".long 671f - .\n" /* offset */ \
35-
".previous\n" \
32+
".pushsection .smp_locks,\"a\"\n" \
33+
".balign 4\n" \
34+
".long 671f - .\n" /* offset */ \
35+
".popsection\n" \
3636
"671:"
3737

3838
#define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; "
@@ -99,30 +99,30 @@ static inline int alternatives_text_reserved(void *start, void *end)
9999
/* alternative assembly primitive: */
100100
#define ALTERNATIVE(oldinstr, newinstr, feature) \
101101
OLDINSTR(oldinstr) \
102-
".section .altinstructions,\"a\"\n" \
102+
".pushsection .altinstructions,\"a\"\n" \
103103
ALTINSTR_ENTRY(feature, 1) \
104-
".previous\n" \
105-
".section .discard,\"aw\",@progbits\n" \
104+
".popsection\n" \
105+
".pushsection .discard,\"aw\",@progbits\n" \
106106
DISCARD_ENTRY(1) \
107-
".previous\n" \
108-
".section .altinstr_replacement, \"ax\"\n" \
107+
".popsection\n" \
108+
".pushsection .altinstr_replacement, \"ax\"\n" \
109109
ALTINSTR_REPLACEMENT(newinstr, feature, 1) \
110-
".previous"
110+
".popsection"
111111

112112
#define ALTERNATIVE_2(oldinstr, newinstr1, feature1, newinstr2, feature2)\
113113
OLDINSTR(oldinstr) \
114-
".section .altinstructions,\"a\"\n" \
114+
".pushsection .altinstructions,\"a\"\n" \
115115
ALTINSTR_ENTRY(feature1, 1) \
116116
ALTINSTR_ENTRY(feature2, 2) \
117-
".previous\n" \
118-
".section .discard,\"aw\",@progbits\n" \
117+
".popsection\n" \
118+
".pushsection .discard,\"aw\",@progbits\n" \
119119
DISCARD_ENTRY(1) \
120120
DISCARD_ENTRY(2) \
121-
".previous\n" \
122-
".section .altinstr_replacement, \"ax\"\n" \
121+
".popsection\n" \
122+
".pushsection .altinstr_replacement, \"ax\"\n" \
123123
ALTINSTR_REPLACEMENT(newinstr1, feature1, 1) \
124124
ALTINSTR_REPLACEMENT(newinstr2, feature2, 2) \
125-
".previous"
125+
".popsection"
126126

127127
/*
128128
* This must be included *after* the definition of ALTERNATIVE due to

0 commit comments

Comments
 (0)