Lines Matching +full:os +full:- +full:code +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (c) 2012 The Chromium OS Authors <chromium-os-dev@chromium.org>
8 * The code may be used by anyone for any purpose,
17 #include "bpf-helper.h"
25 return -1; in bpf_resolve_jumps()
31 size_t offset = count - i - 1; in bpf_resolve_jumps() local
32 struct sock_filter *instr = &filter[offset]; in bpf_resolve_jumps()
33 if (instr->code != (BPF_JMP+BPF_JA)) in bpf_resolve_jumps()
35 switch ((instr->jt<<8)|instr->jf) { in bpf_resolve_jumps()
37 if (labels->labels[instr->k].location == 0xffffffff) { in bpf_resolve_jumps()
39 labels->labels[instr->k].label); in bpf_resolve_jumps()
42 instr->k = labels->labels[instr->k].location - in bpf_resolve_jumps()
43 (offset + 1); in bpf_resolve_jumps()
44 instr->jt = 0; in bpf_resolve_jumps()
45 instr->jf = 0; in bpf_resolve_jumps()
48 if (labels->labels[instr->k].location != 0xffffffff) { in bpf_resolve_jumps()
50 labels->labels[instr->k].label); in bpf_resolve_jumps()
53 labels->labels[instr->k].location = offset; in bpf_resolve_jumps()
54 instr->k = 0; /* fall through */ in bpf_resolve_jumps()
55 instr->jt = 0; in bpf_resolve_jumps()
56 instr->jf = 0; in bpf_resolve_jumps()
66 struct __bpf_label *begin = labels->labels, *end; in seccomp_bpf_label()
69 if (labels->count == BPF_LABELS_MAX) { in seccomp_bpf_label()
73 if (labels->count == 0) { in seccomp_bpf_label()
74 begin->label = label; in seccomp_bpf_label()
75 begin->location = 0xffffffff; in seccomp_bpf_label()
76 labels->count++; in seccomp_bpf_label()
79 end = begin + labels->count; in seccomp_bpf_label()
81 if (!strcmp(label, begin->label)) in seccomp_bpf_label()
84 begin->label = label; in seccomp_bpf_label()
85 begin->location = 0xffffffff; in seccomp_bpf_label()
86 labels->count++; in seccomp_bpf_label()
94 printf("{ code=%u,jt=%u,jf=%u,k=%u },\n", in seccomp_bpf_print()
95 filter->code, filter->jt, filter->jf, filter->k); in seccomp_bpf_print()