aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2012-06-25 09:33:21 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-07-10 05:18:25 -0400
commitcdaade71291e90d8e9cc8885ae5ebc20ed4ddfd8 (patch)
treea8f1f9ac62f72bf0c1297f97a87f8511a2c19a99
parent55a5db184667433add3c8136c9e3b27899c79d3c (diff)
powerpc: Start using ___PPC_RA/B/S/T where necessary
Now have ___PPC_RA/B/S/T we can use it in some places. These are places where we can't use the existing defines which will soon enforce R0-R31 usage. The macros being changed here are being used in inline asm, which can't convert to enforce the R0-R31 usage. bpf_jit uses a mix of both generated and non-generated with the same code, so just convert all these to use the ___PPC_R versions which won't enforce R usage later. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h12
-rw-r--r--arch/powerpc/net/bpf_jit.h106
2 files changed, 59 insertions, 59 deletions
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index 7ad07dfbfdf7..104cfefea4ad 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -180,13 +180,13 @@
180#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \ 180#define PPC_DCBZL(a, b) stringify_in_c(.long PPC_INST_DCBZL | \
181 __PPC_RA(a) | __PPC_RB(b)) 181 __PPC_RA(a) | __PPC_RB(b))
182#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \ 182#define PPC_LDARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LDARX | \
183 __PPC_RT(t) | __PPC_RA(a) | \ 183 ___PPC_RT(t) | ___PPC_RA(a) | \
184 __PPC_RB(b) | __PPC_EH(eh)) 184 ___PPC_RB(b) | __PPC_EH(eh))
185#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \ 185#define PPC_LWARX(t, a, b, eh) stringify_in_c(.long PPC_INST_LWARX | \
186 __PPC_RT(t) | __PPC_RA(a) | \ 186 ___PPC_RT(t) | ___PPC_RA(a) | \
187 __PPC_RB(b) | __PPC_EH(eh)) 187 ___PPC_RB(b) | __PPC_EH(eh))
188#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ 188#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \
189 __PPC_RB(b)) 189 ___PPC_RB(b))
190#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ 190#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
191 __PPC_RA(a) | __PPC_RS(s)) 191 __PPC_RA(a) | __PPC_RS(s))
192#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \ 192#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
@@ -204,7 +204,7 @@
204#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \ 204#define PPC_WAIT(w) stringify_in_c(.long PPC_INST_WAIT | \
205 __PPC_WC(w)) 205 __PPC_WC(w))
206#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \ 206#define PPC_TLBIE(lp,a) stringify_in_c(.long PPC_INST_TLBIE | \
207 __PPC_RB(a) | __PPC_RS(lp)) 207 ___PPC_RB(a) | ___PPC_RS(lp))
208#define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \ 208#define PPC_TLBSRX_DOT(a,b) stringify_in_c(.long PPC_INST_TLBSRX_DOT | \
209 __PPC_RA(a) | __PPC_RB(b)) 209 __PPC_RA(a) | __PPC_RB(b))
210#define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \ 210#define PPC_TLBIVAX(a,b) stringify_in_c(.long PPC_INST_TLBIVAX | \
diff --git a/arch/powerpc/net/bpf_jit.h b/arch/powerpc/net/bpf_jit.h
index 5c3cf2d04e41..1fc8109bf2f9 100644
--- a/arch/powerpc/net/bpf_jit.h
+++ b/arch/powerpc/net/bpf_jit.h
@@ -75,23 +75,23 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
75#define PPC_NOP() EMIT(PPC_INST_NOP) 75#define PPC_NOP() EMIT(PPC_INST_NOP)
76#define PPC_BLR() EMIT(PPC_INST_BLR) 76#define PPC_BLR() EMIT(PPC_INST_BLR)
77#define PPC_BLRL() EMIT(PPC_INST_BLRL) 77#define PPC_BLRL() EMIT(PPC_INST_BLRL)
78#define PPC_MTLR(r) EMIT(PPC_INST_MTLR | __PPC_RT(r)) 78#define PPC_MTLR(r) EMIT(PPC_INST_MTLR | ___PPC_RT(r))
79#define PPC_ADDI(d, a, i) EMIT(PPC_INST_ADDI | __PPC_RT(d) | \ 79#define PPC_ADDI(d, a, i) EMIT(PPC_INST_ADDI | ___PPC_RT(d) | \
80 __PPC_RA(a) | IMM_L(i)) 80 ___PPC_RA(a) | IMM_L(i))
81#define PPC_MR(d, a) PPC_OR(d, a, a) 81#define PPC_MR(d, a) PPC_OR(d, a, a)
82#define PPC_LI(r, i) PPC_ADDI(r, 0, i) 82#define PPC_LI(r, i) PPC_ADDI(r, 0, i)
83#define PPC_ADDIS(d, a, i) EMIT(PPC_INST_ADDIS | \ 83#define PPC_ADDIS(d, a, i) EMIT(PPC_INST_ADDIS | \
84 __PPC_RS(d) | __PPC_RA(a) | IMM_L(i)) 84 ___PPC_RS(d) | ___PPC_RA(a) | IMM_L(i))
85#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i) 85#define PPC_LIS(r, i) PPC_ADDIS(r, 0, i)
86#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | __PPC_RS(r) | \ 86#define PPC_STD(r, base, i) EMIT(PPC_INST_STD | ___PPC_RS(r) | \
87 __PPC_RA(base) | ((i) & 0xfffc)) 87 ___PPC_RA(base) | ((i) & 0xfffc))
88 88
89#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | __PPC_RT(r) | \ 89#define PPC_LD(r, base, i) EMIT(PPC_INST_LD | ___PPC_RT(r) | \
90 __PPC_RA(base) | IMM_L(i)) 90 ___PPC_RA(base) | IMM_L(i))
91#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | __PPC_RT(r) | \ 91#define PPC_LWZ(r, base, i) EMIT(PPC_INST_LWZ | ___PPC_RT(r) | \
92 __PPC_RA(base) | IMM_L(i)) 92 ___PPC_RA(base) | IMM_L(i))
93#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | __PPC_RT(r) | \ 93#define PPC_LHZ(r, base, i) EMIT(PPC_INST_LHZ | ___PPC_RT(r) | \
94 __PPC_RA(base) | IMM_L(i)) 94 ___PPC_RA(base) | IMM_L(i))
95/* Convenience helpers for the above with 'far' offsets: */ 95/* Convenience helpers for the above with 'far' offsets: */
96#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \ 96#define PPC_LD_OFFS(r, base, i) do { if ((i) < 32768) PPC_LD(r, base, i); \
97 else { PPC_ADDIS(r, base, IMM_HA(i)); \ 97 else { PPC_ADDIS(r, base, IMM_HA(i)); \
@@ -105,52 +105,52 @@ DECLARE_LOAD_FUNC(sk_load_byte_msh);
105 else { PPC_ADDIS(r, base, IMM_HA(i)); \ 105 else { PPC_ADDIS(r, base, IMM_HA(i)); \
106 PPC_LHZ(r, r, IMM_L(i)); } } while(0) 106 PPC_LHZ(r, r, IMM_L(i)); } } while(0)
107 107
108#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | __PPC_RA(a) | IMM_L(i)) 108#define PPC_CMPWI(a, i) EMIT(PPC_INST_CMPWI | ___PPC_RA(a) | IMM_L(i))
109#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | __PPC_RA(a) | IMM_L(i)) 109#define PPC_CMPDI(a, i) EMIT(PPC_INST_CMPDI | ___PPC_RA(a) | IMM_L(i))
110#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | __PPC_RA(a) | IMM_L(i)) 110#define PPC_CMPLWI(a, i) EMIT(PPC_INST_CMPLWI | ___PPC_RA(a) | IMM_L(i))
111#define PPC_CMPLW(a, b) EMIT(PPC_INST_CMPLW | __PPC_RA(a) | __PPC_RB(b)) 111#define PPC_CMPLW(a, b) EMIT(PPC_INST_CMPLW | ___PPC_RA(a) | ___PPC_RB(b))
112 112
113#define PPC_SUB(d, a, b) EMIT(PPC_INST_SUB | __PPC_RT(d) | \ 113#define PPC_SUB(d, a, b) EMIT(PPC_INST_SUB | ___PPC_RT(d) | \
114 __PPC_RB(a) | __PPC_RA(b)) 114 ___PPC_RB(a) | ___PPC_RA(b))
115#define PPC_ADD(d, a, b) EMIT(PPC_INST_ADD | __PPC_RT(d) | \ 115#define PPC_ADD(d, a, b) EMIT(PPC_INST_ADD | ___PPC_RT(d) | \
116 __PPC_RA(a) | __PPC_RB(b)) 116 ___PPC_RA(a) | ___PPC_RB(b))
117#define PPC_MUL(d, a, b) EMIT(PPC_INST_MULLW | __PPC_RT(d) | \ 117#define PPC_MUL(d, a, b) EMIT(PPC_INST_MULLW | ___PPC_RT(d) | \
118 __PPC_RA(a) | __PPC_RB(b)) 118 ___PPC_RA(a) | ___PPC_RB(b))
119#define PPC_MULHWU(d, a, b) EMIT(PPC_INST_MULHWU | __PPC_RT(d) | \ 119#define PPC_MULHWU(d, a, b) EMIT(PPC_INST_MULHWU | ___PPC_RT(d) | \
120 __PPC_RA(a) | __PPC_RB(b)) 120 ___PPC_RA(a) | ___PPC_RB(b))
121#define PPC_MULI(d, a, i) EMIT(PPC_INST_MULLI | __PPC_RT(d) | \ 121#define PPC_MULI(d, a, i) EMIT(PPC_INST_MULLI | ___PPC_RT(d) | \
122 __PPC_RA(a) | IMM_L(i)) 122 ___PPC_RA(a) | IMM_L(i))
123#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | __PPC_RT(d) | \ 123#define PPC_DIVWU(d, a, b) EMIT(PPC_INST_DIVWU | ___PPC_RT(d) | \
124 __PPC_RA(a) | __PPC_RB(b)) 124 ___PPC_RA(a) | ___PPC_RB(b))
125#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | __PPC_RA(d) | \ 125#define PPC_AND(d, a, b) EMIT(PPC_INST_AND | ___PPC_RA(d) | \
126 __PPC_RS(a) | __PPC_RB(b)) 126 ___PPC_RS(a) | ___PPC_RB(b))
127#define PPC_ANDI(d, a, i) EMIT(PPC_INST_ANDI | __PPC_RA(d) | \ 127#define PPC_ANDI(d, a, i) EMIT(PPC_INST_ANDI | ___PPC_RA(d) | \
128 __PPC_RS(a) | IMM_L(i)) 128 ___PPC_RS(a) | IMM_L(i))
129#define PPC_AND_DOT(d, a, b) EMIT(PPC_INST_ANDDOT | __PPC_RA(d) | \ 129#define PPC_AND_DOT(d, a, b) EMIT(PPC_INST_ANDDOT | ___PPC_RA(d) | \
130 __PPC_RS(a) | __PPC_RB(b)) 130 ___PPC_RS(a) | ___PPC_RB(b))
131#define PPC_OR(d, a, b) EMIT(PPC_INST_OR | __PPC_RA(d) | \ 131#define PPC_OR(d, a, b) EMIT(PPC_INST_OR | ___PPC_RA(d) | \
132 __PPC_RS(a) | __PPC_RB(b)) 132 ___PPC_RS(a) | ___PPC_RB(b))
133#define PPC_ORI(d, a, i) EMIT(PPC_INST_ORI | __PPC_RA(d) | \ 133#define PPC_ORI(d, a, i) EMIT(PPC_INST_ORI | ___PPC_RA(d) | \
134 __PPC_RS(a) | IMM_L(i)) 134 ___PPC_RS(a) | IMM_L(i))
135#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | __PPC_RA(d) | \ 135#define PPC_ORIS(d, a, i) EMIT(PPC_INST_ORIS | ___PPC_RA(d) | \
136 __PPC_RS(a) | IMM_L(i)) 136 ___PPC_RS(a) | IMM_L(i))
137#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | __PPC_RA(d) | \ 137#define PPC_SLW(d, a, s) EMIT(PPC_INST_SLW | ___PPC_RA(d) | \
138 __PPC_RS(a) | __PPC_RB(s)) 138 ___PPC_RS(a) | ___PPC_RB(s))
139#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | __PPC_RA(d) | \ 139#define PPC_SRW(d, a, s) EMIT(PPC_INST_SRW | ___PPC_RA(d) | \
140 __PPC_RS(a) | __PPC_RB(s)) 140 ___PPC_RS(a) | ___PPC_RB(s))
141/* slwi = rlwinm Rx, Ry, n, 0, 31-n */ 141/* slwi = rlwinm Rx, Ry, n, 0, 31-n */
142#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | __PPC_RA(d) | \ 142#define PPC_SLWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \
143 __PPC_RS(a) | __PPC_SH(i) | \ 143 ___PPC_RS(a) | __PPC_SH(i) | \
144 __PPC_MB(0) | __PPC_ME(31-(i))) 144 __PPC_MB(0) | __PPC_ME(31-(i)))
145/* srwi = rlwinm Rx, Ry, 32-n, n, 31 */ 145/* srwi = rlwinm Rx, Ry, 32-n, n, 31 */
146#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | __PPC_RA(d) | \ 146#define PPC_SRWI(d, a, i) EMIT(PPC_INST_RLWINM | ___PPC_RA(d) | \
147 __PPC_RS(a) | __PPC_SH(32-(i)) | \ 147 ___PPC_RS(a) | __PPC_SH(32-(i)) | \
148 __PPC_MB(i) | __PPC_ME(31)) 148 __PPC_MB(i) | __PPC_ME(31))
149/* sldi = rldicr Rx, Ry, n, 63-n */ 149/* sldi = rldicr Rx, Ry, n, 63-n */
150#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | __PPC_RA(d) | \ 150#define PPC_SLDI(d, a, i) EMIT(PPC_INST_RLDICR | ___PPC_RA(d) | \
151 __PPC_RS(a) | __PPC_SH(i) | \ 151 ___PPC_RS(a) | __PPC_SH(i) | \
152 __PPC_MB(63-(i)) | (((i) & 0x20) >> 4)) 152 __PPC_MB(63-(i)) | (((i) & 0x20) >> 4))
153#define PPC_NEG(d, a) EMIT(PPC_INST_NEG | __PPC_RT(d) | __PPC_RA(a)) 153#define PPC_NEG(d, a) EMIT(PPC_INST_NEG | ___PPC_RT(d) | ___PPC_RA(a))
154 154
155/* Long jump; (unconditional 'branch') */ 155/* Long jump; (unconditional 'branch') */
156#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \ 156#define PPC_JMP(dest) EMIT(PPC_INST_BRANCH | \