uasm.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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_daddu, insn_daddiu, insn_dmfc0, insn_dmtc0,
  56. insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, insn_dsrl32,
  57. insn_dsubu, insn_eret, insn_j, insn_jal, insn_jr, insn_ld,
  58. insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0, insn_mtc0,
  59. insn_ori, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll,
  60. insn_sra, insn_srl, insn_subu, insn_sw, insn_tlbp, insn_tlbwi,
  61. 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_daddiu, M(daddiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  89. { insn_daddu, M(spec_op, 0, 0, 0, 0, daddu_op), RS | RT | RD },
  90. { insn_dmfc0, M(cop0_op, dmfc_op, 0, 0, 0, 0), RT | RD | SET},
  91. { insn_dmtc0, M(cop0_op, dmtc_op, 0, 0, 0, 0), RT | RD | SET},
  92. { insn_dsll, M(spec_op, 0, 0, 0, 0, dsll_op), RT | RD | RE },
  93. { insn_dsll32, M(spec_op, 0, 0, 0, 0, dsll32_op), RT | RD | RE },
  94. { insn_dsra, M(spec_op, 0, 0, 0, 0, dsra_op), RT | RD | RE },
  95. { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE },
  96. { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE },
  97. { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD },
  98. { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 },
  99. { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM },
  100. { insn_jal, M(jal_op, 0, 0, 0, 0, 0), JIMM },
  101. { insn_jr, M(spec_op, 0, 0, 0, 0, jr_op), RS },
  102. { insn_ld, M(ld_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  103. { insn_ll, M(ll_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  104. { insn_lld, M(lld_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  105. { insn_lui, M(lui_op, 0, 0, 0, 0, 0), RT | SIMM },
  106. { insn_lw, M(lw_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  107. { insn_mfc0, M(cop0_op, mfc_op, 0, 0, 0, 0), RT | RD | SET},
  108. { insn_mtc0, M(cop0_op, mtc_op, 0, 0, 0, 0), RT | RD | SET},
  109. { insn_ori, M(ori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
  110. { insn_rfe, M(cop0_op, cop_op, 0, 0, 0, rfe_op), 0 },
  111. { insn_sc, M(sc_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  112. { insn_scd, M(scd_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  113. { insn_sd, M(sd_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  114. { insn_sll, M(spec_op, 0, 0, 0, 0, sll_op), RT | RD | RE },
  115. { insn_sra, M(spec_op, 0, 0, 0, 0, sra_op), RT | RD | RE },
  116. { insn_srl, M(spec_op, 0, 0, 0, 0, srl_op), RT | RD | RE },
  117. { insn_subu, M(spec_op, 0, 0, 0, 0, subu_op), RS | RT | RD },
  118. { insn_sw, M(sw_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
  119. { insn_tlbp, M(cop0_op, cop_op, 0, 0, 0, tlbp_op), 0 },
  120. { insn_tlbwi, M(cop0_op, cop_op, 0, 0, 0, tlbwi_op), 0 },
  121. { insn_tlbwr, M(cop0_op, cop_op, 0, 0, 0, tlbwr_op), 0 },
  122. { insn_xor, M(spec_op, 0, 0, 0, 0, xor_op), RS | RT | RD },
  123. { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
  124. { insn_invalid, 0, 0 }
  125. };
  126. #undef M
  127. static inline __cpuinit u32 build_rs(u32 arg)
  128. {
  129. if (arg & ~RS_MASK)
  130. printk(KERN_WARNING "Micro-assembler field overflow\n");
  131. return (arg & RS_MASK) << RS_SH;
  132. }
  133. static inline __cpuinit u32 build_rt(u32 arg)
  134. {
  135. if (arg & ~RT_MASK)
  136. printk(KERN_WARNING "Micro-assembler field overflow\n");
  137. return (arg & RT_MASK) << RT_SH;
  138. }
  139. static inline __cpuinit u32 build_rd(u32 arg)
  140. {
  141. if (arg & ~RD_MASK)
  142. printk(KERN_WARNING "Micro-assembler field overflow\n");
  143. return (arg & RD_MASK) << RD_SH;
  144. }
  145. static inline __cpuinit u32 build_re(u32 arg)
  146. {
  147. if (arg & ~RE_MASK)
  148. printk(KERN_WARNING "Micro-assembler field overflow\n");
  149. return (arg & RE_MASK) << RE_SH;
  150. }
  151. static inline __cpuinit u32 build_simm(s32 arg)
  152. {
  153. if (arg > 0x7fff || arg < -0x8000)
  154. printk(KERN_WARNING "Micro-assembler field overflow\n");
  155. return arg & 0xffff;
  156. }
  157. static inline __cpuinit u32 build_uimm(u32 arg)
  158. {
  159. if (arg & ~IMM_MASK)
  160. printk(KERN_WARNING "Micro-assembler field overflow\n");
  161. return arg & IMM_MASK;
  162. }
  163. static inline __cpuinit u32 build_bimm(s32 arg)
  164. {
  165. if (arg > 0x1ffff || arg < -0x20000)
  166. printk(KERN_WARNING "Micro-assembler field overflow\n");
  167. if (arg & 0x3)
  168. printk(KERN_WARNING "Invalid micro-assembler branch target\n");
  169. return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
  170. }
  171. static inline __cpuinit u32 build_jimm(u32 arg)
  172. {
  173. if (arg & ~((JIMM_MASK) << 2))
  174. printk(KERN_WARNING "Micro-assembler field overflow\n");
  175. return (arg >> 2) & JIMM_MASK;
  176. }
  177. static inline __cpuinit u32 build_func(u32 arg)
  178. {
  179. if (arg & ~FUNC_MASK)
  180. printk(KERN_WARNING "Micro-assembler field overflow\n");
  181. return arg & FUNC_MASK;
  182. }
  183. static inline __cpuinit u32 build_set(u32 arg)
  184. {
  185. if (arg & ~SET_MASK)
  186. printk(KERN_WARNING "Micro-assembler field overflow\n");
  187. return arg & SET_MASK;
  188. }
  189. /*
  190. * The order of opcode arguments is implicitly left to right,
  191. * starting with RS and ending with FUNC or IMM.
  192. */
  193. static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...)
  194. {
  195. struct insn *ip = NULL;
  196. unsigned int i;
  197. va_list ap;
  198. u32 op;
  199. for (i = 0; insn_table[i].opcode != insn_invalid; i++)
  200. if (insn_table[i].opcode == opc) {
  201. ip = &insn_table[i];
  202. break;
  203. }
  204. if (!ip || (opc == insn_daddiu && r4k_daddiu_bug()))
  205. panic("Unsupported Micro-assembler instruction %d", opc);
  206. op = ip->match;
  207. va_start(ap, opc);
  208. if (ip->fields & RS)
  209. op |= build_rs(va_arg(ap, u32));
  210. if (ip->fields & RT)
  211. op |= build_rt(va_arg(ap, u32));
  212. if (ip->fields & RD)
  213. op |= build_rd(va_arg(ap, u32));
  214. if (ip->fields & RE)
  215. op |= build_re(va_arg(ap, u32));
  216. if (ip->fields & SIMM)
  217. op |= build_simm(va_arg(ap, s32));
  218. if (ip->fields & UIMM)
  219. op |= build_uimm(va_arg(ap, u32));
  220. if (ip->fields & BIMM)
  221. op |= build_bimm(va_arg(ap, s32));
  222. if (ip->fields & JIMM)
  223. op |= build_jimm(va_arg(ap, u32));
  224. if (ip->fields & FUNC)
  225. op |= build_func(va_arg(ap, u32));
  226. if (ip->fields & SET)
  227. op |= build_set(va_arg(ap, u32));
  228. va_end(ap);
  229. **buf = op;
  230. (*buf)++;
  231. }
  232. #define I_u1u2u3(op) \
  233. Ip_u1u2u3(op) \
  234. { \
  235. build_insn(buf, insn##op, a, b, c); \
  236. }
  237. #define I_u2u1u3(op) \
  238. Ip_u2u1u3(op) \
  239. { \
  240. build_insn(buf, insn##op, b, a, c); \
  241. }
  242. #define I_u3u1u2(op) \
  243. Ip_u3u1u2(op) \
  244. { \
  245. build_insn(buf, insn##op, b, c, a); \
  246. }
  247. #define I_u1u2s3(op) \
  248. Ip_u1u2s3(op) \
  249. { \
  250. build_insn(buf, insn##op, a, b, c); \
  251. }
  252. #define I_u2s3u1(op) \
  253. Ip_u2s3u1(op) \
  254. { \
  255. build_insn(buf, insn##op, c, a, b); \
  256. }
  257. #define I_u2u1s3(op) \
  258. Ip_u2u1s3(op) \
  259. { \
  260. build_insn(buf, insn##op, b, a, c); \
  261. }
  262. #define I_u1u2(op) \
  263. Ip_u1u2(op) \
  264. { \
  265. build_insn(buf, insn##op, a, b); \
  266. }
  267. #define I_u1s2(op) \
  268. Ip_u1s2(op) \
  269. { \
  270. build_insn(buf, insn##op, a, b); \
  271. }
  272. #define I_u1(op) \
  273. Ip_u1(op) \
  274. { \
  275. build_insn(buf, insn##op, a); \
  276. }
  277. #define I_0(op) \
  278. Ip_0(op) \
  279. { \
  280. build_insn(buf, insn##op); \
  281. }
  282. I_u2u1s3(_addiu)
  283. I_u3u1u2(_addu)
  284. I_u2u1u3(_andi)
  285. I_u3u1u2(_and)
  286. I_u1u2s3(_beq)
  287. I_u1u2s3(_beql)
  288. I_u1s2(_bgez)
  289. I_u1s2(_bgezl)
  290. I_u1s2(_bltz)
  291. I_u1s2(_bltzl)
  292. I_u1u2s3(_bne)
  293. I_u1u2u3(_dmfc0)
  294. I_u1u2u3(_dmtc0)
  295. I_u2u1s3(_daddiu)
  296. I_u3u1u2(_daddu)
  297. I_u2u1u3(_dsll)
  298. I_u2u1u3(_dsll32)
  299. I_u2u1u3(_dsra)
  300. I_u2u1u3(_dsrl)
  301. I_u2u1u3(_dsrl32)
  302. I_u3u1u2(_dsubu)
  303. I_0(_eret)
  304. I_u1(_j)
  305. I_u1(_jal)
  306. I_u1(_jr)
  307. I_u2s3u1(_ld)
  308. I_u2s3u1(_ll)
  309. I_u2s3u1(_lld)
  310. I_u1s2(_lui)
  311. I_u2s3u1(_lw)
  312. I_u1u2u3(_mfc0)
  313. I_u1u2u3(_mtc0)
  314. I_u2u1u3(_ori)
  315. I_0(_rfe)
  316. I_u2s3u1(_sc)
  317. I_u2s3u1(_scd)
  318. I_u2s3u1(_sd)
  319. I_u2u1u3(_sll)
  320. I_u2u1u3(_sra)
  321. I_u2u1u3(_srl)
  322. I_u3u1u2(_subu)
  323. I_u2s3u1(_sw)
  324. I_0(_tlbp)
  325. I_0(_tlbwi)
  326. I_0(_tlbwr)
  327. I_u3u1u2(_xor)
  328. I_u2u1u3(_xori)
  329. /* Handle labels. */
  330. void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
  331. {
  332. (*lab)->addr = addr;
  333. (*lab)->lab = lid;
  334. (*lab)++;
  335. }
  336. int __cpuinit uasm_in_compat_space_p(long addr)
  337. {
  338. /* Is this address in 32bit compat space? */
  339. #ifdef CONFIG_64BIT
  340. return (((addr) & 0xffffffff00000000L) == 0xffffffff00000000L);
  341. #else
  342. return 1;
  343. #endif
  344. }
  345. int __cpuinit uasm_rel_highest(long val)
  346. {
  347. #ifdef CONFIG_64BIT
  348. return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
  349. #else
  350. return 0;
  351. #endif
  352. }
  353. int __cpuinit uasm_rel_higher(long val)
  354. {
  355. #ifdef CONFIG_64BIT
  356. return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
  357. #else
  358. return 0;
  359. #endif
  360. }
  361. int __cpuinit uasm_rel_hi(long val)
  362. {
  363. return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
  364. }
  365. int __cpuinit uasm_rel_lo(long val)
  366. {
  367. return ((val & 0xffff) ^ 0x8000) - 0x8000;
  368. }
  369. void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr)
  370. {
  371. if (!uasm_in_compat_space_p(addr)) {
  372. uasm_i_lui(buf, rs, uasm_rel_highest(addr));
  373. if (uasm_rel_higher(addr))
  374. uasm_i_daddiu(buf, rs, rs, uasm_rel_higher(addr));
  375. if (uasm_rel_hi(addr)) {
  376. uasm_i_dsll(buf, rs, rs, 16);
  377. uasm_i_daddiu(buf, rs, rs, uasm_rel_hi(addr));
  378. uasm_i_dsll(buf, rs, rs, 16);
  379. } else
  380. uasm_i_dsll32(buf, rs, rs, 0);
  381. } else
  382. uasm_i_lui(buf, rs, uasm_rel_hi(addr));
  383. }
  384. void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr)
  385. {
  386. UASM_i_LA_mostly(buf, rs, addr);
  387. if (uasm_rel_lo(addr)) {
  388. if (!uasm_in_compat_space_p(addr))
  389. uasm_i_daddiu(buf, rs, rs, uasm_rel_lo(addr));
  390. else
  391. uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr));
  392. }
  393. }
  394. /* Handle relocations. */
  395. void __cpuinit
  396. uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid)
  397. {
  398. (*rel)->addr = addr;
  399. (*rel)->type = R_MIPS_PC16;
  400. (*rel)->lab = lid;
  401. (*rel)++;
  402. }
  403. static inline void __cpuinit
  404. __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
  405. {
  406. long laddr = (long)lab->addr;
  407. long raddr = (long)rel->addr;
  408. switch (rel->type) {
  409. case R_MIPS_PC16:
  410. *rel->addr |= build_bimm(laddr - (raddr + 4));
  411. break;
  412. default:
  413. panic("Unsupported Micro-assembler relocation %d",
  414. rel->type);
  415. }
  416. }
  417. void __cpuinit
  418. uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
  419. {
  420. struct uasm_label *l;
  421. for (; rel->lab != UASM_LABEL_INVALID; rel++)
  422. for (l = lab; l->lab != UASM_LABEL_INVALID; l++)
  423. if (rel->lab == l->lab)
  424. __resolve_relocs(rel, l);
  425. }
  426. void __cpuinit
  427. uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off)
  428. {
  429. for (; rel->lab != UASM_LABEL_INVALID; rel++)
  430. if (rel->addr >= first && rel->addr < end)
  431. rel->addr += off;
  432. }
  433. void __cpuinit
  434. uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off)
  435. {
  436. for (; lab->lab != UASM_LABEL_INVALID; lab++)
  437. if (lab->addr >= first && lab->addr < end)
  438. lab->addr += off;
  439. }
  440. void __cpuinit
  441. uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first,
  442. u32 *end, u32 *target)
  443. {
  444. long off = (long)(target - first);
  445. memcpy(target, first, (end - first) * sizeof(u32));
  446. uasm_move_relocs(rel, first, end, off);
  447. uasm_move_labels(lab, first, end, off);
  448. }
  449. int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr)
  450. {
  451. for (; rel->lab != UASM_LABEL_INVALID; rel++) {
  452. if (rel->addr == addr
  453. && (rel->type == R_MIPS_PC16
  454. || rel->type == R_MIPS_26))
  455. return 1;
  456. }
  457. return 0;
  458. }
  459. /* Convenience functions for labeled branches. */
  460. void __cpuinit
  461. uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  462. {
  463. uasm_r_mips_pc16(r, *p, lid);
  464. uasm_i_bltz(p, reg, 0);
  465. }
  466. void __cpuinit
  467. uasm_il_b(u32 **p, struct uasm_reloc **r, int lid)
  468. {
  469. uasm_r_mips_pc16(r, *p, lid);
  470. uasm_i_b(p, 0);
  471. }
  472. void __cpuinit
  473. uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  474. {
  475. uasm_r_mips_pc16(r, *p, lid);
  476. uasm_i_beqz(p, reg, 0);
  477. }
  478. void __cpuinit
  479. uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  480. {
  481. uasm_r_mips_pc16(r, *p, lid);
  482. uasm_i_beqzl(p, reg, 0);
  483. }
  484. void __cpuinit
  485. uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  486. {
  487. uasm_r_mips_pc16(r, *p, lid);
  488. uasm_i_bnez(p, reg, 0);
  489. }
  490. void __cpuinit
  491. uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  492. {
  493. uasm_r_mips_pc16(r, *p, lid);
  494. uasm_i_bgezl(p, reg, 0);
  495. }
  496. void __cpuinit
  497. uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
  498. {
  499. uasm_r_mips_pc16(r, *p, lid);
  500. uasm_i_bgez(p, reg, 0);
  501. }