Fix: timer_expire_entry changed in 4.19.312
[lttng-modules.git] / filter-bytecode.h
1 /* SPDX-License-Identifier: MIT
2 *
3 * filter-bytecode.h
4 *
5 * LTTng filter bytecode
6 *
7 * Copyright 2012-2016 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 */
9
10 #ifndef _FILTER_BYTECODE_H
11 #define _FILTER_BYTECODE_H
12
13 /*
14 * offsets are absolute from start of bytecode.
15 */
16
17 struct field_ref {
18 /* Initially, symbol offset. After link, field offset. */
19 uint16_t offset;
20 } __attribute__((packed));
21
22 struct get_symbol {
23 /* Symbol offset. */
24 uint16_t offset;
25 } __attribute__((packed));
26
27 struct get_index_u16 {
28 uint16_t index;
29 } __attribute__((packed));
30
31 struct get_index_u64 {
32 uint64_t index;
33 } __attribute__((packed));
34
35 struct literal_numeric {
36 int64_t v;
37 } __attribute__((packed));
38
39 struct literal_double {
40 double v;
41 } __attribute__((packed));
42
43 struct literal_string {
44 char string[0];
45 } __attribute__((packed));
46
47 enum filter_op {
48 FILTER_OP_UNKNOWN = 0,
49
50 FILTER_OP_RETURN = 1,
51
52 /* binary */
53 FILTER_OP_MUL = 2,
54 FILTER_OP_DIV = 3,
55 FILTER_OP_MOD = 4,
56 FILTER_OP_PLUS = 5,
57 FILTER_OP_MINUS = 6,
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,
63
64 /* binary comparators */
65 FILTER_OP_EQ = 12,
66 FILTER_OP_NE = 13,
67 FILTER_OP_GT = 14,
68 FILTER_OP_LT = 15,
69 FILTER_OP_GE = 16,
70 FILTER_OP_LE = 17,
71
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,
79
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,
87
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,
95
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,
103
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,
110
111 /* unary */
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,
121
122 /* logical */
123 FILTER_OP_AND = 57,
124 FILTER_OP_OR = 58,
125
126 /* load field ref */
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,
132
133 /* load immediate from operand */
134 FILTER_OP_LOAD_STRING = 64,
135 FILTER_OP_LOAD_S64 = 65,
136 FILTER_OP_LOAD_DOUBLE = 66,
137
138 /* cast */
139 FILTER_OP_CAST_TO_S64 = 67,
140 FILTER_OP_CAST_DOUBLE_TO_S64 = 68,
141 FILTER_OP_CAST_NOP = 69,
142
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,
148
149 /* load userspace field ref */
150 FILTER_OP_LOAD_FIELD_REF_USER_STRING = 74,
151 FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE = 75,
152
153 /*
154 * load immediate star globbing pattern (literal string)
155 * from immediate
156 */
157 FILTER_OP_LOAD_STAR_GLOB_STRING = 76,
158
159 /* globbing pattern binary operator: apply to */
160 FILTER_OP_EQ_STAR_GLOB_STRING = 77,
161 FILTER_OP_NE_STAR_GLOB_STRING = 78,
162
163 /*
164 * Instructions for recursive traversal through composed types.
165 */
166 FILTER_OP_GET_CONTEXT_ROOT = 79,
167 FILTER_OP_GET_APP_CONTEXT_ROOT = 80,
168 FILTER_OP_GET_PAYLOAD_ROOT = 81,
169
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,
174
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,
187
188 FILTER_OP_UNARY_BIT_NOT = 98,
189
190 FILTER_OP_RETURN_S64 = 99,
191
192 NR_FILTER_OPS,
193 };
194
195 typedef uint8_t filter_opcode_t;
196
197 struct load_op {
198 filter_opcode_t op;
199 char data[0];
200 /* data to load. Size known by enum filter_opcode and null-term char. */
201 } __attribute__((packed));
202
203 struct binary_op {
204 filter_opcode_t op;
205 } __attribute__((packed));
206
207 struct unary_op {
208 filter_opcode_t op;
209 } __attribute__((packed));
210
211 /* skip_offset is absolute from start of bytecode */
212 struct logical_op {
213 filter_opcode_t op;
214 uint16_t skip_offset; /* bytecode insn, if skip second test */
215 } __attribute__((packed));
216
217 struct cast_op {
218 filter_opcode_t op;
219 } __attribute__((packed));
220
221 struct return_op {
222 filter_opcode_t op;
223 } __attribute__((packed));
224
225 #endif /* _FILTER_BYTECODE_H */
This page took 0.032377 seconds and 4 git commands to generate.