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

Kris Van Hees kris.van.hees at oracle.com
Sun May 3 20:17:08 PDT 2020


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

Orabug: 31220525
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh 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