1 /* SPDX-License-Identifier: MIT
3 * lttng/filter-bytecode.h
5 * LTTng filter bytecode
7 * Copyright 2012-2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 #ifndef _FILTER_BYTECODE_H
11 #define _FILTER_BYTECODE_H
14 * offsets are absolute from start of bytecode.
18 /* Initially, symbol offset. After link, field offset. */
20 } __attribute__((packed
));
25 } __attribute__((packed
));
27 struct get_index_u16
{
29 } __attribute__((packed
));
31 struct get_index_u64
{
33 } __attribute__((packed
));
35 struct literal_numeric
{
37 } __attribute__((packed
));
39 struct literal_double
{
41 } __attribute__((packed
));
43 struct literal_string
{
45 } __attribute__((packed
));
48 FILTER_OP_UNKNOWN
= 0,
58 FILTER_OP_BIT_RSHIFT
= 7,
59 FILTER_OP_BIT_LSHIFT
= 8,
60 FILTER_OP_BIT_AND
= 9,
61 FILTER_OP_BIT_OR
= 10,
62 FILTER_OP_BIT_XOR
= 11,
64 /* binary comparators */
72 /* string binary comparator: apply to */
73 FILTER_OP_EQ_STRING
= 18,
74 FILTER_OP_NE_STRING
= 19,
75 FILTER_OP_GT_STRING
= 20,
76 FILTER_OP_LT_STRING
= 21,
77 FILTER_OP_GE_STRING
= 22,
78 FILTER_OP_LE_STRING
= 23,
80 /* s64 binary comparator */
81 FILTER_OP_EQ_S64
= 24,
82 FILTER_OP_NE_S64
= 25,
83 FILTER_OP_GT_S64
= 26,
84 FILTER_OP_LT_S64
= 27,
85 FILTER_OP_GE_S64
= 28,
86 FILTER_OP_LE_S64
= 29,
88 /* double binary comparator */
89 FILTER_OP_EQ_DOUBLE
= 30,
90 FILTER_OP_NE_DOUBLE
= 31,
91 FILTER_OP_GT_DOUBLE
= 32,
92 FILTER_OP_LT_DOUBLE
= 33,
93 FILTER_OP_GE_DOUBLE
= 34,
94 FILTER_OP_LE_DOUBLE
= 35,
96 /* Mixed S64-double binary comparators */
97 FILTER_OP_EQ_DOUBLE_S64
= 36,
98 FILTER_OP_NE_DOUBLE_S64
= 37,
99 FILTER_OP_GT_DOUBLE_S64
= 38,
100 FILTER_OP_LT_DOUBLE_S64
= 39,
101 FILTER_OP_GE_DOUBLE_S64
= 40,
102 FILTER_OP_LE_DOUBLE_S64
= 41,
104 FILTER_OP_EQ_S64_DOUBLE
= 42,
105 FILTER_OP_NE_S64_DOUBLE
= 43,
106 FILTER_OP_GT_S64_DOUBLE
= 44,
107 FILTER_OP_LT_S64_DOUBLE
= 45,
108 FILTER_OP_GE_S64_DOUBLE
= 46,
109 FILTER_OP_LE_S64_DOUBLE
= 47,
112 FILTER_OP_UNARY_PLUS
= 48,
113 FILTER_OP_UNARY_MINUS
= 49,
114 FILTER_OP_UNARY_NOT
= 50,
115 FILTER_OP_UNARY_PLUS_S64
= 51,
116 FILTER_OP_UNARY_MINUS_S64
= 52,
117 FILTER_OP_UNARY_NOT_S64
= 53,
118 FILTER_OP_UNARY_PLUS_DOUBLE
= 54,
119 FILTER_OP_UNARY_MINUS_DOUBLE
= 55,
120 FILTER_OP_UNARY_NOT_DOUBLE
= 56,
127 FILTER_OP_LOAD_FIELD_REF
= 59,
128 FILTER_OP_LOAD_FIELD_REF_STRING
= 60,
129 FILTER_OP_LOAD_FIELD_REF_SEQUENCE
= 61,
130 FILTER_OP_LOAD_FIELD_REF_S64
= 62,
131 FILTER_OP_LOAD_FIELD_REF_DOUBLE
= 63,
133 /* load immediate from operand */
134 FILTER_OP_LOAD_STRING
= 64,
135 FILTER_OP_LOAD_S64
= 65,
136 FILTER_OP_LOAD_DOUBLE
= 66,
139 FILTER_OP_CAST_TO_S64
= 67,
140 FILTER_OP_CAST_DOUBLE_TO_S64
= 68,
141 FILTER_OP_CAST_NOP
= 69,
143 /* get context ref */
144 FILTER_OP_GET_CONTEXT_REF
= 70,
145 FILTER_OP_GET_CONTEXT_REF_STRING
= 71,
146 FILTER_OP_GET_CONTEXT_REF_S64
= 72,
147 FILTER_OP_GET_CONTEXT_REF_DOUBLE
= 73,
149 /* load userspace field ref */
150 FILTER_OP_LOAD_FIELD_REF_USER_STRING
= 74,
151 FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE
= 75,
154 * load immediate star globbing pattern (literal string)
157 FILTER_OP_LOAD_STAR_GLOB_STRING
= 76,
159 /* globbing pattern binary operator: apply to */
160 FILTER_OP_EQ_STAR_GLOB_STRING
= 77,
161 FILTER_OP_NE_STAR_GLOB_STRING
= 78,
164 * Instructions for recursive traversal through composed types.
166 FILTER_OP_GET_CONTEXT_ROOT
= 79,
167 FILTER_OP_GET_APP_CONTEXT_ROOT
= 80,
168 FILTER_OP_GET_PAYLOAD_ROOT
= 81,
170 FILTER_OP_GET_SYMBOL
= 82,
171 FILTER_OP_GET_SYMBOL_FIELD
= 83,
172 FILTER_OP_GET_INDEX_U16
= 84,
173 FILTER_OP_GET_INDEX_U64
= 85,
175 FILTER_OP_LOAD_FIELD
= 86,
176 FILTER_OP_LOAD_FIELD_S8
= 87,
177 FILTER_OP_LOAD_FIELD_S16
= 88,
178 FILTER_OP_LOAD_FIELD_S32
= 89,
179 FILTER_OP_LOAD_FIELD_S64
= 90,
180 FILTER_OP_LOAD_FIELD_U8
= 91,
181 FILTER_OP_LOAD_FIELD_U16
= 92,
182 FILTER_OP_LOAD_FIELD_U32
= 93,
183 FILTER_OP_LOAD_FIELD_U64
= 94,
184 FILTER_OP_LOAD_FIELD_STRING
= 95,
185 FILTER_OP_LOAD_FIELD_SEQUENCE
= 96,
186 FILTER_OP_LOAD_FIELD_DOUBLE
= 97,
188 FILTER_OP_UNARY_BIT_NOT
= 98,
190 FILTER_OP_RETURN_S64
= 99,
195 typedef uint8_t filter_opcode_t
;
200 /* data to load. Size known by enum filter_opcode and null-term char. */
201 } __attribute__((packed
));
205 } __attribute__((packed
));
209 } __attribute__((packed
));
211 /* skip_offset is absolute from start of bytecode */
214 uint16_t skip_offset
; /* bytecode insn, if skip second test */
215 } __attribute__((packed
));
219 } __attribute__((packed
));
223 } __attribute__((packed
));
225 #endif /* _FILTER_BYTECODE_H */