Lines Matching refs:pos

29 	struct bpf_insn *pos;
33 pos_get_cnt(struct bpf_insn_pos *pos)
35 return pos->pos - pos->begin;
39 append_insn(struct bpf_insn new_insn, struct bpf_insn_pos *pos)
41 if (!pos->pos)
44 if (pos->pos + 1 >= pos->end) {
46 pos->pos = NULL;
50 *(pos->pos)++ = new_insn;
55 check_pos(struct bpf_insn_pos *pos)
57 if (!pos->pos || pos->pos >= pos->end)
112 gen_ldx_reg_from_ctx(struct bpf_insn_pos *pos, int ctx_reg,
122 ins(BPF_LDX_MEM(BPF_DW, target_reg, ctx_reg, offset), pos);
124 return check_pos(pos);
142 gen_read_mem(struct bpf_insn_pos *pos,
150 ins(BPF_MOV64_REG(BPF_REG_ARG3, src_base_addr_reg), pos);
153 ins(BPF_ALU64_IMM(BPF_ADD, BPF_REG_ARG3, offset), pos);
156 ins(BPF_ALU64_IMM(BPF_MOV, BPF_REG_ARG2, BPF_REG_SIZE), pos);
160 ins(BPF_MOV64_REG(BPF_REG_ARG1, dst_addr_reg), pos);
163 ins(BPF_EMIT_CALL(probeid), pos);
170 pos);
172 return check_pos(pos);
183 gen_prologue_fastpath(struct bpf_insn_pos *pos,
189 err = gen_ldx_reg_from_ctx(pos, BPF_REG_1, args[i].value,
195 return check_pos(pos);
242 gen_prologue_slowpath(struct bpf_insn_pos *pos,
257 err = gen_ldx_reg_from_ctx(pos, BPF_REG_CTX, reg,
266 ins(BPF_MOV64_REG(BPF_REG_7, BPF_REG_FP), pos);
268 ins(BPF_ALU64_IMM(BPF_ADD, BPF_REG_7, stack_offset), pos);
277 stack_offset), pos);
288 err = gen_read_mem(pos, BPF_REG_3, BPF_REG_7,
303 BPF_REG_FP, stack_offset), pos);
314 BPF_REG_FP, -BPF_REG_SIZE * (i + 1)), pos);
317 ins(BPF_JMP_IMM(BPF_JA, BPF_REG_0, 0, JMP_TO_SUCCESS_CODE), pos);
319 return check_pos(pos);
325 prologue_relocate(struct bpf_insn_pos *pos, struct bpf_insn *error_code,
330 if (check_pos(pos))
333 for (insn = pos->begin; insn < pos->pos; insn++) {
371 struct bpf_insn_pos pos;
381 pos.begin = new_prog;
382 pos.end = new_prog + cnt_space;
383 pos.pos = new_prog;
387 &pos);
389 if (check_pos(&pos))
392 *new_cnt = pos_get_cnt(&pos);
441 err = gen_prologue_fastpath(&pos, args, nargs);
448 ins(BPF_MOV64_REG(BPF_REG_CTX, BPF_REG_ARG1), &pos);
450 err = gen_prologue_slowpath(&pos, args, nargs);
462 error_code = pos.pos;
464 &pos);
470 &pos);
472 &pos);
480 success_code = pos.pos;
481 ins(BPF_ALU64_IMM(BPF_MOV, BPF_PROLOGUE_FETCH_RESULT_REG, 0), &pos);
487 user_code = pos.pos;
493 ins(BPF_MOV64_REG(BPF_REG_ARG1, BPF_REG_CTX), &pos);
494 err = prologue_relocate(&pos, error_code, success_code,
500 err = check_pos(&pos);
504 *new_cnt = pos_get_cnt(&pos);