jit_ctx
struct jit_ctx *ctx) {
struct jit_ctx *ctx) {
struct jit_ctx *ctx) {
const u32 val, struct jit_ctx *ctx){
const u32 val, struct jit_ctx *ctx) {
const u32 val, struct jit_ctx *ctx){
struct jit_ctx *ctx) {
s16 off, struct jit_ctx *ctx, const u8 sz){
s16 off, struct jit_ctx *ctx, const u8 sz){
s16 off, struct jit_ctx *ctx, const u8 sz){
const u8 rn, struct jit_ctx *ctx, u8 op,
static int emit_bpf_tail_call(struct jit_ctx *ctx)
static inline void emit_rev16(const u8 rd, const u8 rn, struct jit_ctx *ctx)
static inline void emit_rev32(const u8 rd, const u8 rn, struct jit_ctx *ctx)
static inline void emit_push_r64(const s8 src[], struct jit_ctx *ctx)
static void build_prologue(struct jit_ctx *ctx)
static void build_epilogue(struct jit_ctx *ctx)
static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)
static int build_body(struct jit_ctx *ctx)
static int validate_code(struct jit_ctx *ctx)
struct jit_ctx ctx;
static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx)
static inline void emit(u32 inst, struct jit_ctx *ctx)
static u16 imm_offset(u32 k, struct jit_ctx *ctx)
const struct jit_ctx *ctx) {
static inline void emit_mov_i_no8m(const u8 rd, u32 val, struct jit_ctx *ctx)
static inline void emit_mov_i(const u8 rd, u32 val, struct jit_ctx *ctx)
static void emit_bx_r(u8 tgt_reg, struct jit_ctx *ctx)
static inline void emit_blx_r(u8 tgt_reg, struct jit_ctx *ctx)
static inline int epilogue_offset(const struct jit_ctx *ctx)
static inline void emit_udivmod(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx, u8 op, u8 sign)
static inline void emit_udivmod64(const s8 *rd, const s8 *rm, const s8 *rn, struct jit_ctx *ctx,
static s8 arm_bpf_get_reg32(s8 reg, s8 tmp, struct jit_ctx *ctx)
struct jit_ctx *ctx)
static void arm_bpf_put_reg32(s8 reg, s8 src, struct jit_ctx *ctx)
struct jit_ctx *ctx)
struct jit_ctx *ctx)
static void emit_a32_mov_i64(const s8 dst[], u64 val, struct jit_ctx *ctx)
const u32 val, struct jit_ctx *ctx) {
struct jit_ctx *ctx) {
struct jit_ctx *ctx) {
const bool hi, const u8 op, struct jit_ctx *ctx){
const s8 src[], struct jit_ctx *ctx,
static inline void emit_a32_mov_r(const s8 dst, const s8 src, struct jit_ctx *ctx) {
struct jit_ctx *ctx) {
struct jit_ctx *ctx) {
struct jit_ctx *ctx, const u8 op) {
struct jit_ctx *ctx){
static void build_epilogue(struct jit_ctx *ctx, bool was_classic)
static inline void emit(const u32 insn, struct jit_ctx *ctx)
struct jit_ctx *ctx,
static inline void emit_u32_data(const u32 data, struct jit_ctx *ctx)
static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
const s32 val, struct jit_ctx *ctx)
struct jit_ctx *ctx)
static inline void emit_bti(u32 insn, struct jit_ctx *ctx)
static inline void emit_kcfi(u32 hash, struct jit_ctx *ctx)
static int build_body(struct jit_ctx *ctx, bool extra_pass)
static int validate_code(struct jit_ctx *ctx)
static int validate_ctx(struct jit_ctx *ctx)
struct jit_ctx *ctx)
struct jit_ctx ctx;
struct jit_ctx ctx;
static bool should_emit_indirect_call(long target, const struct jit_ctx *ctx)
static void emit_direct_call(u64 target, struct jit_ctx *ctx)
static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l,
static void emit_indirect_call(u64 target, struct jit_ctx *ctx)
static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_links *tl,
static void clear_garbage(struct jit_ctx *ctx, int reg, int effective_bytes)
static void emit_call(u64 target, struct jit_ctx *ctx)
static void save_args(struct jit_ctx *ctx, int bargs_off, int oargs_off,
static void restore_args(struct jit_ctx *ctx, int bargs_off, int nregs)
static void store_func_meta(struct jit_ctx *ctx, u64 func_meta, int func_meta_off)
static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
const struct jit_ctx *ctx)
struct jit_ctx ctx = {
static inline int epilogue_offset(const struct jit_ctx *ctx)
struct jit_ctx ctx = {
const int tmp, const s32 imm, struct jit_ctx *ctx)
static void prepare_bpf_tail_call_cnt(struct jit_ctx *ctx)
static void find_used_callee_regs(struct jit_ctx *ctx)
static void push_callee_regs(struct jit_ctx *ctx)
static void pop_callee_regs(struct jit_ctx *ctx)
struct jit_ctx *ctx)
static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf)
static int emit_bpf_tail_call(struct jit_ctx *ctx)
static int emit_atomic_ld_st(const struct bpf_insn *insn, struct jit_ctx *ctx)
static int emit_lse_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
static int emit_ll_sc_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
static void build_plt(struct jit_ctx *ctx)
static void __maybe_unused build_bhb_mitigation(struct jit_ctx *ctx)
static void build_prologue(struct jit_ctx *ctx)
static int build_body(struct jit_ctx *ctx, bool extra_pass)
static int validate_code(struct jit_ctx *ctx)
static int validate_ctx(struct jit_ctx *ctx)
static int emit_jump_and_link(struct jit_ctx *ctx, u8 rd, u64 target)
struct jit_ctx ctx;
static int emit_call(struct jit_ctx *ctx, u64 addr)
static void store_args(struct jit_ctx *ctx, int nargs, int args_off)
static void restore_args(struct jit_ctx *ctx, int nargs, int args_off)
static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_link *l,
static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_links *tl,
static void sign_extend(struct jit_ctx *ctx, int rd, int rj, u8 size, bool sign)
static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im,
struct jit_ctx ctx;
struct jit_ctx ctx;
struct jit_ctx ctx;
static void __build_epilogue(struct jit_ctx *ctx, bool is_tail_call)
static void build_epilogue(struct jit_ctx *ctx)
static int emit_bpf_tail_call(struct jit_ctx *ctx, int insn)
static void emit_atomic(const struct bpf_insn *insn, struct jit_ctx *ctx)
static void prepare_bpf_tail_call_cnt(struct jit_ctx *ctx, int *store_offset)
struct jit_ctx *ctx,
static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool extra_pass)
static inline void move_addr(struct jit_ctx *ctx, enum loongarch_gpr rd, u64 addr)
static inline void move_imm(struct jit_ctx *ctx, enum loongarch_gpr rd, long imm, bool is32)
static inline void move_reg(struct jit_ctx *ctx, enum loongarch_gpr rd,
static inline void cond_jmp_offset(struct jit_ctx *ctx, u8 cond, enum loongarch_gpr rj,
static inline void cond_jmp_offs26(struct jit_ctx *ctx, u8 cond, enum loongarch_gpr rj,
static inline void uncond_jmp_offs26(struct jit_ctx *ctx, int jmp_offset)
static inline int emit_cond_jmp(struct jit_ctx *ctx, u8 cond, enum loongarch_gpr rj,
struct jit_ctx ctx;
static inline int emit_uncond_jmp(struct jit_ctx *ctx, int jmp_offset)
static inline int emit_tailcall_jmp(struct jit_ctx *ctx, u8 cond, enum loongarch_gpr rj,
static inline int bpf2la_offset(int bpf_insn, int off, const struct jit_ctx *ctx)
static inline int epilogue_offset(const struct jit_ctx *ctx)
static inline void emit_zext_32(struct jit_ctx *ctx, enum loongarch_gpr reg, bool is32)
static inline void emit_sext_32(struct jit_ctx *ctx, enum loongarch_gpr reg, bool is32)
static inline void emit_abi_ext(struct jit_ctx *ctx, int reg, u8 size, bool sign)
static int build_body(struct jit_ctx *ctx)
struct jit_ctx ctx;
struct jit_ctx ctx;
static void emit(const u32 insn, struct jit_ctx *ctx)
static void emit_call(u32 *func, struct jit_ctx *ctx)
static void emit_nop(struct jit_ctx *ctx)
static void emit_reg_move(u32 from, u32 to, struct jit_ctx *ctx)
static void emit_set_const(s32 K, u32 reg, struct jit_ctx *ctx)
static void emit_set_const_sext(s32 K, u32 reg, struct jit_ctx *ctx)
static void emit_alu(u32 opcode, u32 src, u32 dst, struct jit_ctx *ctx)
static void emit_alu3(u32 opcode, u32 a, u32 b, u32 c, struct jit_ctx *ctx)
struct jit_ctx *ctx)
unsigned int dst, struct jit_ctx *ctx)
static void emit_loadimm32(s32 K, unsigned int dest, struct jit_ctx *ctx)
static void emit_loadimm(s32 K, unsigned int dest, struct jit_ctx *ctx)
static void emit_loadimm_sext(s32 K, unsigned int dest, struct jit_ctx *ctx)
int shift_count, struct jit_ctx *ctx)
static void emit_loadimm64(u64 K, unsigned int dest, struct jit_ctx *ctx)
struct jit_ctx *ctx)
const u8 dst, const u8 src, struct jit_ctx *ctx)
const u8 dst, s32 imm, struct jit_ctx *ctx)
struct jit_ctx *ctx)
static void build_prologue(struct jit_ctx *ctx)
static void build_epilogue(struct jit_ctx *ctx)
static void emit_tail_call(struct jit_ctx *ctx)
static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx)