Lines Matching defs:emit

110 static inline void emit(const u32 insn, struct jit_ctx *ctx)
134 emit(A64_MOVN(is64, reg, (u16)~lo, 0), ctx);
136 emit(A64_MOVN(is64, reg, (u16)~hi, 16), ctx);
138 emit(A64_MOVK(is64, reg, lo, 0), ctx);
141 emit(A64_MOVZ(is64, reg, lo, 0), ctx);
143 emit(A64_MOVK(is64, reg, hi, 16), ctx);
169 emit(A64_MOVN(1, reg, (rev_tmp >> shift) & 0xffff, shift), ctx);
171 emit(A64_MOVZ(1, reg, (nrm_tmp >> shift) & 0xffff, shift), ctx);
175 emit(A64_MOVK(1, reg, (nrm_tmp >> shift) & 0xffff, shift), ctx);
183 emit(insn, ctx);
203 emit(A64_MOVN(1, reg, ~tmp & 0xffff, shift), ctx);
207 emit(A64_MOVK(1, reg, tmp & 0xffff, shift), ctx);
216 * emit indirect call
232 emit(insn, ctx);
241 emit(A64_BLR(tmp), ctx);
299 emit(A64_ADD_I(is64, dst, src, imm), ctx);
301 emit(A64_SUB_I(is64, dst, src, -imm), ctx);
304 emit(A64_ADD(is64, dst, src, tmp), ctx);
368 emit(A64_PUSH(A64_ZR, ptr, A64_SP), ctx);
369 emit(A64_MOV(1, ptr, A64_SP), ctx);
371 emit(A64_PUSH(ptr, ptr, A64_SP), ctx);
436 emit(A64_PUSH(A64_R(19), A64_R(20), A64_SP), ctx);
437 emit(A64_PUSH(A64_R(21), A64_R(22), A64_SP), ctx);
438 emit(A64_PUSH(A64_R(23), A64_R(24), A64_SP), ctx);
439 emit(A64_PUSH(A64_R(25), A64_R(26), A64_SP), ctx);
440 emit(A64_PUSH(A64_R(27), A64_R(28), A64_SP), ctx);
447 emit(A64_PUSH(reg1, reg2, A64_SP), ctx);
452 emit(A64_PUSH(reg1, A64_ZR, A64_SP), ctx);
470 emit(A64_POP(A64_R(27), A64_R(28), A64_SP), ctx);
471 emit(A64_POP(A64_R(25), A64_R(26), A64_SP), ctx);
472 emit(A64_POP(A64_R(23), A64_R(24), A64_SP), ctx);
473 emit(A64_POP(A64_R(21), A64_R(22), A64_SP), ctx);
474 emit(A64_POP(A64_R(19), A64_R(20), A64_SP), ctx);
479 emit(A64_POP(reg1, A64_ZR, A64_SP), ctx);
485 emit(A64_POP(reg1, reg2, A64_SP), ctx);
498 emit(A64_MRS_TPIDR_EL2(tmp), ctx);
500 emit(A64_MRS_TPIDR_EL1(tmp), ctx);
501 emit(A64_ADD(1, dst_reg, dst_reg, tmp), ctx);
557 emit(A64_MOV(1, A64_R(9), A64_LR), ctx);
558 emit(A64_NOP, ctx);
563 emit(A64_PACIASP, ctx);
566 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
567 emit(A64_MOV(1, A64_FP, A64_SP), ctx);
587 emit(A64_MOV(1, A64_FP, A64_R(2)), ctx);
595 emit(A64_SUB_I(1, A64_SP, A64_FP, 96), ctx);
606 emit(A64_ADD_I(1, fp, priv_sp, ctx->stack_size), ctx);
609 emit(A64_MOV(1, fp, A64_SP), ctx);
615 emit(A64_SUB_I(1, A64_SP, A64_SP, ctx->stack_size), ctx);
643 emit(A64_LDR32(tmp, r2, tmp), ctx);
644 emit(A64_MOV(0, r3, r3), ctx);
645 emit(A64_CMP(0, r3, tmp), ctx);
647 emit(A64_NOP, ctx);
654 emit(A64_LDR64I(tcc, ptr, 0), ctx);
655 emit(A64_CMP(1, tcc, tmp), ctx);
657 emit(A64_NOP, ctx);
660 emit(A64_ADD_I(1, tcc, tcc, 1), ctx);
668 emit(A64_ADD(1, tmp, r2, tmp), ctx);
669 emit(A64_LSL(1, prg, r3, 3), ctx);
670 emit(A64_LDR64(prg, tmp, prg), ctx);
672 emit(A64_NOP, ctx);
675 emit(A64_STR64I(tcc, ptr, 0), ctx);
679 emit(A64_ADD_I(1, A64_SP, A64_SP, ctx->stack_size), ctx);
686 emit(A64_LDR64(tmp, prg, tmp), ctx);
687 emit(A64_ADD_I(1, tmp, tmp, sizeof(u32) * PROLOGUE_OFFSET), ctx);
688 emit(A64_BR(tmp), ctx);
733 emit(A64_ADD(1, tmp, reg, arena_vm_base), ctx);
741 emit(A64_LDARB(dst, reg), ctx);
744 emit(A64_LDARH(dst, reg), ctx);
747 emit(A64_LDAR32(dst, reg), ctx);
750 emit(A64_LDAR64(dst, reg), ctx);
757 emit(A64_STLRB(src, reg), ctx);
760 emit(A64_STLRH(src, reg), ctx);
763 emit(A64_STLR32(src, reg), ctx);
766 emit(A64_STLR64(src, reg), ctx);
798 emit(A64_ADD(1, tmp, reg, arena_vm_base), ctx);
805 emit(A64_STADD(isdw, reg, src), ctx);
808 emit(A64_MVN(isdw, tmp2, src), ctx);
809 emit(A64_STCLR(isdw, reg, tmp2), ctx);
812 emit(A64_STSET(isdw, reg, src), ctx);
815 emit(A64_STEOR(isdw, reg, src), ctx);
819 emit(A64_LDADDAL(isdw, src, reg, src), ctx);
822 emit(A64_MVN(isdw, tmp2, src), ctx);
823 emit(A64_LDCLRAL(isdw, src, reg, tmp2), ctx);
826 emit(A64_LDSETAL(isdw, src, reg, src), ctx);
829 emit(A64_LDEORAL(isdw, src, reg, src), ctx);
833 emit(A64_SWPAL(isdw, src, reg, src), ctx);
837 emit(A64_CASAL(isdw, src, reg, bpf2a64[BPF_REG_0]), ctx);
882 emit(A64_LDXR(isdw, tmp2, reg), ctx);
884 emit(A64_ADD(isdw, tmp2, tmp2, src), ctx);
886 emit(A64_AND(isdw, tmp2, tmp2, src), ctx);
888 emit(A64_ORR(isdw, tmp2, tmp2, src), ctx);
890 emit(A64_EOR(isdw, tmp2, tmp2, src), ctx);
891 emit(A64_STXR(isdw, tmp2, reg, tmp3), ctx);
894 emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
902 emit(A64_MOV(isdw, ax, src), ctx);
903 emit(A64_LDXR(isdw, src, reg), ctx);
905 emit(A64_ADD(isdw, tmp2, src, ax), ctx);
907 emit(A64_AND(isdw, tmp2, src, ax), ctx);
909 emit(A64_ORR(isdw, tmp2, src, ax), ctx);
911 emit(A64_EOR(isdw, tmp2, src, ax), ctx);
912 emit(A64_STLXR(isdw, tmp2, reg, tmp3), ctx);
915 emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
916 emit(A64_DMB_ISH, ctx);
919 emit(A64_MOV(isdw, tmp2, src), ctx);
920 emit(A64_LDXR(isdw, src, reg), ctx);
921 emit(A64_STLXR(isdw, tmp2, reg, tmp3), ctx);
924 emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
925 emit(A64_DMB_ISH, ctx);
930 emit(A64_MOV(isdw, tmp2, r0), ctx);
931 emit(A64_LDXR(isdw, r0, reg), ctx);
932 emit(A64_EOR(isdw, tmp3, r0, tmp2), ctx);
935 emit(A64_CBNZ(isdw, tmp3, jmp_offset), ctx);
936 emit(A64_STLXR(isdw, src, reg, tmp3), ctx);
939 emit(A64_CBNZ(0, tmp3, jmp_offset), ctx);
940 emit(A64_DMB_ISH, ctx);
985 emit(A64_NOP, ctx);
989 emit(A64_LDR64LIT(tmp, 2 * AARCH64_INSN_SIZE), ctx);
990 emit(A64_BR(tmp), ctx);
1011 emit(aarch64_insn_gen_hint(AARCH64_INSN_HINT_CLEARBHB), ctx);
1017 emit(A64_B(1), ctx);
1018 emit(A64_SUBS_I(true, r1, r1, 1), ctx);
1019 emit(A64_B_(A64_COND_NE, -2), ctx);
1020 emit(aarch64_insn_gen_dsb(AARCH64_INSN_MB_ISH), ctx);
1021 emit(aarch64_insn_get_isb_value(), ctx);
1025 emit(A64_ORR_I(false, r1, AARCH64_INSN_REG_ZR,
1029 emit(aarch64_insn_get_hvc_value(), ctx);
1032 emit(aarch64_insn_get_smc_value(), ctx);
1047 emit(A64_ADD_I(1, A64_SP, A64_SP, ctx->stack_size), ctx);
1051 emit(A64_POP(A64_ZR, ptr, A64_SP), ctx);
1057 emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
1060 emit(A64_MOV(1, A64_R(0), r0), ctx);
1064 emit(A64_AUTIASP, ctx);
1066 emit(A64_RET(A64_LR), ctx);
1195 emit(A64_MOV(0, tmp, src), ctx); // 32-bit mov clears the upper 32 bits
1197 emit(A64_LSL(1, dst, dst, 32), ctx);
1198 emit(A64_CBZ(1, tmp, 2), ctx);
1199 emit(A64_ORR(1, tmp, dst, tmp), ctx);
1200 emit(A64_MOV(1, dst, tmp), ctx);
1204 emit(A64_MOV(1, dst, src), ctx);
1206 emit(A64_MRS_TPIDR_EL2(tmp), ctx);
1208 emit(A64_MRS_TPIDR_EL1(tmp), ctx);
1209 emit(A64_ADD(1, dst, dst, tmp), ctx);
1214 emit(A64_MOV(is64, dst, src), ctx);
1217 emit(A64_SXTB(is64, dst, src), ctx);
1220 emit(A64_SXTH(is64, dst, src), ctx);
1223 emit(A64_SXTW(is64, dst, src), ctx);
1230 emit(A64_ADD(is64, dst, dst, src), ctx);
1234 emit(A64_SUB(is64, dst, dst, src), ctx);
1238 emit(A64_AND(is64, dst, dst, src), ctx);
1242 emit(A64_ORR(is64, dst, dst, src), ctx);
1246 emit(A64_EOR(is64, dst, dst, src), ctx);
1250 emit(A64_MUL(is64, dst, dst, src), ctx);
1255 emit(A64_UDIV(is64, dst, dst, src), ctx);
1257 emit(A64_SDIV(is64, dst, dst, src), ctx);
1262 emit(A64_UDIV(is64, tmp, dst, src), ctx);
1264 emit(A64_SDIV(is64, tmp, dst, src), ctx);
1265 emit(A64_MSUB(is64, dst, dst, tmp, src), ctx);
1269 emit(A64_LSLV(is64, dst, dst, src), ctx);
1273 emit(A64_LSRV(is64, dst, dst, src), ctx);
1277 emit(A64_ASRV(is64, dst, dst, src), ctx);
1282 emit(A64_NEG(is64, dst, dst), ctx);
1297 emit(A64_REV16(is64, dst, dst), ctx);
1299 emit(A64_UXTH(is64, dst, dst), ctx);
1302 emit(A64_REV32(0, dst, dst), ctx);
1306 emit(A64_REV64(dst, dst), ctx);
1314 emit(A64_UXTH(is64, dst, dst), ctx);
1318 emit(A64_UXTW(is64, dst, dst), ctx);
1338 emit(A64_SUB_I(is64, dst, dst, imm), ctx);
1340 emit(A64_ADD_I(is64, dst, dst, -imm), ctx);
1343 emit(A64_SUB(is64, dst, dst, tmp), ctx);
1350 emit(a64_insn, ctx);
1353 emit(A64_AND(is64, dst, dst, tmp), ctx);
1360 emit(a64_insn, ctx);
1363 emit(A64_ORR(is64, dst, dst, tmp), ctx);
1370 emit(a64_insn, ctx);
1373 emit(A64_EOR(is64, dst, dst, tmp), ctx);
1379 emit(A64_MUL(is64, dst, dst, tmp), ctx);
1385 emit(A64_UDIV(is64, dst, dst, tmp), ctx);
1387 emit(A64_SDIV(is64, dst, dst, tmp), ctx);
1393 emit(A64_UDIV(is64, tmp, dst, tmp2), ctx);
1395 emit(A64_SDIV(is64, tmp, dst, tmp2), ctx);
1396 emit(A64_MSUB(is64, dst, dst, tmp, tmp2), ctx);
1400 emit(A64_LSL(is64, dst, dst, imm), ctx);
1404 emit(A64_LSR(is64, dst, dst, imm), ctx);
1408 emit(A64_ASR(is64, dst, dst, imm), ctx);
1419 emit(A64_B(jmp_offset), ctx);
1442 emit(A64_CMP(is64, dst, src), ctx);
1481 emit(A64_B_(jmp_cond, jmp_offset), ctx);
1485 emit(A64_TST(is64, dst, src), ctx);
1509 emit(A64_CMP_I(is64, dst, imm), ctx);
1511 emit(A64_CMN_I(is64, dst, -imm), ctx);
1514 emit(A64_CMP(is64, dst, tmp), ctx);
1521 emit(a64_insn, ctx);
1524 emit(A64_TST(is64, dst, tmp), ctx);
1539 emit(A64_MRS_SP_EL0(tmp), ctx);
1541 emit(A64_LDR32I(r0, tmp, cpu_offset), ctx);
1544 emit(A64_LDR32(r0, tmp, tmp2), ctx);
1552 emit(A64_MRS_SP_EL0(r0), ctx);
1561 emit(A64_MOV(1, r0, A64_R(0)), ctx);
1577 emit(A64_B(jmp_offset), ctx);
1616 emit(A64_ADD(1, tmp2, src, arena_vm_base), ctx);
1632 emit(A64_LDRSWI(dst, src_adj, off_adj), ctx);
1634 emit(A64_LDR32I(dst, src_adj, off_adj), ctx);
1638 emit(A64_LDRSW(dst, src, tmp), ctx);
1640 emit(A64_LDR32(dst, src, tmp), ctx);
1646 emit(A64_LDRSHI(dst, src_adj, off_adj), ctx);
1648 emit(A64_LDRHI(dst, src_adj, off_adj), ctx);
1652 emit(A64_LDRSH(dst, src, tmp), ctx);
1654 emit(A64_LDRH(dst, src, tmp), ctx);
1660 emit(A64_LDRSBI(dst, src_adj, off_adj), ctx);
1662 emit(A64_LDRBI(dst, src_adj, off_adj), ctx);
1666 emit(A64_LDRSB(dst, src, tmp), ctx);
1668 emit(A64_LDRB(dst, src, tmp), ctx);
1673 emit(A64_LDR64I(dst, src_adj, off_adj), ctx);
1676 emit(A64_LDR64(dst, src, tmp), ctx);
1689 emit(A64_SB, ctx);
1691 emit(A64_DSB_NSH, ctx);
1692 emit(A64_ISB, ctx);
1706 emit(A64_ADD(1, tmp2, dst, arena_vm_base), ctx);
1721 emit(A64_STR32I(tmp, dst_adj, off_adj), ctx);
1724 emit(A64_STR32(tmp, dst, tmp2), ctx);
1729 emit(A64_STRHI(tmp, dst_adj, off_adj), ctx);
1732 emit(A64_STRH(tmp, dst, tmp2), ctx);
1737 emit(A64_STRBI(tmp, dst_adj, off_adj), ctx);
1740 emit(A64_STRB(tmp, dst, tmp2), ctx);
1745 emit(A64_STR64I(tmp, dst_adj, off_adj), ctx);
1748 emit(A64_STR64(tmp, dst, tmp2), ctx);
1768 emit(A64_ADD(1, tmp2, dst, arena_vm_base), ctx);
1781 emit(A64_STR32I(src, dst_adj, off_adj), ctx);
1784 emit(A64_STR32(src, dst, tmp), ctx);
1789 emit(A64_STRHI(src, dst_adj, off_adj), ctx);
1792 emit(A64_STRH(src, dst, tmp), ctx);
1797 emit(A64_STRBI(src, dst_adj, off_adj), ctx);
1800 emit(A64_STRB(src, dst, tmp), ctx);
1805 emit(A64_STR64I(src, dst_adj, off_adj), ctx);
1808 emit(A64_STR64(src, dst, tmp), ctx);
2245 emit(A64_STR64I(A64_ZR, A64_SP, run_ctx_off + cookie_off), ctx);
2248 emit(A64_STR64I(A64_R(10), A64_SP, run_ctx_off + cookie_off),
2258 emit(A64_MOV(1, A64_R(0), A64_R(19)), ctx);
2260 emit(A64_ADD_I(1, A64_R(1), A64_SP, run_ctx_off), ctx);
2265 emit(A64_MOV(1, A64_R(20), A64_R(0)), ctx);
2271 emit(A64_NOP, ctx);
2273 emit(A64_ADD_I(1, A64_R(0), A64_SP, bargs_off), ctx);
2280 emit(A64_STR64I(A64_R(0), A64_SP, retval_off), ctx);
2288 emit(A64_MOV(1, A64_R(0), A64_R(19)), ctx);
2290 emit(A64_MOV(1, A64_R(1), A64_R(20)), ctx);
2292 emit(A64_ADD_I(1, A64_R(2), A64_SP, run_ctx_off), ctx);
2306 emit(A64_STR64I(A64_ZR, A64_SP, retval_off), ctx);
2313 emit(A64_LDR64I(A64_R(10), A64_SP, retval_off), ctx);
2318 emit(A64_NOP, ctx);
2375 emit(A64_LSR(1, reg, reg, garbage_bits), ctx);
2376 emit(A64_LSL(1, reg, reg, garbage_bits), ctx);
2379 emit(A64_LSL(1, reg, reg, garbage_bits), ctx);
2380 emit(A64_LSR(1, reg, reg, garbage_bits), ctx);
2401 emit(for_call_origin ?
2416 emit(A64_LDR64I(tmp, A64_FP, soff), ctx);
2422 emit(A64_STR64I(tmp, A64_SP, doff), ctx);
2434 emit(A64_LDR64I(reg, A64_SP, bargs_off), ctx);
2564 emit(A64_PUSH(A64_FP, A64_R(9), A64_SP), ctx);
2565 emit(A64_MOV(1, A64_FP, A64_SP), ctx);
2569 emit(A64_PUSH(A64_FP, A64_LR, A64_SP), ctx);
2570 emit(A64_MOV(1, A64_FP, A64_SP), ctx);
2573 emit(A64_SUB_I(1, A64_SP, A64_SP, stack_size), ctx);
2578 emit(A64_STR64I(A64_R(10), A64_SP, ip_off), ctx);
2582 emit(A64_MOVZ(1, A64_R(10), nfuncargs, 0), ctx);
2583 emit(A64_STR64I(A64_R(10), A64_SP, nfuncargs_off), ctx);
2589 emit(A64_STR64I(A64_R(19), A64_SP, regs_off), ctx);
2590 emit(A64_STR64I(A64_R(20), A64_SP, regs_off + 8), ctx);
2620 emit(A64_LDR64I(A64_R(10), A64_SP, retaddr_off), ctx);
2621 emit(A64_ADR(A64_LR, AARCH64_INSN_SIZE * 2), ctx);
2622 emit(A64_RET(A64_R(10)), ctx);
2624 emit(A64_STR64I(A64_R(0), A64_SP, retval_off), ctx);
2627 emit(A64_NOP, ctx);
2654 emit(A64_LDR64I(A64_R(19), A64_SP, regs_off), ctx);
2655 emit(A64_LDR64I(A64_R(20), A64_SP, regs_off + 8), ctx);
2658 emit(A64_LDR64I(A64_R(0), A64_SP, retval_off), ctx);
2661 emit(A64_MOV(1, A64_SP, A64_FP), ctx);
2664 emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
2665 emit(A64_RET(A64_LR), ctx);
2668 emit(A64_POP(A64_FP, A64_LR, A64_SP), ctx);
2669 emit(A64_POP(A64_FP, A64_R(9), A64_SP), ctx);
2673 emit(A64_MOV(1, A64_LR, A64_R(9)), ctx);
2674 emit(A64_RET(A64_R(9)), ctx);
2677 emit(A64_MOV(1, A64_R(10), A64_LR), ctx);
2678 emit(A64_MOV(1, A64_LR, A64_R(9)), ctx);
2679 emit(A64_RET(A64_R(10)), ctx);