[DTrace-devel] [PATCH] Add BPF_IS_CALL(x) macro

Kris Van Hees kris.van.hees at oracle.com
Wed Apr 8 08:00:20 PDT 2020


Adding a BPF_IS_CALL(x) macro to conveniently determine whether a BPF
instruction is a function call.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 include/bpf_asm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/bpf_asm.h b/include/bpf_asm.h
index d3f95d55..7891a597 100644
--- a/include/bpf_asm.h
+++ b/include/bpf_asm.h
@@ -144,7 +144,9 @@
 
 #define BPF_NOP()	BPF_JUMP(0)
 
+#define BPF_IS_CALL(x)	((x).code == (BPF_JMP | BPF_CALL))
 #define BPF_IS_NOP(x)	((x).code == (BPF_JMP | BPF_JA) && (x).off == 0)
+
 #define BPF_EQUAL(x, y)	((x).code == (y).code &&			\
 			 (x).dst_reg == (y).dst_reg &&			\
 			 (x).src_reg == (y).src_reg &&			\
-- 
2.26.0




More information about the DTrace-devel mailing list