1 #ifndef _FILTER_BYTECODE_H
2 #define _FILTER_BYTECODE_H
7 * LTTng filter bytecode
9 * Copyright 2012-2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 #include <lttng/ust-abi.h>
33 #error "LTTNG_PACKED should be defined"
37 * offsets are absolute from start of bytecode.
41 /* Initially, symbol offset. After link, field offset. */
43 } __attribute__((packed
));
50 struct get_index_u16
{
54 struct get_index_u64
{
58 struct literal_numeric
{
60 } __attribute__((packed
));
62 struct literal_double
{
64 } __attribute__((packed
));
66 struct literal_string
{
68 } __attribute__((packed
));
71 FILTER_OP_UNKNOWN
= 0,
81 FILTER_OP_BIT_RSHIFT
= 7,
82 FILTER_OP_BIT_LSHIFT
= 8,
83 FILTER_OP_BIT_AND
= 9,
84 FILTER_OP_BIT_OR
= 10,
85 FILTER_OP_BIT_XOR
= 11,
87 /* binary comparators */
95 /* string binary comparator: apply to */
96 FILTER_OP_EQ_STRING
= 18,
97 FILTER_OP_NE_STRING
= 19,
98 FILTER_OP_GT_STRING
= 20,
99 FILTER_OP_LT_STRING
= 21,
100 FILTER_OP_GE_STRING
= 22,
101 FILTER_OP_LE_STRING
= 23,
103 /* s64 binary comparator */
104 FILTER_OP_EQ_S64
= 24,
105 FILTER_OP_NE_S64
= 25,
106 FILTER_OP_GT_S64
= 26,
107 FILTER_OP_LT_S64
= 27,
108 FILTER_OP_GE_S64
= 28,
109 FILTER_OP_LE_S64
= 29,
111 /* double binary comparator */
112 FILTER_OP_EQ_DOUBLE
= 30,
113 FILTER_OP_NE_DOUBLE
= 31,
114 FILTER_OP_GT_DOUBLE
= 32,
115 FILTER_OP_LT_DOUBLE
= 33,
116 FILTER_OP_GE_DOUBLE
= 34,
117 FILTER_OP_LE_DOUBLE
= 35,
119 /* Mixed S64-double binary comparators */
120 FILTER_OP_EQ_DOUBLE_S64
= 36,
121 FILTER_OP_NE_DOUBLE_S64
= 37,
122 FILTER_OP_GT_DOUBLE_S64
= 38,
123 FILTER_OP_LT_DOUBLE_S64
= 39,
124 FILTER_OP_GE_DOUBLE_S64
= 40,
125 FILTER_OP_LE_DOUBLE_S64
= 41,
127 FILTER_OP_EQ_S64_DOUBLE
= 42,
128 FILTER_OP_NE_S64_DOUBLE
= 43,
129 FILTER_OP_GT_S64_DOUBLE
= 44,
130 FILTER_OP_LT_S64_DOUBLE
= 45,
131 FILTER_OP_GE_S64_DOUBLE
= 46,
132 FILTER_OP_LE_S64_DOUBLE
= 47,
135 FILTER_OP_UNARY_PLUS
= 48,
136 FILTER_OP_UNARY_MINUS
= 49,
137 FILTER_OP_UNARY_NOT
= 50,
138 FILTER_OP_UNARY_PLUS_S64
= 51,
139 FILTER_OP_UNARY_MINUS_S64
= 52,
140 FILTER_OP_UNARY_NOT_S64
= 53,
141 FILTER_OP_UNARY_PLUS_DOUBLE
= 54,
142 FILTER_OP_UNARY_MINUS_DOUBLE
= 55,
143 FILTER_OP_UNARY_NOT_DOUBLE
= 56,
150 FILTER_OP_LOAD_FIELD_REF
= 59,
151 FILTER_OP_LOAD_FIELD_REF_STRING
= 60,
152 FILTER_OP_LOAD_FIELD_REF_SEQUENCE
= 61,
153 FILTER_OP_LOAD_FIELD_REF_S64
= 62,
154 FILTER_OP_LOAD_FIELD_REF_DOUBLE
= 63,
156 /* load immediate from operand */
157 FILTER_OP_LOAD_STRING
= 64,
158 FILTER_OP_LOAD_S64
= 65,
159 FILTER_OP_LOAD_DOUBLE
= 66,
162 FILTER_OP_CAST_TO_S64
= 67,
163 FILTER_OP_CAST_DOUBLE_TO_S64
= 68,
164 FILTER_OP_CAST_NOP
= 69,
166 /* get context ref */
167 FILTER_OP_GET_CONTEXT_REF
= 70,
168 FILTER_OP_GET_CONTEXT_REF_STRING
= 71,
169 FILTER_OP_GET_CONTEXT_REF_S64
= 72,
170 FILTER_OP_GET_CONTEXT_REF_DOUBLE
= 73,
172 /* load userspace field ref */
173 FILTER_OP_LOAD_FIELD_REF_USER_STRING
= 74,
174 FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE
= 75,
177 * load immediate star globbing pattern (literal string)
180 FILTER_OP_LOAD_STAR_GLOB_STRING
= 76,
182 /* globbing pattern binary operator: apply to */
183 FILTER_OP_EQ_STAR_GLOB_STRING
= 77,
184 FILTER_OP_NE_STAR_GLOB_STRING
= 78,
187 * Instructions for recursive traversal through composed types.
189 FILTER_OP_GET_CONTEXT_ROOT
= 79,
190 FILTER_OP_GET_APP_CONTEXT_ROOT
= 80,
191 FILTER_OP_GET_PAYLOAD_ROOT
= 81,
193 FILTER_OP_GET_SYMBOL
= 82,
194 FILTER_OP_GET_SYMBOL_FIELD
= 83,
195 FILTER_OP_GET_INDEX_U16
= 84,
196 FILTER_OP_GET_INDEX_U64
= 85,
198 FILTER_OP_LOAD_FIELD
= 86,
199 FILTER_OP_LOAD_FIELD_S8
= 87,
200 FILTER_OP_LOAD_FIELD_S16
= 88,
201 FILTER_OP_LOAD_FIELD_S32
= 89,
202 FILTER_OP_LOAD_FIELD_S64
= 90,
203 FILTER_OP_LOAD_FIELD_U8
= 91,
204 FILTER_OP_LOAD_FIELD_U16
= 92,
205 FILTER_OP_LOAD_FIELD_U32
= 93,
206 FILTER_OP_LOAD_FIELD_U64
= 94,
207 FILTER_OP_LOAD_FIELD_STRING
= 95,
208 FILTER_OP_LOAD_FIELD_SEQUENCE
= 96,
209 FILTER_OP_LOAD_FIELD_DOUBLE
= 97,
211 FILTER_OP_UNARY_BIT_NOT
= 98,
213 FILTER_OP_RETURN_S64
= 99,
218 typedef uint8_t filter_opcode_t
;
223 /* data to load. Size known by enum filter_opcode and null-term char. */
224 } __attribute__((packed
));
228 } __attribute__((packed
));
232 } __attribute__((packed
));
234 /* skip_offset is absolute from start of bytecode */
237 uint16_t skip_offset
; /* bytecode insn, if skip second test */
238 } __attribute__((packed
));
242 } __attribute__((packed
));
246 } __attribute__((packed
));
248 #endif /* _FILTER_BYTECODE_H */