Home | History | Annotate | Download | only in seccomp-bpf

Lines Matching refs:code

2 // Use of this source code is governed by a BSD-style license that can be
17 switch (BPF_CLASS(instruction->code)) {
19 if (BPF_OP(instruction->code) != BPF_JA) {
58 switch (BPF_CLASS(iter->code)) {
60 if (iter->code == BPF_LD + BPF_W + BPF_ABS) {
91 if (BPF_OP(iter->code) == BPF_JA) {
95 BPF_OP(iter->code) == BPF_JSET ? "&" :
96 BPF_OP(iter->code) == BPF_JEQ ? "==" :
97 BPF_OP(iter->code) == BPF_JGE ? ">=" :
98 BPF_OP(iter->code) == BPF_JGT ? ">" : "???",
118 fprintf(stderr, BPF_OP(iter->code) == BPF_NEG
120 BPF_OP(iter->code) == BPF_ADD ? "+" :
121 BPF_OP(iter->code) == BPF_SUB ? "-" :
122 BPF_OP(iter->code) == BPF_MUL ? "*" :
123 BPF_OP(iter->code) == BPF_DIV ? "/" :
124 BPF_OP(iter->code) == BPF_MOD ? "%" :
125 BPF_OP(iter->code) == BPF_OR ? "|" :
126 BPF_OP(iter->code) == BPF_XOR ? "^" :
127 BPF_OP(iter->code) == BPF_AND ? "&" :
128 BPF_OP(iter->code) == BPF_LSH ? "<<" :
129 BPF_OP(iter->code) == BPF_RSH ? ">>" : "???",
140 Instruction* CodeGen::MakeInstruction(uint16_t code,
147 if (BPF_CLASS(code) == BPF_JMP && BPF_OP(code) != BPF_JA) {
152 if (next && BPF_CLASS(code) == BPF_RET) {
155 if (BPF_CLASS(code) == BPF_JMP) {
157 Instruction* insn = new Instruction(code, 0, next, NULL);
162 Instruction* insn = new Instruction(code, k, next);
168 Instruction* CodeGen::MakeInstruction(uint16_t code, const ErrorCode& err) {
169 if (BPF_CLASS(code) != BPF_RET) {
176 return MakeInstruction(code, err.err_);
179 Instruction* CodeGen::MakeInstruction(uint16_t code,
185 if (BPF_CLASS(code) != BPF_JMP || BPF_OP(code) == BPF_JA) {
193 Instruction* insn = new Instruction(code, k, jt, jf);
202 if (BPF_CLASS(head->code) == BPF_JMP) {
203 if (BPF_OP(head->code) == BPF_JA) {
217 } else if (BPF_CLASS(head->code) == BPF_RET) {
250 if (BPF_CLASS(insn->code) == BPF_JMP) {
254 if (BPF_OP(insn->code) != BPF_JA) {
273 if (!insn->next != (BPF_CLASS(insn->code) == BPF_RET)) {
321 if (BPF_CLASS(head->code) == BPF_JMP) {
377 if (BPF_CLASS(insn->code) == BPF_JMP) {
382 if (BPF_OP(insn->code) != BPF_JA) {
456 // If the two blocks are the same length (and have elementwise-equal code
462 CHECK(BPF_CLASS(insns1_last->code) != BPF_JMP &&
463 BPF_CLASS(insns1_last->code) != BPF_RET);
476 if (insn1.code != insn2.code) {
477 return insn1.code - insn2.code;
485 if (BPF_CLASS(insn1.code) == BPF_JMP || BPF_CLASS(insn1.code) == BPF_RET) {
493 if (BPF_CLASS(insn1.code) == BPF_RET) {
495 } else if (BPF_CLASS(insn1.code) != BPF_JMP) {
505 if (BPF_OP(insn1.code) != BPF_JA) {
562 if (BPF_CLASS(last_insn->code) == BPF_JMP) {
566 if (BPF_OP(last_insn->code) != BPF_JA) {
572 } else if (BPF_CLASS(last_insn->code) != BPF_RET) {
605 if (BPF_CLASS(last_insn->code) == BPF_JMP) {
609 if (BPF_OP(last_insn->code) != BPF_JA) {
620 } else if (BPF_CLASS(last_insn->code) != BPF_RET) {
621 // We encountered an instruction that doesn't change code flow. Try to
631 // instruction to correct the code flow.
668 if (BPF_CLASS(insn->code) == BPF_JMP) {
671 if (BPF_OP(insn->code) == BPF_JA) {
716 } else if (BPF_CLASS(insn->code) != BPF_RET &&
743 (struct sock_filter) {insn.code, insn.jt, insn.jf, insn.k});
752 "Cannot call Compile() multiple times. Create a new code "