• Home
  • Raw
  • Download

Lines Matching refs:insn

35 void Ld(State* state, const struct sock_filter& insn, const char** err) {  in Ld()  argument
36 if (BPF_SIZE(insn.code) != BPF_W || BPF_MODE(insn.code) != BPF_ABS || in Ld()
37 insn.jt != 0 || insn.jf != 0) { in Ld()
41 if (insn.k < sizeof(struct arch_seccomp_data) && (insn.k & 3) == 0) { in Ld()
44 reinterpret_cast<const char*>(&state->data) + insn.k, 4); in Ld()
53 void Jmp(State* state, const struct sock_filter& insn, const char** err) { in Jmp() argument
54 if (BPF_OP(insn.code) == BPF_JA) { in Jmp()
55 if (state->ip + insn.k + 1 >= state->program.size() || in Jmp()
56 state->ip + insn.k + 1 <= state->ip) { in Jmp()
61 state->ip += insn.k; in Jmp()
63 if (BPF_SRC(insn.code) != BPF_K || !state->acc_is_valid || in Jmp()
64 state->ip + insn.jt + 1 >= state->program.size() || in Jmp()
65 state->ip + insn.jf + 1 >= state->program.size()) { in Jmp()
68 switch (BPF_OP(insn.code)) { in Jmp()
70 if (state->accumulator == insn.k) { in Jmp()
71 state->ip += insn.jt; in Jmp()
73 state->ip += insn.jf; in Jmp()
77 if (state->accumulator > insn.k) { in Jmp()
78 state->ip += insn.jt; in Jmp()
80 state->ip += insn.jf; in Jmp()
84 if (state->accumulator >= insn.k) { in Jmp()
85 state->ip += insn.jt; in Jmp()
87 state->ip += insn.jf; in Jmp()
91 if (state->accumulator & insn.k) { in Jmp()
92 state->ip += insn.jt; in Jmp()
94 state->ip += insn.jf; in Jmp()
103 uint32_t Ret(State*, const struct sock_filter& insn, const char** err) { in Ret() argument
104 if (BPF_SRC(insn.code) != BPF_K) { in Ret()
108 return insn.k; in Ret()
111 void Alu(State* state, const struct sock_filter& insn, const char** err) { in Alu() argument
112 if (BPF_OP(insn.code) == BPF_NEG) { in Alu()
116 if (BPF_SRC(insn.code) != BPF_K) { in Alu()
120 switch (BPF_OP(insn.code)) { in Alu()
122 state->accumulator += insn.k; in Alu()
125 state->accumulator -= insn.k; in Alu()
128 state->accumulator *= insn.k; in Alu()
131 if (!insn.k) { in Alu()
135 state->accumulator /= insn.k; in Alu()
138 if (!insn.k) { in Alu()
142 state->accumulator %= insn.k; in Alu()
145 state->accumulator |= insn.k; in Alu()
148 state->accumulator ^= insn.k; in Alu()
151 state->accumulator &= insn.k; in Alu()
154 if (insn.k > 32) { in Alu()
158 state->accumulator <<= insn.k; in Alu()
161 if (insn.k > 32) { in Alu()
165 state->accumulator >>= insn.k; in Alu()
189 const struct sock_filter& insn = program[state.ip]; in EvaluateBPF() local
190 switch (BPF_CLASS(insn.code)) { in EvaluateBPF()
192 Ld(&state, insn, err); in EvaluateBPF()
195 Jmp(&state, insn, err); in EvaluateBPF()
198 uint32_t r = Ret(&state, insn, err); in EvaluateBPF()
214 Alu(&state, insn, err); in EvaluateBPF()