uasm.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * A small micro-assembler. It is intentionally kept simple, does only
  7. * support a subset of instructions, and does not try to hide pipeline
  8. * effects like branch delay slots.
  9. *
  10. * Copyright (C) 2004, 2005, 2006, 2008 Thiemo Seufer
  11. * Copyright (C) 2005, 2007 Maciej W. Rozycki
  12. * Copyright (C) 2006 Ralf Baechle (ralf@linux-mips.org)
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/types.h>
  16. #include <linux/init.h>
  17. #include <asm/inst.h>
  18. #include <asm/elf.h>
  19. #include <asm/bugs.h>
  20. #include "uasm.h"
  21. enum fields {
  22. RS = 0x001,
  23. RT = 0x002,
  24. RD = 0x004,
  25. RE = 0x008,
  26. SIMM = 0x010,
  27. UIMM = 0x020,
  28. BIMM = 0x040,
  29. JIMM = 0x080,
  30. FUNC = 0x100,
  31. SET = 0x200
  32. };
  33. #define OP_MASK 0x3f
  34. #define OP_SH 26
  35. #define RS_MASK 0x1f
  36. #define RS_SH 21
  37. #define RT_MASK 0x1f
  38. #define RT_SH 16
  39. #define RD_MASK 0x1f
  40. #define RD_SH 11
  41. #define RE_MASK 0x1f
  42. #define RE_SH 6
  43. #define IMM_MASK 0xffff
  44. #define IMM_SH 0
  45. #define JIMM_MASK 0x3ffffff
  46. #define JIMM_SH 0
  47. #define FUNC_MASK 0x3f
  48. #define FUNC_SH 0
  49. #define SET_MASK 0x7
  50. #define SET_SH 0
  51. enum opcode {
  52. insn_invalid,
  53. insn_addu, insn_addiu, insn_and, insn_andi, insn_beq,
  54. insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl,
  55. insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0,
  56. insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl,
  57. insn_dsrl32, insn_dsubu, insn_eret, insn_j, insn_jal, insn_jr,
  58. insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0,
  59. insn_mtc0, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd,
  60. insn_sd, insn_sll, insn_sra, insn_srl, insn_subu, insn_sw,
  61. insn_tlbp, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori
  62. };
  63. struct insn {
  64. enum opcode opcode;
  65. u32 match;
  66. enum fields fields;
  67. };
  68. /* This macro sets the non-variable bits of an instruction. */
  69. #define M(a, b, c, d, e, f) \
  70. ((a) << OP_SH \
  71. | (b) << RS_SH \
  72. | (c) << RT_SH \
  73. | (d) << RD_SH \
  74. | (e) << RE_SH \
  75. | (f) << FUNC_SH)
  76. static struct insn insn_table[] __cpuinitdata = {
  77. { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  78. { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
  79. { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD },
  80. { insn_andi, M(andi_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
  81. { insn_beq, M(beq_op, 0, 0, 0, 0, 0), RS | RT | BIMM },
  82. { insn_beql, M(beql_op, 0, 0, 0, 0, 0), RS | RT | BIMM },
  83. { insn_bgez, M(bcond_op, 0, bgez_op, 0, 0, 0), RS | BIMM },
  84. { insn_bgezl, M(bcond_op, 0, bgezl_op, 0, 0, 0), RS | BIMM },
  85. { insn_bltz, M(bcond_op, 0, bltz_op, 0, 0, 0), RS | BIMM },
  86. { insn_bltzl, M(bcond_op, 0, bltzl_op, 0, 0, 0), RS | BIMM },
  87. { insn_bne, M(bne_op, 0, 0, 0, 0, 0), RS | RT | BIMM },
  88. { insn_cache, M(cache_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  89. { insn_daddiu, M(daddiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  90. { insn_daddu, M(spec_op, 0, 0, 0, 0, daddu_op), RS | RT | RD },
  91. { insn_dmfc0, M(cop0_op, dmfc_op, 0, 0, 0, 0), RT | RD | SET},
  92. { insn_dmtc0, M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET},
  93. { insn_dsll, M(spec_op, 0, 0, 0, 0, dsll_op), RT | RD | RE },
  94. { insn_dsll32, M(spec_op, 0, 0, 0, 0, dsll32_op), RT | RD | RE },
  95. { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE },
  96. { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE },
  97. { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE },
  98. { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD },
  99. { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 },
  100. { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM },
  101. { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM },
  102. { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS },
  103. { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  104. { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  105. { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  106. { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM },
  107. { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  108. { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET},
  109. { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET},
  110. { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
  111. { insn_pref, M(pref_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  112. { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 },
  113. { insn_sc, M(sc_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  114. { insn_scd, M(scd_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  115. { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  116. { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE },
  117. { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE },
  118. { insn_srl, M(spec_op, 0, 0, 0, 0, srl_op), RT | RD | RE },
  119. { insn_subu, M(spec_op, 0, 0, 0, 0, subu_op), RS | RT | RD },
  120. { insn_sw, M(sw_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  121. { insn_tlbp, M(cop0_op, cop_op, 0, 0, 0, tlbp_op), 0 },
  122. { insn_tlbwi, M(cop0_op, cop_op, 0, 0, 0, tlbwi_op), 0 },
  123. { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 },
  124. { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD },
  125. { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
  126. { insn_invalid, 0, 0 }
  127. };
  128. #undef M
  129. static inline __cpuinit u32 build_rs(u32 arg)
  130. {
  131. if (arg & ~RS_MASK)
  132. printk(KERN_WARNING "Micro-assembler field overflow\n");
  133. return (arg & RS_MASK) << RS_SH;
  134. }
  135. static inline __cpuinit u32 build_rt(u32 arg)
  136. {
  137. if (arg & ~RT_MASK)
  138. printk(KERN_WARNING "Micro-assembler field overflow\n");
  139. return (arg & RT_MASK) << RT_SH;
  140. }
  141. static inline __cpuinit u32 build_rd(u32 arg)
  142. {
  143. if (arg & ~RD_MASK)
  144. printk(KERN_WARNING "Micro-assembler field overflow\n");
  145. return (arg & RD_MASK) << RD_SH;
  146. }
  147. static inline __cpuinit u32 build_re(u32 arg)
  148. {
  149. if (arg & ~RE_MASK)
  150. printk(KERN_WARNING "Micro-assembler field overflow\n");
  151. return (arg & RE_MASK) << RE_SH;
  152. }
  153. static inline __cpuinit u32 build_simm(s32 arg)
  154. {
  155. if (arg > 0x7fff || arg < -0x8000)
  156. printk(KERN_WARNING "Micro-assembler field overflow\n");
  157. return arg & 0xffff;
  158. }
  159. static inline __cpuinit u32 build_uimm(u32 arg)
  160. {
  161. if (arg & ~IMM_MASK)
  162. printk(KERN_WARNING "Micro-assembler field overflow\n");
  163. return arg & IMM_MASK;
  164. }
  165. static inline __cpuinit u32 build_bimm(s32 arg)
  166. {
  167. if (arg > 0x1ffff || arg < -0x20000)
  168. printk(KERN_WARNING "Micro-assembler field overflow\n");
  169. if (arg & 0x3)
  170. printk(KERN_WARNING "Invalid micro-assembler branch target\n");
  171. return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
  172. }
  173. static inline __cpuinit u32 build_jimm(u32 arg)
  174. {
  175. if (arg & ~((JIMM_MASK) << 2))
  176. printk(KERN_WARNING "Micro-assembler field overflow\n");
  177. return (arg >> 2) & JIMM_MASK;
  178. }
  179. static inline __cpuinit u32 build_func(u32 arg)
  180. {
  181. if (arg & ~FUNC_MASK)
  182. printk(KERN_WARNING "Micro-assembler field overflow\n");
  183. return arg & FUNC_MASK;
  184. }
  185. static inline __cpuinit u32 build_set(u32 arg)
  186. {
  187. if (arg & ~SET_MASK)
  188. printk(KERN_WARNING "Micro-assembler field overflow\n");
  189. return arg & SET_MASK;
  190. }
  191. /*
  192. * The order of opcode arguments is implicitly left to right,
  193. * starting with RS and ending with FUNC or IMM.
  194. */
  195. static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...)
  196. {
  197. struct insn *ip = NULL;
  198. unsigned int i;
  199. va_list ap;
  200. u32 op;
  201. for (i = 0; insn_table[i].opcode != insn_invalid; i++)
  202. if (insn_table[i].opcode == opc) {
  203. ip = &insn_table[i];
  204. break;
  205. }
  206. if (!ip || (opc == insn_daddiu && r4k_daddiu_bug()))
  207. panic("Unsupported Micro-assembler instruction %d", opc);
  208. op = ip->match;
  209. va_start(ap, opc);
  210. if (ip->fields & RS)
  211. op |= build_rs(va_arg(ap, u32));
  212. if (ip->fields & RT)
  213. op |= build_rt(va_arg(ap, u32));
  214. if (ip->fields & RD)
  215. op |= build_rd(va_arg(ap, u32));
  216. if (ip->fields & RE)
  217. op |= build_re(va_arg(ap, u32));
  218. if (ip->fields & SIMM)
  219. op |= build_simm(va_arg(ap, s32));
  220. if (ip->fields & UIMM)
  221. op |= build_uimm(va_arg(ap, u32));
  222. if (ip->fields & BIMM)
  223. op |= build_bimm(va_arg(ap, s32));
  224. if (ip->fields & JIMM)
  225. op |= build_jimm(va_arg(ap, u32));
  226. if (ip->fields & FUNC)
  227. op |= build_func(va_arg(ap, u32));
  228. if (ip->fields & SET)
  229. op |= build_set(va_arg(ap, u32));
  230. va_end(ap);
  231. **buf = op;
  232. (*buf)++;
  233. }
  234. #define I_u1u2u3(op) \
  235. Ip_u1u2u3(op) \
  236. { \
  237. build_insn(buf, insn##op, a, b, c); \
  238. }
  239. #define I_u2u1u3(op) \
  240. Ip_u2u1u3(op) \
  241. { \
  242. build_insn(buf, insn##op, b, a, c); \
  243. }
  244. #define I_u3u1u2(op) \
  245. Ip_u3u1u2(op) \
  246. { \
  247. build_insn(buf, insn##op, b, c, a); \
  248. }
  249. #define I_u1u2s3(op) \
  250. Ip_u1u2s3(op) \
  251. { \
  252. build_insn(buf, insn##op, a, b, c); \
  253. }
  254. #define I_u2s3u1(op) \
  255. Ip_u2s3u1(op) \
  256. { \
  257. build_insn(buf, insn##op, c, a, b); \
  258. }
  259. #define I_u2u1s3(op) \
  260. Ip_u2u1s3(op) \
  261. { \
  262. build_insn(buf, insn##op, b, a, c); \
  263. }
  264. #define I_u1u2(op) \
  265. Ip_u1u2(op) \
  266. { \
  267. build_insn(buf, insn##op, a, b); \
  268. }
  269. #define I_u1s2(op) \
  270. Ip_u1s2(op) \
  271. { \
  272. build_insn(buf, insn##op, a, b); \
  273. }
  274. #define I_u1(op) \
  275. Ip_u1(op) \
  276. { \
  277. build_insn(buf, insn##op, a); \
  278. }
  279. #define I_0(op) \
  280. Ip_0(op) \
  281. { \
  282. build_insn(buf, insn##op); \
  283. }
  284. I_u2u1s3(_addiu)
  285. I_u3u1u2(_addu)
  286. I_u2u1u3(_andi)
  287. I_u3u1u2(_and)
  288. I_u1u2s3(_beq)
  289. I_u1u2s3(_beql)
  290. I_u1s2(_bgez)
  291. I_u1s2(_bgezl)
  292. I_u1s2(_bltz)
  293. I_u1s2(_bltzl)
  294. I_u1u2s3(_bne)
  295. I_u2s3u1(_cache)
  296. I_u1u2u3(_dmfc0)
  297. I_u1u2u3(_dmtc0)
  298. I_u2u1s3(_daddiu)
  299. I_u3u1u2(_daddu)
  300. I_u2u1u3(_dsll)
  301. I_u2u1u3(_dsll32)
  302. I_u2u1u3(_dsra)
  303. I_u2u1u3(_dsrl)
  304. I_u2u1u3(_dsrl32)
  305. I_u3u1u2(_dsubu)
  306. I_0(_eret)
  307. I_u1(_j)
  308. I_u1(_jal)
  309. I_u1(_jr)
  310. I_u2s3u1(_ld)
  311. I_u2s3u1(_ll)
  312. I_u2s3u1(_lld)
  313. I_u1s2(_lui)
  314. I_u2s3u1(_lw)
  315. I_u1u2u3(_mfc0)
  316. I_u1u2u3(_mtc0)
  317. I_u2u1u3(_ori)
  318. I_u2s3u1(_pref)
  319. I_0(_rfe)
  320. I_u2s3u1(_sc)
  321. I_u2s3u1(_scd)
  322. I_u2s3u1(_sd)
  323. I_u2u1u3(_sll)
  324. I_u2u1u3(_sra)
  325. I_u2u1u3(_srl)
  326. I_u3u1u2(_subu)
  327. I_u2s3u1(_sw)
  328. I_0(_tlbp)
  329. I_0(_tlbwi)
  330. I_0(_tlbwr)
  331. I_u3u1u2(_xor)
  332. I_u2u1u3(_xori)
  333. /* Handle labels. */
  334. void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
  335. {
  336. (*lab)->addr = addr;
  337. (*lab)->lab = lid;
  338. (*lab)++;
  339. }
  340. int __cpuinit uasm_in_compat_space_p(long addr)
  341. {
  342. /* Is this address in 32bit compat space? */
  343. #ifdef CONFIG_64BIT
  344. return (((addr) & 0xffffffff00000000L) == 0xffffffff00000000L);
  345. #else
  346. return 1;
  347. #endif
  348. }
  349. static int __cpuinit uasm_rel_highest(long val)
  350. {
  351. #ifdef CONFIG_64BIT
  352. return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
  353. #else
  354. return 0;
  355. #endif
  356. }
  357. static int __cpuinit uasm_rel_higher(long val)
  358. {
  359. #ifdef CONFIG_64BIT
  360. return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
  361. #else
  362. return 0;
  363. #endif
  364. }
  365. int __cpuinit uasm_rel_hi(long val)
  366. {
  367. return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
  368. }
  369. int __cpuinit uasm_rel_lo(long val)
  370. {
  371. return ((val & 0xffff) ^ 0x8000) - 0x8000;
  372. }
  373. void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr)
  374. {
  375. if (!uasm_in_compat_space_p(addr)) {
  376. uasm_i_lui(buf, rs, uasm_rel_highest(addr));
  377. if (uasm_rel_higher(addr))
  378. uasm_i_daddiu(buf, rs, rs, uasm_rel_higher(addr));
  379. if (uasm_rel_hi(addr)) {
  380. uasm_i_dsll(buf, rs, rs, 16);
  381. uasm_i_daddiu(buf, rs, rs, uasm_rel_hi(addr));
  382. uasm_i_dsll(buf, rs, rs, 16);
  383. } else
  384. uasm_i_dsll32(buf, rs, rs, 0);
  385. } else
  386. uasm_i_lui(buf, rs, uasm_rel_hi(addr));
  387. }
  388. void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr)
  389. {
  390. UASM_i_LA_mostly(buf, rs, addr);
  391. if (uasm_rel_lo(addr)) {
  392. if (!uasm_in_compat_space_p(addr))
  393. uasm_i_daddiu(buf, rs, rs, uasm_rel_lo(addr));
  394. else
  395. uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr));
  396. }
  397. }
  398. /* Handle relocations. */
  399. void __cpuinit
  400. uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid)
  401. {
  402. (*rel)->addr = addr;
  403. (*rel)->type = R_MIPS_PC16;
  404. (*rel)->lab = lid;
  405. (*rel)++;
  406. }
  407. static inline void __cpuinit
  408. __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
  409. {
  410. long laddr = (long)lab->addr;
  411. long raddr = (long)rel->addr;
  412. switch (rel->type) {
  413. case R_MIPS_PC16:
  414. *rel->addr |= build_bimm(laddr - (raddr + 4));
  415. break;
  416. default:
  417. panic("Unsupported Micro-assembler relocation %d",
  418. rel->type);
  419. }
  420. }
  421. void __cpuinit
  422. uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
  423. {
  424. struct uasm_label *l;
  425. for (; rel->lab != UASM_LABEL_INVALID; rel++)
  426. for (l = lab; l->lab != UASM_LABEL_INVALID; l++)
  427. if (rel->lab == l->lab)
  428. __resolve_relocs(rel, l);
  429. }
  430. void __cpuinit
  431. uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off)
  432. {
  433. for (; rel->lab != UASM_LABEL_INVALID; rel++)
  434. if (rel->addr >= first && rel->addr < end)
  435. rel->addr += off;
  436. }
  437. void __cpuinit
  438. uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off)
  439. {
  440. for (; lab->lab != UASM_LABEL_INVALID; lab++)
  441. if (lab->addr >= first && lab->addr < end)
  442. lab->addr += off;
  443. }
  444. void __cpuinit
  445. uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first,
  446. u32 *end, u32 *target)
  447. {
  448. long off = (long)(target - first);
  449. memcpy(target, first, (end - first) * sizeof(u32));
  450. uasm_move_relocs(rel, first, end, off);
  451. uasm_move_labels(lab, first, end, off);
  452. }
  453. int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr)
  454. {
  455. for (; rel->lab != UASM_LABEL_INVALID; rel++) {
  456. if (rel->addr == addr
  457. && (rel->type == R_MIPS_PC16
  458. || rel->type == R_MIPS_26))
  459. return 1;
  460. }
  461. return 0;
  462. }
  463. /* Convenience functions for labeled branches. */
  464. void __cpuinit
  465. uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  466. {
  467. uasm_r_mips_pc16(r, *p, lid);
  468. uasm_i_bltz(p, reg, 0);
  469. }
  470. void __cpuinit
  471. uasm_il_b(u32 **p, struct uasm_reloc **r, int lid)
  472. {
  473. uasm_r_mips_pc16(r, *p, lid);
  474. uasm_i_b(p, 0);
  475. }
  476. void __cpuinit
  477. uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  478. {
  479. uasm_r_mips_pc16(r, *p, lid);
  480. uasm_i_beqz(p, reg, 0);
  481. }
  482. void __cpuinit
  483. uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  484. {
  485. uasm_r_mips_pc16(r, *p, lid);
  486. uasm_i_beqzl(p, reg, 0);
  487. }
  488. void __cpuinit
  489. uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
  490. unsigned int reg2, int lid)
  491. {
  492. uasm_r_mips_pc16(r, *p, lid);
  493. uasm_i_bne(p, reg1, reg2, 0);
  494. }
  495. void __cpuinit
  496. uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  497. {
  498. uasm_r_mips_pc16(r, *p, lid);
  499. uasm_i_bnez(p, reg, 0);
  500. }
  501. void __cpuinit
  502. uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  503. {
  504. uasm_r_mips_pc16(r, *p, lid);
  505. uasm_i_bgezl(p, reg, 0);
  506. }
  507. void __cpuinit
  508. uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  509. {
  510. uasm_r_mips_pc16(r, *p, lid);
  511. uasm_i_bgez(p, reg, 0);
  512. }