aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm
diff options
context:
space:
mode:
authorSteven J. Hill <sjhill@mips.com>2013-02-05 17:52:01 -0500
committerSteven J. Hill <Steven.Hill@imgtec.com>2013-05-01 17:32:45 -0400
commitabc597fe623cfd7d3b18d5235c54f3d567d2c3d3 (patch)
tree05ef12f30fc686793522a5fcb7b4ff4a14390088 /arch/mips/include/asm
parent2aa9fd06e221da4e69693dc1b5c6c6bc84c76f32 (diff)
MIPS: microMIPS: uasm: Split 'uasm.c' into two files.
Split 'uasm.c' into two files. The new file 'uasm-mips.c' has the functions specific to the classic MIPS ISA. The 'uasm.c' file contains common code that can be used by classic or other ISAs that could be supported by the kernel. Signed-off-by: Steven J. Hill <sjhill@mips.com> Cc: linux-mips@linux-mips.org Cc: cernekee@gmail.com Cc: kevink@paralogos.com Cc: ddaney.cavm@gmail.com Patchwork: https://patchwork.linux-mips.org/patch/4922/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> (cherry picked from commit 0961103562ab958fa74f35043bf4f72e51ed6155)
Diffstat (limited to 'arch/mips/include/asm')
-rw-r--r--arch/mips/include/asm/uasm.h62
1 files changed, 38 insertions, 24 deletions
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 058e941626a6..f7d8f1509c4d 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -6,7 +6,7 @@
6 * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer 6 * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer
7 * Copyright (C) 2005 Maciej W. Rozycki 7 * Copyright (C) 2005 Maciej W. Rozycki
8 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org) 8 * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
9 * Copyright (C) 2012 MIPS Technologies, Inc. 9 * Copyright (C) 2012, 2013 MIPS Technologies, Inc. All rights reserved.
10 */ 10 */
11 11
12#include <linux/types.h> 12#include <linux/types.h>
@@ -22,44 +22,57 @@
22#define UASM_EXPORT_SYMBOL(sym) 22#define UASM_EXPORT_SYMBOL(sym)
23#endif 23#endif
24 24
25#define _UASM_ISA_CLASSIC 0
26
27#ifndef UASM_ISA
28#define UASM_ISA _UASM_ISA_CLASSIC
29#endif
30
31#if (UASM_ISA == _UASM_ISA_CLASSIC)
32#define ISAOPC(op) uasm_i##op
33#define ISAFUNC(x) x
34#else
35#error Unsupported micro-assembler ISA!!!
36#endif
37
25#define Ip_u1u2u3(op) \ 38#define Ip_u1u2u3(op) \
26void __uasminit \ 39void __uasminit \
27uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 40ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
28 41
29#define Ip_u2u1u3(op) \ 42#define Ip_u2u1u3(op) \
30void __uasminit \ 43void __uasminit \
31uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 44ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
32 45
33#define Ip_u3u1u2(op) \ 46#define Ip_u3u1u2(op) \
34void __uasminit \ 47void __uasminit \
35uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 48ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
36 49
37#define Ip_u1u2s3(op) \ 50#define Ip_u1u2s3(op) \
38void __uasminit \ 51void __uasminit \
39uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 52ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
40 53
41#define Ip_u2s3u1(op) \ 54#define Ip_u2s3u1(op) \
42void __uasminit \ 55void __uasminit \
43uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) 56ISAOPC(op)(u32 **buf, unsigned int a, signed int b, unsigned int c)
44 57
45#define Ip_u2u1s3(op) \ 58#define Ip_u2u1s3(op) \
46void __uasminit \ 59void __uasminit \
47uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 60ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, signed int c)
48 61
49#define Ip_u2u1msbu3(op) \ 62#define Ip_u2u1msbu3(op) \
50void __uasminit \ 63void __uasminit \
51uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ 64ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
52 unsigned int d) 65 unsigned int d)
53 66
54#define Ip_u1u2(op) \ 67#define Ip_u1u2(op) \
55void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) 68void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, unsigned int b)
56 69
57#define Ip_u1s2(op) \ 70#define Ip_u1s2(op) \
58void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b) 71void __uasminit ISAOPC(op)(u32 **buf, unsigned int a, signed int b)
59 72
60#define Ip_u1(op) void __uasminit uasm_i##op(u32 **buf, unsigned int a) 73#define Ip_u1(op) void __uasminit ISAOPC(op)(u32 **buf, unsigned int a)
61 74
62#define Ip_0(op) void __uasminit uasm_i##op(u32 **buf) 75#define Ip_0(op) void __uasminit ISAOPC(op)(u32 **buf)
63 76
64Ip_u2u1s3(_addiu); 77Ip_u2u1s3(_addiu);
65Ip_u3u1u2(_addu); 78Ip_u3u1u2(_addu);
@@ -132,14 +145,15 @@ struct uasm_label {
132 int lab; 145 int lab;
133}; 146};
134 147
135void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); 148void __uasminit ISAFUNC(uasm_build_label)(struct uasm_label **lab, u32 *addr,
149 int lid);
136#ifdef CONFIG_64BIT 150#ifdef CONFIG_64BIT
137int uasm_in_compat_space_p(long addr); 151int ISAFUNC(uasm_in_compat_space_p)(long addr);
138#endif 152#endif
139int uasm_rel_hi(long val); 153int ISAFUNC(uasm_rel_hi)(long val);
140int uasm_rel_lo(long val); 154int ISAFUNC(uasm_rel_lo)(long val);
141void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr); 155void ISAFUNC(UASM_i_LA_mostly)(u32 **buf, unsigned int rs, long addr);
142void UASM_i_LA(u32 **buf, unsigned int rs, long addr); 156void ISAFUNC(UASM_i_LA)(u32 **buf, unsigned int rs, long addr);
143 157
144#define UASM_L_LA(lb) \ 158#define UASM_L_LA(lb) \
145static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ 159static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
@@ -196,27 +210,27 @@ static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
196 unsigned int a2, unsigned int a3) 210 unsigned int a2, unsigned int a3)
197{ 211{
198 if (a3 < 32) 212 if (a3 < 32)
199 uasm_i_drotr(p, a1, a2, a3); 213 ISAOPC(_drotr)(p, a1, a2, a3);
200 else 214 else
201 uasm_i_drotr32(p, a1, a2, a3 - 32); 215 ISAOPC(_drotr32)(p, a1, a2, a3 - 32);
202} 216}
203 217
204static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, 218static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
205 unsigned int a2, unsigned int a3) 219 unsigned int a2, unsigned int a3)
206{ 220{
207 if (a3 < 32) 221 if (a3 < 32)
208 uasm_i_dsll(p, a1, a2, a3); 222 ISAOPC(_dsll)(p, a1, a2, a3);
209 else 223 else
210 uasm_i_dsll32(p, a1, a2, a3 - 32); 224 ISAOPC(_dsll32)(p, a1, a2, a3 - 32);
211} 225}
212 226
213static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1, 227static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
214 unsigned int a2, unsigned int a3) 228 unsigned int a2, unsigned int a3)
215{ 229{
216 if (a3 < 32) 230 if (a3 < 32)
217 uasm_i_dsrl(p, a1, a2, a3); 231 ISAOPC(_dsrl)(p, a1, a2, a3);
218 else 232 else
219 uasm_i_dsrl32(p, a1, a2, a3 - 32); 233 ISAOPC(_dsrl32)(p, a1, a2, a3 - 32);
220} 234}
221 235
222/* Handle relocations. */ 236/* Handle relocations. */