summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/alternative.h
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2015-07-23 13:51:46 +0100
committerWill Deacon <will.deacon@arm.com>2015-07-27 11:08:41 +0100
commit77ee306c0aea9a219daec256ad25982944affef8 (patch)
tree87f2321645e08cdbbd6525f125af4eef69ef0c94 /arch/arm64/include/asm/alternative.h
parent338d4f49d6f7114a017d294ccf7374df4f998edc (diff)
arm64: alternatives: add enable parameter to conditional asm macros
There are cases where we want to compile out both versions of an alternative code block, so add an enable parameter to the new conditional alternative assembly macros in the same way as alternative_insn. Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/include/asm/alternative.h')
-rw-r--r--arch/arm64/include/asm/alternative.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
index 20367882226c..b474e9106bc2 100644
--- a/arch/arm64/include/asm/alternative.h
+++ b/arch/arm64/include/asm/alternative.h
@@ -91,11 +91,13 @@ void free_alternatives_memory(void);
* The code that follows this macro will be assembled and linked as
* normal. There are no restrictions on this code.
*/
-.macro alternative_if_not cap
+.macro alternative_if_not cap, enable = 1
+ .if \enable
.pushsection .altinstructions, "a"
altinstruction_entry 661f, 663f, \cap, 662f-661f, 664f-663f
.popsection
661:
+ .endif
.endm
/*
@@ -112,18 +114,22 @@ void free_alternatives_memory(void);
* alternative sequence it is defined in (branches into an
* alternative sequence are not fixed up).
*/
-.macro alternative_else
+.macro alternative_else, enable = 1
+ .if \enable
662: .pushsection .altinstr_replacement, "ax"
663:
+ .endif
.endm
/*
* Complete an alternative code sequence.
*/
-.macro alternative_endif
+.macro alternative_endif, enable = 1
+ .if \enable
664: .popsection
.org . - (664b-663b) + (662b-661b)
.org . - (662b-661b) + (664b-663b)
+ .endif
.endm
#define _ALTERNATIVE_CFG(insn1, insn2, cap, cfg, ...) \