1 /* SPDX-License-Identifier: MIT
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
));
44 FILTER_OP_UNKNOWN
= 0,
54 FILTER_OP_BIT_RSHIFT
= 7,
55 FILTER_OP_BIT_LSHIFT
= 8,
56 FILTER_OP_BIT_AND
= 9,
57 FILTER_OP_BIT_OR
= 10,
58 FILTER_OP_BIT_XOR
= 11,
60 /* binary comparators */
68 /* string binary comparator: apply to */
69 FILTER_OP_EQ_STRING
= 18,
70 FILTER_OP_NE_STRING
= 19,
71 FILTER_OP_GT_STRING
= 20,
72 FILTER_OP_LT_STRING
= 21,
73 FILTER_OP_GE_STRING
= 22,
74 FILTER_OP_LE_STRING
= 23,
76 /* s64 binary comparator */
77 FILTER_OP_EQ_S64
= 24,
78 FILTER_OP_NE_S64
= 25,
79 FILTER_OP_GT_S64
= 26,
80 FILTER_OP_LT_S64
= 27,
81 FILTER_OP_GE_S64
= 28,
82 FILTER_OP_LE_S64
= 29,
84 /* double binary comparator */
85 FILTER_OP_EQ_DOUBLE
= 30,
86 FILTER_OP_NE_DOUBLE
= 31,
87 FILTER_OP_GT_DOUBLE
= 32,
88 FILTER_OP_LT_DOUBLE
= 33,
89 FILTER_OP_GE_DOUBLE
= 34,
90 FILTER_OP_LE_DOUBLE
= 35,
92 /* Mixed S64-double binary comparators */
93 FILTER_OP_EQ_DOUBLE_S64
= 36,
94 FILTER_OP_NE_DOUBLE_S64
= 37,
95 FILTER_OP_GT_DOUBLE_S64
= 38,
96 FILTER_OP_LT_DOUBLE_S64
= 39,
97 FILTER_OP_GE_DOUBLE_S64
= 40,
98 FILTER_OP_LE_DOUBLE_S64
= 41,
100 FILTER_OP_EQ_S64_DOUBLE
= 42,
101 FILTER_OP_NE_S64_DOUBLE
= 43,
102 FILTER_OP_GT_S64_DOUBLE
= 44,
103 FILTER_OP_LT_S64_DOUBLE
= 45,
104 FILTER_OP_GE_S64_DOUBLE
= 46,
105 FILTER_OP_LE_S64_DOUBLE
= 47,
108 FILTER_OP_UNARY_PLUS
= 48,
109 FILTER_OP_UNARY_MINUS
= 49,
110 FILTER_OP_UNARY_NOT
= 50,
111 FILTER_OP_UNARY_PLUS_S64
= 51,
112 FILTER_OP_UNARY_MINUS_S64
= 52,
113 FILTER_OP_UNARY_NOT_S64
= 53,
114 FILTER_OP_UNARY_PLUS_DOUBLE
= 54,
115 FILTER_OP_UNARY_MINUS_DOUBLE
= 55,
116 FILTER_OP_UNARY_NOT_DOUBLE
= 56,
123 FILTER_OP_LOAD_FIELD_REF
= 59,
124 FILTER_OP_LOAD_FIELD_REF_STRING
= 60,
125 FILTER_OP_LOAD_FIELD_REF_SEQUENCE
= 61,
126 FILTER_OP_LOAD_FIELD_REF_S64
= 62,
127 FILTER_OP_LOAD_FIELD_REF_DOUBLE
= 63,
129 /* load immediate from operand */
130 FILTER_OP_LOAD_STRING
= 64,
131 FILTER_OP_LOAD_S64
= 65,
132 FILTER_OP_LOAD_DOUBLE
= 66,
135 FILTER_OP_CAST_TO_S64
= 67,
136 FILTER_OP_CAST_DOUBLE_TO_S64
= 68,
137 FILTER_OP_CAST_NOP
= 69,
139 /* get context ref */
140 FILTER_OP_GET_CONTEXT_REF
= 70,
141 FILTER_OP_GET_CONTEXT_REF_STRING
= 71,
142 FILTER_OP_GET_CONTEXT_REF_S64
= 72,
143 FILTER_OP_GET_CONTEXT_REF_DOUBLE
= 73,
145 /* load userspace field ref */
146 FILTER_OP_LOAD_FIELD_REF_USER_STRING
= 74,
147 FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE
= 75,
150 * load immediate star globbing pattern (literal string)
153 FILTER_OP_LOAD_STAR_GLOB_STRING
= 76,
155 /* globbing pattern binary operator: apply to */
156 FILTER_OP_EQ_STAR_GLOB_STRING
= 77,
157 FILTER_OP_NE_STAR_GLOB_STRING
= 78,
160 * Instructions for recursive traversal through composed types.
162 FILTER_OP_GET_CONTEXT_ROOT
= 79,
163 FILTER_OP_GET_APP_CONTEXT_ROOT
= 80,
164 FILTER_OP_GET_PAYLOAD_ROOT
= 81,
166 FILTER_OP_GET_SYMBOL
= 82,
167 FILTER_OP_GET_SYMBOL_FIELD
= 83,
168 FILTER_OP_GET_INDEX_U16
= 84,
169 FILTER_OP_GET_INDEX_U64
= 85,
171 FILTER_OP_LOAD_FIELD
= 86,
172 FILTER_OP_LOAD_FIELD_S8
= 87,
173 FILTER_OP_LOAD_FIELD_S16
= 88,
174 FILTER_OP_LOAD_FIELD_S32
= 89,
175 FILTER_OP_LOAD_FIELD_S64
= 90,
176 FILTER_OP_LOAD_FIELD_U8
= 91,
177 FILTER_OP_LOAD_FIELD_U16
= 92,
178 FILTER_OP_LOAD_FIELD_U32
= 93,
179 FILTER_OP_LOAD_FIELD_U64
= 94,
180 FILTER_OP_LOAD_FIELD_STRING
= 95,
181 FILTER_OP_LOAD_FIELD_SEQUENCE
= 96,
182 FILTER_OP_LOAD_FIELD_DOUBLE
= 97,
184 FILTER_OP_UNARY_BIT_NOT
= 98,
186 FILTER_OP_RETURN_S64
= 99,
191 typedef uint8_t filter_opcode_t
;
196 /* data to load. Size known by enum filter_opcode and null-term char. */
197 } __attribute__((packed
));
201 } __attribute__((packed
));
205 } __attribute__((packed
));
207 /* skip_offset is absolute from start of bytecode */
210 uint16_t skip_offset
; /* bytecode insn, if skip second test */
211 } __attribute__((packed
));
215 } __attribute__((packed
));
219 } __attribute__((packed
));
221 #endif /* _FILTER_BYTECODE_H */