diff options
author | Borislav Petkov <bp@suse.de> | 2015-04-04 10:40:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-05-06 05:25:31 -0400 |
commit | 5b673a48c54594108aec368014efc7334743f06a (patch) | |
tree | 746c6eb8c0bb62b897b74d5f724cef8f3b285c01 | |
parent | d9ee948d82203811a545ba26b0172fce4970d1dc (diff) |
x86/alternatives: Document macros
Add some text to the macro magic for future reference and against
failing human memory.
Requested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/include/asm/alternative-asm.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h index bdf02eeee765..e7636bac7372 100644 --- a/arch/x86/include/asm/alternative-asm.h +++ b/arch/x86/include/asm/alternative-asm.h | |||
@@ -18,6 +18,12 @@ | |||
18 | .endm | 18 | .endm |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | /* | ||
22 | * Issue one struct alt_instr descriptor entry (need to put it into | ||
23 | * the section .altinstructions, see below). This entry contains | ||
24 | * enough information for the alternatives patching code to patch an | ||
25 | * instruction. See apply_alternatives(). | ||
26 | */ | ||
21 | .macro altinstruction_entry orig alt feature orig_len alt_len pad_len | 27 | .macro altinstruction_entry orig alt feature orig_len alt_len pad_len |
22 | .long \orig - . | 28 | .long \orig - . |
23 | .long \alt - . | 29 | .long \alt - . |
@@ -27,6 +33,12 @@ | |||
27 | .byte \pad_len | 33 | .byte \pad_len |
28 | .endm | 34 | .endm |
29 | 35 | ||
36 | /* | ||
37 | * Define an alternative between two instructions. If @feature is | ||
38 | * present, early code in apply_alternatives() replaces @oldinstr with | ||
39 | * @newinstr. ".skip" directive takes care of proper instruction padding | ||
40 | * in case @newinstr is longer than @oldinstr. | ||
41 | */ | ||
30 | .macro ALTERNATIVE oldinstr, newinstr, feature | 42 | .macro ALTERNATIVE oldinstr, newinstr, feature |
31 | 140: | 43 | 140: |
32 | \oldinstr | 44 | \oldinstr |
@@ -55,6 +67,12 @@ | |||
55 | */ | 67 | */ |
56 | #define alt_max_short(a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b))))) | 68 | #define alt_max_short(a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b))))) |
57 | 69 | ||
70 | |||
71 | /* | ||
72 | * Same as ALTERNATIVE macro above but for two alternatives. If CPU | ||
73 | * has @feature1, it replaces @oldinstr with @newinstr1. If CPU has | ||
74 | * @feature2, it replaces @oldinstr with @feature2. | ||
75 | */ | ||
58 | .macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2 | 76 | .macro ALTERNATIVE_2 oldinstr, newinstr1, feature1, newinstr2, feature2 |
59 | 140: | 77 | 140: |
60 | \oldinstr | 78 | \oldinstr |