Lines Matching full:k

106 #define CHOOSE_LOAD_FUNC(K, func) \  argument
107 ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset)
124 unsigned int K = filter[i].k; in bpf_jit_build_body() local
139 case BPF_ALU | BPF_ADD | BPF_K: /* A += K; */ in bpf_jit_build_body()
140 if (!K) in bpf_jit_build_body()
142 EMIT(PPC_RAW_ADDI(r_A, r_A, IMM_L(K))); in bpf_jit_build_body()
143 if (K >= 32768) in bpf_jit_build_body()
144 EMIT(PPC_RAW_ADDIS(r_A, r_A, IMM_HA(K))); in bpf_jit_build_body()
150 case BPF_ALU | BPF_SUB | BPF_K: /* A -= K */ in bpf_jit_build_body()
151 if (!K) in bpf_jit_build_body()
153 EMIT(PPC_RAW_ADDI(r_A, r_A, IMM_L(-K))); in bpf_jit_build_body()
154 if (K >= 32768) in bpf_jit_build_body()
155 EMIT(PPC_RAW_ADDIS(r_A, r_A, IMM_HA(-K))); in bpf_jit_build_body()
161 case BPF_ALU | BPF_MUL | BPF_K: /* A *= K */ in bpf_jit_build_body()
162 if (K < 32768) in bpf_jit_build_body()
163 EMIT(PPC_RAW_MULI(r_A, r_A, K)); in bpf_jit_build_body()
165 PPC_LI32(r_scratch1, K); in bpf_jit_build_body()
188 case BPF_ALU | BPF_MOD | BPF_K: /* A %= K; */ in bpf_jit_build_body()
189 PPC_LI32(r_scratch2, K); in bpf_jit_build_body()
194 case BPF_ALU | BPF_DIV | BPF_K: /* A /= K */ in bpf_jit_build_body()
195 if (K == 1) in bpf_jit_build_body()
197 PPC_LI32(r_scratch1, K); in bpf_jit_build_body()
205 if (!IMM_H(K)) in bpf_jit_build_body()
206 EMIT(PPC_RAW_ANDI(r_A, r_A, K)); in bpf_jit_build_body()
208 PPC_LI32(r_scratch1, K); in bpf_jit_build_body()
217 if (IMM_L(K)) in bpf_jit_build_body()
218 EMIT(PPC_RAW_ORI(r_A, r_A, IMM_L(K))); in bpf_jit_build_body()
219 if (K >= 65536) in bpf_jit_build_body()
220 EMIT(PPC_RAW_ORIS(r_A, r_A, IMM_H(K))); in bpf_jit_build_body()
227 case BPF_ALU | BPF_XOR | BPF_K: /* A ^= K */ in bpf_jit_build_body()
228 if (IMM_L(K)) in bpf_jit_build_body()
229 EMIT(PPC_RAW_XORI(r_A, r_A, IMM_L(K))); in bpf_jit_build_body()
230 if (K >= 65536) in bpf_jit_build_body()
231 EMIT(PPC_RAW_XORIS(r_A, r_A, IMM_H(K))); in bpf_jit_build_body()
238 if (K == 0) in bpf_jit_build_body()
241 EMIT(PPC_RAW_SLWI(r_A, r_A, K)); in bpf_jit_build_body()
247 case BPF_ALU | BPF_RSH | BPF_K: /* A >>= K; */ in bpf_jit_build_body()
248 if (K == 0) in bpf_jit_build_body()
251 EMIT(PPC_RAW_SRWI(r_A, r_A, K)); in bpf_jit_build_body()
257 PPC_LI32(r_ret, K); in bpf_jit_build_body()
258 if (!K) { in bpf_jit_build_body()
301 case BPF_LD | BPF_IMM: /* A = K */ in bpf_jit_build_body()
302 PPC_LI32(r_A, K); in bpf_jit_build_body()
304 case BPF_LDX | BPF_IMM: /* X = K */ in bpf_jit_build_body()
305 PPC_LI32(r_X, K); in bpf_jit_build_body()
307 case BPF_LD | BPF_MEM: /* A = mem[K] */ in bpf_jit_build_body()
308 EMIT(PPC_RAW_MR(r_A, r_M + (K & 0xf))); in bpf_jit_build_body()
309 ctx->seen |= SEEN_MEM | (1<<(K & 0xf)); in bpf_jit_build_body()
311 case BPF_LDX | BPF_MEM: /* X = mem[K] */ in bpf_jit_build_body()
312 EMIT(PPC_RAW_MR(r_X, r_M + (K & 0xf))); in bpf_jit_build_body()
313 ctx->seen |= SEEN_MEM | (1<<(K & 0xf)); in bpf_jit_build_body()
315 case BPF_ST: /* mem[K] = A */ in bpf_jit_build_body()
316 EMIT(PPC_RAW_MR(r_M + (K & 0xf), r_A)); in bpf_jit_build_body()
317 ctx->seen |= SEEN_MEM | (1<<(K & 0xf)); in bpf_jit_build_body()
319 case BPF_STX: /* mem[K] = X */ in bpf_jit_build_body()
320 EMIT(PPC_RAW_MR(r_M + (K & 0xf), r_X)); in bpf_jit_build_body()
321 ctx->seen |= SEEN_XREG | SEEN_MEM | (1<<(K & 0xf)); in bpf_jit_build_body()
327 case BPF_LDX | BPF_W | BPF_ABS: /* A = *((u32 *)(seccomp_data + K)); */ in bpf_jit_build_body()
328 PPC_LWZ_OFFS(r_A, r_skb, K); in bpf_jit_build_body()
406 func = CHOOSE_LOAD_FUNC(K, sk_load_word); in bpf_jit_build_body()
409 func = CHOOSE_LOAD_FUNC(K, sk_load_half); in bpf_jit_build_body()
412 func = CHOOSE_LOAD_FUNC(K, sk_load_byte); in bpf_jit_build_body()
414 /* Load from [K]. */ in bpf_jit_build_body()
418 PPC_LI32(r_addr, K); in bpf_jit_build_body()
438 * Load from [X + K]. Negative offsets are tested for in bpf_jit_build_body()
444 EMIT(PPC_RAW_ADDI(r_addr, r_X, IMM_L(K))); in bpf_jit_build_body()
445 if (K >= 32768) in bpf_jit_build_body()
446 EMIT(PPC_RAW_ADDIS(r_addr, r_addr, IMM_HA(K))); in bpf_jit_build_body()
453 func = CHOOSE_LOAD_FUNC(K, sk_load_byte_msh); in bpf_jit_build_body()
459 if (K != 0) in bpf_jit_build_body()
460 PPC_JMP(addrs[i + 1 + K]); in bpf_jit_build_body()
500 if (K < 32768) in bpf_jit_build_body()
501 EMIT(PPC_RAW_CMPLWI(r_A, K)); in bpf_jit_build_body()
503 PPC_LI32(r_scratch1, K); in bpf_jit_build_body()
508 if (K < 32768) in bpf_jit_build_body()
510 EMIT(PPC_RAW_ANDI(r_scratch1, r_A, K)); in bpf_jit_build_body()
512 PPC_LI32(r_scratch1, K); in bpf_jit_build_body()