tools/bpf/bpf_exp.y

Source file repositories/reference/linux-study-clean/tools/bpf/bpf_exp.y

File Facts

System
Linux kernel
Corpus path
tools/bpf/bpf_exp.y
Extension
.y
Size
16098 bytes
Lines
669
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if ($2 != 4 || $9 != 0xf) {
			fprintf(stderr, "ldxb offset not supported!\n");
			exit(1);
		} else {
			bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
	| OP_LDX number '*' '(' '[' number ']' '&' number ')' {
		if ($2 != 4 || $9 != 0xf) {
			fprintf(stderr, "ldxb offset not supported!\n");
			exit(1);
		} else {
			bpf_set_curr_instr(BPF_LDX | BPF_MSH | BPF_B, 0, 0, $6); } }
	;

st
	: OP_ST 'M' '[' number ']' {
		bpf_set_curr_instr(BPF_ST, 0, 0, $4); }
	;

stx
	: OP_STX 'M' '[' number ']' {
		bpf_set_curr_instr(BPF_STX, 0, 0, $4); }
	;

jmp
	: OP_JMP label {
		bpf_set_jmp_label($2, JKL);
		bpf_set_curr_instr(BPF_JMP | BPF_JA, 0, 0, 0); }
	;

jeq
	: OP_JEQ '#' number ',' label ',' label {
		bpf_set_jmp_label($5, JTL);
		bpf_set_jmp_label($7, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, $3); }
	| OP_JEQ 'x' ',' label ',' label {
		bpf_set_jmp_label($4, JTL);
		bpf_set_jmp_label($6, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 0); }
	| OP_JEQ '%' 'x' ',' label ',' label {
		bpf_set_jmp_label($5, JTL);
		bpf_set_jmp_label($7, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 0); }
	| OP_JEQ '#' number ',' label {
		bpf_set_jmp_label($5, JTL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, $3); }
	| OP_JEQ 'x' ',' label {
		bpf_set_jmp_label($4, JTL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 0); }
	| OP_JEQ '%' 'x' ',' label {
		bpf_set_jmp_label($5, JTL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 0); }
	;

jneq
	: OP_JNEQ '#' number ',' label {
		bpf_set_jmp_label($5, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_K, 0, 0, $3); }
	| OP_JNEQ 'x' ',' label {
		bpf_set_jmp_label($4, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 0); }
	| OP_JNEQ '%' 'x' ',' label {
		bpf_set_jmp_label($5, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JEQ | BPF_X, 0, 0, 0); }
	;

jlt
	: OP_JLT '#' number ',' label {
		bpf_set_jmp_label($5, JFL);
		bpf_set_curr_instr(BPF_JMP | BPF_JGE | BPF_K, 0, 0, $3); }
	| OP_JLT 'x' ',' label {

Annotation

Implementation Notes