Lines Matching +full:lower +full:- +full:case

1 // SPDX-License-Identifier: GPL-2.0
62 case RV_CTX_F_SEEN_S1: in bpf_to_rv_reg()
63 case RV_CTX_F_SEEN_S2: in bpf_to_rv_reg()
64 case RV_CTX_F_SEEN_S3: in bpf_to_rv_reg()
65 case RV_CTX_F_SEEN_S4: in bpf_to_rv_reg()
66 case RV_CTX_F_SEEN_S5: in bpf_to_rv_reg()
67 case RV_CTX_F_SEEN_S6: in bpf_to_rv_reg()
68 __set_bit(reg, &ctx->flags); in bpf_to_rv_reg()
76 case RV_CTX_F_SEEN_CALL: in seen_reg()
77 case RV_CTX_F_SEEN_S1: in seen_reg()
78 case RV_CTX_F_SEEN_S2: in seen_reg()
79 case RV_CTX_F_SEEN_S3: in seen_reg()
80 case RV_CTX_F_SEEN_S4: in seen_reg()
81 case RV_CTX_F_SEEN_S5: in seen_reg()
82 case RV_CTX_F_SEEN_S6: in seen_reg()
83 return test_bit(reg, &ctx->flags); in seen_reg()
90 __set_bit(RV_CTX_F_SEEN_S5, &ctx->flags); in mark_fp()
95 __set_bit(RV_CTX_F_SEEN_CALL, &ctx->flags); in mark_call()
100 return test_bit(RV_CTX_F_SEEN_CALL, &ctx->flags); in seen_call()
105 __set_bit(RV_CTX_F_SEEN_TAIL_CALL, &ctx->flags); in mark_tail_call()
110 return test_bit(RV_CTX_F_SEEN_TAIL_CALL, &ctx->flags); in seen_tail_call()
118 __set_bit(RV_CTX_F_SEEN_S6, &ctx->flags); in rv_tail_call_reg()
126 return -(1L << 31) <= val && val < (1L << 31); in is_32b_int()
132 * auipc+jalr can reach any signed PC-relative offset in the range in in_auipc_jalr_range()
133 * [-2^31 - 2^11, 2^31 - 2^11). in in_auipc_jalr_range()
135 return (-(1L << 31) - (1L << 11)) <= val && in in_auipc_jalr_range()
136 val < ((1L << 31) - (1L << 11)); in in_auipc_jalr_range()
141 /* Note that the immediate from the add is sign-extended, in emit_imm()
145 * shift. The "Loading a 32-Bit constant" example from the in emit_imm()
146 * "Computer Organization and Design, RISC-V edition" book by in emit_imm()
152 /* Sign-extend lower 12 bits to 64 bits since immediates for li, addiw, in emit_imm()
155 s64 lower = ((val & 0xfff) << 52) >> 52; in emit_imm() local
163 emit_li(rd, lower, ctx); in emit_imm()
167 emit_addiw(rd, rd, lower, ctx); in emit_imm()
178 if (lower) in emit_imm()
179 emit_addi(rd, rd, lower, ctx); in emit_imm()
184 int stack_adjust = ctx->stack_size, store_offset = stack_adjust - 8; in __build_epilogue()
188 store_offset -= 8; in __build_epilogue()
191 store_offset -= 8; in __build_epilogue()
194 store_offset -= 8; in __build_epilogue()
198 store_offset -= 8; in __build_epilogue()
202 store_offset -= 8; in __build_epilogue()
206 store_offset -= 8; in __build_epilogue()
210 store_offset -= 8; in __build_epilogue()
214 store_offset -= 8; in __build_epilogue()
230 case BPF_JEQ: in emit_bcc()
233 case BPF_JGT: in emit_bcc()
236 case BPF_JLT: in emit_bcc()
239 case BPF_JGE: in emit_bcc()
242 case BPF_JLE: in emit_bcc()
245 case BPF_JNE: in emit_bcc()
248 case BPF_JSGT: in emit_bcc()
251 case BPF_JSLT: in emit_bcc()
254 case BPF_JSGE: in emit_bcc()
257 case BPF_JSLE: in emit_bcc()
265 s64 upper, lower; in emit_branch() local
273 rvoff -= 4; in emit_branch()
294 lower = rvoff & 0xfff; in emit_branch()
298 emit(rv_jalr(RV_REG_ZERO, RV_REG_T1, lower), ctx); in emit_branch()
309 int tc_ninsn, off, start_insn = ctx->ninsns; in emit_bpf_tail_call()
316 * if (index >= array->map.max_entries) in emit_bpf_tail_call()
319 tc_ninsn = insn ? ctx->offset[insn] - ctx->offset[insn - 1] : in emit_bpf_tail_call()
320 ctx->offset[0]; in emit_bpf_tail_call()
325 return -1; in emit_bpf_tail_call()
327 off = ninsns_rvoff(tc_ninsn - (ctx->ninsns - start_insn)); in emit_bpf_tail_call()
330 /* if (--TCC < 0) in emit_bpf_tail_call()
333 emit_addi(RV_REG_TCC, tcc, -1, ctx); in emit_bpf_tail_call()
334 off = ninsns_rvoff(tc_ninsn - (ctx->ninsns - start_insn)); in emit_bpf_tail_call()
337 /* prog = array->ptrs[index]; in emit_bpf_tail_call()
345 return -1; in emit_bpf_tail_call()
347 off = ninsns_rvoff(tc_ninsn - (ctx->ninsns - start_insn)); in emit_bpf_tail_call()
350 /* goto *(prog->bpf_func + 4); */ in emit_bpf_tail_call()
353 return -1; in emit_bpf_tail_call()
362 u8 code = insn->code; in init_regs()
365 case BPF_JMP | BPF_JA: in init_regs()
366 case BPF_JMP | BPF_CALL: in init_regs()
367 case BPF_JMP | BPF_EXIT: in init_regs()
368 case BPF_JMP | BPF_TAIL_CALL: in init_regs()
371 *rd = bpf_to_rv_reg(insn->dst_reg, ctx); in init_regs()
377 *rs = bpf_to_rv_reg(insn->src_reg, ctx); in init_regs()
415 s64 upper, lower; in emit_jump_and_link() local
422 lower = rvoff & 0xfff; in emit_jump_and_link()
424 emit(rv_jalr(rd, RV_REG_T1, lower), ctx); in emit_jump_and_link()
428 pr_err("bpf-jit: target offset 0x%llx is out of range\n", rvoff); in emit_jump_and_link()
429 return -ERANGE; in emit_jump_and_link()
445 if (addr && ctx->insns) { in emit_call()
446 ip = (u64)(long)(ctx->insns + ctx->ninsns); in emit_call()
447 off = addr - ip; in emit_call()
476 case BPF_ADD: in emit_atomic()
480 case BPF_AND: in emit_atomic()
484 case BPF_OR: in emit_atomic()
488 case BPF_XOR: in emit_atomic()
493 case BPF_ADD | BPF_FETCH: in emit_atomic()
499 case BPF_AND | BPF_FETCH: in emit_atomic()
505 case BPF_OR | BPF_FETCH: in emit_atomic()
511 case BPF_XOR | BPF_FETCH: in emit_atomic()
518 case BPF_XCHG: in emit_atomic()
525 case BPF_CMPXCHG: in emit_atomic()
535 jmp_offset = ninsns_rvoff(-6); in emit_atomic()
548 off_t offset = FIELD_GET(BPF_FIXUP_OFFSET_MASK, ex->fixup); in ex_handler_bpf()
549 int regs_offset = FIELD_GET(BPF_FIXUP_REG_MASK, ex->fixup); in ex_handler_bpf()
552 regs->epc = (unsigned long)&ex->fixup - offset; in ex_handler_bpf()
566 if (!ctx->insns || !ctx->prog->aux->extable || BPF_MODE(insn->code) != BPF_PROBE_MEM) in add_exception_handler()
569 if (WARN_ON_ONCE(ctx->nexentries >= ctx->prog->aux->num_exentries)) in add_exception_handler()
570 return -EINVAL; in add_exception_handler()
572 if (WARN_ON_ONCE(insn_len > ctx->ninsns)) in add_exception_handler()
573 return -EINVAL; in add_exception_handler()
576 return -EINVAL; in add_exception_handler()
578 ex = &ctx->prog->aux->extable[ctx->nexentries]; in add_exception_handler()
579 pc = (unsigned long)&ctx->insns[ctx->ninsns - insn_len]; in add_exception_handler()
581 offset = pc - (long)&ex->insn; in add_exception_handler()
583 return -ERANGE; in add_exception_handler()
584 ex->insn = offset; in add_exception_handler()
594 offset = (long)&ex->fixup - (pc + insn_len * sizeof(u16)); in add_exception_handler()
596 return -ERANGE; in add_exception_handler()
598 ex->fixup = FIELD_PREP(BPF_FIXUP_OFFSET_MASK, offset) | in add_exception_handler()
600 ex->type = EX_TYPE_BPF; in add_exception_handler()
602 ctx->nexentries++; in add_exception_handler()
609 bool is64 = BPF_CLASS(insn->code) == BPF_ALU64 || in bpf_jit_emit_insn()
610 BPF_CLASS(insn->code) == BPF_JMP; in bpf_jit_emit_insn()
611 int s, e, rvoff, ret, i = insn - ctx->prog->insnsi; in bpf_jit_emit_insn()
612 struct bpf_prog_aux *aux = ctx->prog->aux; in bpf_jit_emit_insn()
613 u8 rd = -1, rs = -1, code = insn->code; in bpf_jit_emit_insn()
614 s16 off = insn->off; in bpf_jit_emit_insn()
615 s32 imm = insn->imm; in bpf_jit_emit_insn()
621 case BPF_ALU | BPF_MOV | BPF_X: in bpf_jit_emit_insn()
622 case BPF_ALU64 | BPF_MOV | BPF_X: in bpf_jit_emit_insn()
629 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
634 case BPF_ALU | BPF_ADD | BPF_X: in bpf_jit_emit_insn()
635 case BPF_ALU64 | BPF_ADD | BPF_X: in bpf_jit_emit_insn()
637 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
640 case BPF_ALU | BPF_SUB | BPF_X: in bpf_jit_emit_insn()
641 case BPF_ALU64 | BPF_SUB | BPF_X: in bpf_jit_emit_insn()
647 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
650 case BPF_ALU | BPF_AND | BPF_X: in bpf_jit_emit_insn()
651 case BPF_ALU64 | BPF_AND | BPF_X: in bpf_jit_emit_insn()
653 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
656 case BPF_ALU | BPF_OR | BPF_X: in bpf_jit_emit_insn()
657 case BPF_ALU64 | BPF_OR | BPF_X: in bpf_jit_emit_insn()
659 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
662 case BPF_ALU | BPF_XOR | BPF_X: in bpf_jit_emit_insn()
663 case BPF_ALU64 | BPF_XOR | BPF_X: in bpf_jit_emit_insn()
665 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
668 case BPF_ALU | BPF_MUL | BPF_X: in bpf_jit_emit_insn()
669 case BPF_ALU64 | BPF_MUL | BPF_X: in bpf_jit_emit_insn()
671 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
674 case BPF_ALU | BPF_DIV | BPF_X: in bpf_jit_emit_insn()
675 case BPF_ALU64 | BPF_DIV | BPF_X: in bpf_jit_emit_insn()
677 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
680 case BPF_ALU | BPF_MOD | BPF_X: in bpf_jit_emit_insn()
681 case BPF_ALU64 | BPF_MOD | BPF_X: in bpf_jit_emit_insn()
683 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
686 case BPF_ALU | BPF_LSH | BPF_X: in bpf_jit_emit_insn()
687 case BPF_ALU64 | BPF_LSH | BPF_X: in bpf_jit_emit_insn()
689 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
692 case BPF_ALU | BPF_RSH | BPF_X: in bpf_jit_emit_insn()
693 case BPF_ALU64 | BPF_RSH | BPF_X: in bpf_jit_emit_insn()
695 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
698 case BPF_ALU | BPF_ARSH | BPF_X: in bpf_jit_emit_insn()
699 case BPF_ALU64 | BPF_ARSH | BPF_X: in bpf_jit_emit_insn()
701 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
705 /* dst = -dst */ in bpf_jit_emit_insn()
706 case BPF_ALU | BPF_NEG: in bpf_jit_emit_insn()
707 case BPF_ALU64 | BPF_NEG: in bpf_jit_emit_insn()
709 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
714 case BPF_ALU | BPF_END | BPF_FROM_LE: in bpf_jit_emit_insn()
716 case 16: in bpf_jit_emit_insn()
720 case 32: in bpf_jit_emit_insn()
721 if (!aux->verifier_zext) in bpf_jit_emit_insn()
724 case 64: in bpf_jit_emit_insn()
730 case BPF_ALU | BPF_END | BPF_FROM_BE: in bpf_jit_emit_insn()
779 case BPF_ALU | BPF_MOV | BPF_K: in bpf_jit_emit_insn()
780 case BPF_ALU64 | BPF_MOV | BPF_K: in bpf_jit_emit_insn()
782 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
787 case BPF_ALU | BPF_ADD | BPF_K: in bpf_jit_emit_insn()
788 case BPF_ALU64 | BPF_ADD | BPF_K: in bpf_jit_emit_insn()
795 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
798 case BPF_ALU | BPF_SUB | BPF_K: in bpf_jit_emit_insn()
799 case BPF_ALU64 | BPF_SUB | BPF_K: in bpf_jit_emit_insn()
800 if (is_12b_int(-imm)) { in bpf_jit_emit_insn()
801 emit_addi(rd, rd, -imm, ctx); in bpf_jit_emit_insn()
806 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
809 case BPF_ALU | BPF_AND | BPF_K: in bpf_jit_emit_insn()
810 case BPF_ALU64 | BPF_AND | BPF_K: in bpf_jit_emit_insn()
817 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
820 case BPF_ALU | BPF_OR | BPF_K: in bpf_jit_emit_insn()
821 case BPF_ALU64 | BPF_OR | BPF_K: in bpf_jit_emit_insn()
828 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
831 case BPF_ALU | BPF_XOR | BPF_K: in bpf_jit_emit_insn()
832 case BPF_ALU64 | BPF_XOR | BPF_K: in bpf_jit_emit_insn()
839 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
842 case BPF_ALU | BPF_MUL | BPF_K: in bpf_jit_emit_insn()
843 case BPF_ALU64 | BPF_MUL | BPF_K: in bpf_jit_emit_insn()
847 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
850 case BPF_ALU | BPF_DIV | BPF_K: in bpf_jit_emit_insn()
851 case BPF_ALU64 | BPF_DIV | BPF_K: in bpf_jit_emit_insn()
855 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
858 case BPF_ALU | BPF_MOD | BPF_K: in bpf_jit_emit_insn()
859 case BPF_ALU64 | BPF_MOD | BPF_K: in bpf_jit_emit_insn()
863 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
866 case BPF_ALU | BPF_LSH | BPF_K: in bpf_jit_emit_insn()
867 case BPF_ALU64 | BPF_LSH | BPF_K: in bpf_jit_emit_insn()
870 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
873 case BPF_ALU | BPF_RSH | BPF_K: in bpf_jit_emit_insn()
874 case BPF_ALU64 | BPF_RSH | BPF_K: in bpf_jit_emit_insn()
880 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
883 case BPF_ALU | BPF_ARSH | BPF_K: in bpf_jit_emit_insn()
884 case BPF_ALU64 | BPF_ARSH | BPF_K: in bpf_jit_emit_insn()
890 if (!is64 && !aux->verifier_zext) in bpf_jit_emit_insn()
895 case BPF_JMP | BPF_JA: in bpf_jit_emit_insn()
903 case BPF_JMP | BPF_JEQ | BPF_X: in bpf_jit_emit_insn()
904 case BPF_JMP32 | BPF_JEQ | BPF_X: in bpf_jit_emit_insn()
905 case BPF_JMP | BPF_JGT | BPF_X: in bpf_jit_emit_insn()
906 case BPF_JMP32 | BPF_JGT | BPF_X: in bpf_jit_emit_insn()
907 case BPF_JMP | BPF_JLT | BPF_X: in bpf_jit_emit_insn()
908 case BPF_JMP32 | BPF_JLT | BPF_X: in bpf_jit_emit_insn()
909 case BPF_JMP | BPF_JGE | BPF_X: in bpf_jit_emit_insn()
910 case BPF_JMP32 | BPF_JGE | BPF_X: in bpf_jit_emit_insn()
911 case BPF_JMP | BPF_JLE | BPF_X: in bpf_jit_emit_insn()
912 case BPF_JMP32 | BPF_JLE | BPF_X: in bpf_jit_emit_insn()
913 case BPF_JMP | BPF_JNE | BPF_X: in bpf_jit_emit_insn()
914 case BPF_JMP32 | BPF_JNE | BPF_X: in bpf_jit_emit_insn()
915 case BPF_JMP | BPF_JSGT | BPF_X: in bpf_jit_emit_insn()
916 case BPF_JMP32 | BPF_JSGT | BPF_X: in bpf_jit_emit_insn()
917 case BPF_JMP | BPF_JSLT | BPF_X: in bpf_jit_emit_insn()
918 case BPF_JMP32 | BPF_JSLT | BPF_X: in bpf_jit_emit_insn()
919 case BPF_JMP | BPF_JSGE | BPF_X: in bpf_jit_emit_insn()
920 case BPF_JMP32 | BPF_JSGE | BPF_X: in bpf_jit_emit_insn()
921 case BPF_JMP | BPF_JSLE | BPF_X: in bpf_jit_emit_insn()
922 case BPF_JMP32 | BPF_JSLE | BPF_X: in bpf_jit_emit_insn()
923 case BPF_JMP | BPF_JSET | BPF_X: in bpf_jit_emit_insn()
924 case BPF_JMP32 | BPF_JSET | BPF_X: in bpf_jit_emit_insn()
927 s = ctx->ninsns; in bpf_jit_emit_insn()
932 e = ctx->ninsns; in bpf_jit_emit_insn()
935 rvoff -= ninsns_rvoff(e - s); in bpf_jit_emit_insn()
940 rvoff -= 4; in bpf_jit_emit_insn()
950 case BPF_JMP | BPF_JEQ | BPF_K: in bpf_jit_emit_insn()
951 case BPF_JMP32 | BPF_JEQ | BPF_K: in bpf_jit_emit_insn()
952 case BPF_JMP | BPF_JGT | BPF_K: in bpf_jit_emit_insn()
953 case BPF_JMP32 | BPF_JGT | BPF_K: in bpf_jit_emit_insn()
954 case BPF_JMP | BPF_JLT | BPF_K: in bpf_jit_emit_insn()
955 case BPF_JMP32 | BPF_JLT | BPF_K: in bpf_jit_emit_insn()
956 case BPF_JMP | BPF_JGE | BPF_K: in bpf_jit_emit_insn()
957 case BPF_JMP32 | BPF_JGE | BPF_K: in bpf_jit_emit_insn()
958 case BPF_JMP | BPF_JLE | BPF_K: in bpf_jit_emit_insn()
959 case BPF_JMP32 | BPF_JLE | BPF_K: in bpf_jit_emit_insn()
960 case BPF_JMP | BPF_JNE | BPF_K: in bpf_jit_emit_insn()
961 case BPF_JMP32 | BPF_JNE | BPF_K: in bpf_jit_emit_insn()
962 case BPF_JMP | BPF_JSGT | BPF_K: in bpf_jit_emit_insn()
963 case BPF_JMP32 | BPF_JSGT | BPF_K: in bpf_jit_emit_insn()
964 case BPF_JMP | BPF_JSLT | BPF_K: in bpf_jit_emit_insn()
965 case BPF_JMP32 | BPF_JSLT | BPF_K: in bpf_jit_emit_insn()
966 case BPF_JMP | BPF_JSGE | BPF_K: in bpf_jit_emit_insn()
967 case BPF_JMP32 | BPF_JSGE | BPF_K: in bpf_jit_emit_insn()
968 case BPF_JMP | BPF_JSLE | BPF_K: in bpf_jit_emit_insn()
969 case BPF_JMP32 | BPF_JSLE | BPF_K: in bpf_jit_emit_insn()
971 s = ctx->ninsns; in bpf_jit_emit_insn()
985 e = ctx->ninsns; in bpf_jit_emit_insn()
988 rvoff -= ninsns_rvoff(e - s); in bpf_jit_emit_insn()
992 case BPF_JMP | BPF_JSET | BPF_K: in bpf_jit_emit_insn()
993 case BPF_JMP32 | BPF_JSET | BPF_K: in bpf_jit_emit_insn()
995 s = ctx->ninsns; in bpf_jit_emit_insn()
1003 * sign-extension is sufficient here and saves one instruction, in bpf_jit_emit_insn()
1008 e = ctx->ninsns; in bpf_jit_emit_insn()
1009 rvoff -= ninsns_rvoff(e - s); in bpf_jit_emit_insn()
1014 case BPF_JMP | BPF_CALL: in bpf_jit_emit_insn()
1020 ret = bpf_jit_get_func_addr(ctx->prog, insn, extra_pass, &addr, in bpf_jit_emit_insn()
1030 case BPF_JMP | BPF_TAIL_CALL: in bpf_jit_emit_insn()
1032 return -1; in bpf_jit_emit_insn()
1036 case BPF_JMP | BPF_EXIT: in bpf_jit_emit_insn()
1037 if (i == ctx->prog->len - 1) in bpf_jit_emit_insn()
1047 case BPF_LD | BPF_IMM | BPF_DW: in bpf_jit_emit_insn()
1058 case BPF_LDX | BPF_MEM | BPF_B: in bpf_jit_emit_insn()
1059 case BPF_LDX | BPF_MEM | BPF_H: in bpf_jit_emit_insn()
1060 case BPF_LDX | BPF_MEM | BPF_W: in bpf_jit_emit_insn()
1061 case BPF_LDX | BPF_MEM | BPF_DW: in bpf_jit_emit_insn()
1062 case BPF_LDX | BPF_PROBE_MEM | BPF_B: in bpf_jit_emit_insn()
1063 case BPF_LDX | BPF_PROBE_MEM | BPF_H: in bpf_jit_emit_insn()
1064 case BPF_LDX | BPF_PROBE_MEM | BPF_W: in bpf_jit_emit_insn()
1065 case BPF_LDX | BPF_PROBE_MEM | BPF_DW: in bpf_jit_emit_insn()
1070 case BPF_B: in bpf_jit_emit_insn()
1072 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1074 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1080 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1082 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1086 case BPF_H: in bpf_jit_emit_insn()
1088 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1090 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1096 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1098 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1102 case BPF_W: in bpf_jit_emit_insn()
1104 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1106 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1112 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1114 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1118 case BPF_DW: in bpf_jit_emit_insn()
1120 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1122 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1128 insns_start = ctx->ninsns; in bpf_jit_emit_insn()
1130 insn_len = ctx->ninsns - insns_start; in bpf_jit_emit_insn()
1140 case BPF_ST | BPF_NOSPEC: in bpf_jit_emit_insn()
1144 case BPF_ST | BPF_MEM | BPF_B: in bpf_jit_emit_insn()
1156 case BPF_ST | BPF_MEM | BPF_H: in bpf_jit_emit_insn()
1167 case BPF_ST | BPF_MEM | BPF_W: in bpf_jit_emit_insn()
1178 case BPF_ST | BPF_MEM | BPF_DW: in bpf_jit_emit_insn()
1191 case BPF_STX | BPF_MEM | BPF_B: in bpf_jit_emit_insn()
1201 case BPF_STX | BPF_MEM | BPF_H: in bpf_jit_emit_insn()
1211 case BPF_STX | BPF_MEM | BPF_W: in bpf_jit_emit_insn()
1221 case BPF_STX | BPF_MEM | BPF_DW: in bpf_jit_emit_insn()
1231 case BPF_STX | BPF_ATOMIC | BPF_W: in bpf_jit_emit_insn()
1232 case BPF_STX | BPF_ATOMIC | BPF_DW: in bpf_jit_emit_insn()
1237 pr_err("bpf-jit: unknown opcode %02x\n", code); in bpf_jit_emit_insn()
1238 return -EINVAL; in bpf_jit_emit_insn()
1248 bpf_stack_adjust = round_up(ctx->prog->aux->stack_depth, 16); in bpf_jit_build_prologue()
1271 store_offset = stack_adjust - 8; in bpf_jit_build_prologue()
1273 /* First instruction is always setting the tail-call-counter in bpf_jit_build_prologue()
1275 * Force using a 4-byte (non-compressed) instruction. in bpf_jit_build_prologue()
1279 emit_addi(RV_REG_SP, RV_REG_SP, -stack_adjust, ctx); in bpf_jit_build_prologue()
1283 store_offset -= 8; in bpf_jit_build_prologue()
1286 store_offset -= 8; in bpf_jit_build_prologue()
1289 store_offset -= 8; in bpf_jit_build_prologue()
1293 store_offset -= 8; in bpf_jit_build_prologue()
1297 store_offset -= 8; in bpf_jit_build_prologue()
1301 store_offset -= 8; in bpf_jit_build_prologue()
1305 store_offset -= 8; in bpf_jit_build_prologue()
1309 store_offset -= 8; in bpf_jit_build_prologue()
1323 ctx->stack_size = stack_adjust; in bpf_jit_build_prologue()