hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/samples/bpf/bpf_insn.h
....@@ -164,6 +164,16 @@
164164 .off = OFF, \
165165 .imm = 0 })
166166
167
+/* Like BPF_JMP_REG, but with 32-bit wide operands for comparison. */
168
+
169
+#define BPF_JMP32_REG(OP, DST, SRC, OFF) \
170
+ ((struct bpf_insn) { \
171
+ .code = BPF_JMP32 | BPF_OP(OP) | BPF_X, \
172
+ .dst_reg = DST, \
173
+ .src_reg = SRC, \
174
+ .off = OFF, \
175
+ .imm = 0 })
176
+
167177 /* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */
168178
169179 #define BPF_JMP_IMM(OP, DST, IMM, OFF) \
....@@ -174,6 +184,16 @@
174184 .off = OFF, \
175185 .imm = IMM })
176186
187
+/* Like BPF_JMP_IMM, but with 32-bit wide operands for comparison. */
188
+
189
+#define BPF_JMP32_IMM(OP, DST, IMM, OFF) \
190
+ ((struct bpf_insn) { \
191
+ .code = BPF_JMP32 | BPF_OP(OP) | BPF_K, \
192
+ .dst_reg = DST, \
193
+ .src_reg = 0, \
194
+ .off = OFF, \
195
+ .imm = IMM })
196
+
177197 /* Raw code statement block */
178198
179199 #define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM) \