Lines 4-9
Link Here
|
4 |
#include <linux/config.h> |
4 |
#include <linux/config.h> |
5 |
#include <linux/kernel.h> |
5 |
#include <linux/kernel.h> |
6 |
#include <asm/segment.h> |
6 |
#include <asm/segment.h> |
|
|
7 |
#include <linux/bitops.h> /* for LOCK_PREFIX... */ |
8 |
|
9 |
/* |
10 |
* Alternative inline assembly with input. |
11 |
* |
12 |
* Pecularities: |
13 |
* No memory clobber here. |
14 |
* Argument numbers start with 1. |
15 |
* Best is to use constraints that are fixed size (like (%1) ... "r") |
16 |
* If you use variable sized constraints like "m" or "g" in the |
17 |
* replacement maake sure to pad to the worst case length. |
18 |
*/ |
19 |
|
20 |
#define alternative_input(oldinstr, newinstr, feature, input) \ |
21 |
asm volatile ("661:\n\t" oldinstr "\n662:\n" \ |
22 |
".section .altinstructions,\"a\"\n" \ |
23 |
" .align 8\n" \ |
24 |
" .quad 661b\n" /* label */ \ |
25 |
" .quad 663f\n" /* new instruction */ \ |
26 |
" .byte %c0\n" /* feature bit */ \ |
27 |
" .byte 662b-661b\n" /* sourcelen */ \ |
28 |
" .byte 664f-663f\n" /* replacementlen */ \ |
29 |
".previous\n" \ |
30 |
".section .altinstr_replacement,\"ax\"\n" \ |
31 |
"663:\n\t" newinstr "\n664:\n" /* replacement */ \ |
32 |
".previous" :: "i" (feature), input) |
7 |
|
33 |
|
8 |
#ifdef __KERNEL__ |
34 |
#ifdef __KERNEL__ |
9 |
|
35 |
|
Lines 114-143
Link Here
|
114 |
".previous" :: "i" (feature) : "memory") |
140 |
".previous" :: "i" (feature) : "memory") |
115 |
|
141 |
|
116 |
/* |
142 |
/* |
117 |
* Alternative inline assembly with input. |
|
|
118 |
* |
119 |
* Pecularities: |
120 |
* No memory clobber here. |
121 |
* Argument numbers start with 1. |
122 |
* Best is to use constraints that are fixed size (like (%1) ... "r") |
123 |
* If you use variable sized constraints like "m" or "g" in the |
124 |
* replacement maake sure to pad to the worst case length. |
125 |
*/ |
126 |
#define alternative_input(oldinstr, newinstr, feature, input...) \ |
127 |
asm volatile ("661:\n\t" oldinstr "\n662:\n" \ |
128 |
".section .altinstructions,\"a\"\n" \ |
129 |
" .align 8\n" \ |
130 |
" .quad 661b\n" /* label */ \ |
131 |
" .quad 663f\n" /* new instruction */ \ |
132 |
" .byte %c0\n" /* feature bit */ \ |
133 |
" .byte 662b-661b\n" /* sourcelen */ \ |
134 |
" .byte 664f-663f\n" /* replacementlen */ \ |
135 |
".previous\n" \ |
136 |
".section .altinstr_replacement,\"ax\"\n" \ |
137 |
"663:\n\t" newinstr "\n664:\n" /* replacement */ \ |
138 |
".previous" :: "i" (feature), ##input) |
139 |
|
140 |
/* |
141 |
* Clear and set 'TS' bit respectively |
143 |
* Clear and set 'TS' bit respectively |
142 |
*/ |
144 |
*/ |
143 |
#define clts() __asm__ __volatile__ ("clts") |
145 |
#define clts() __asm__ __volatile__ ("clts") |