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
31 * offsets are absolute from start of bytecode.
35 /* Initially, symbol offset. After link, field offset. */
37 } __attribute__((packed
));
39 struct literal_numeric
{
41 } __attribute__((packed
));
43 struct literal_double
{
45 } __attribute__((packed
));
47 struct literal_string
{
49 } __attribute__((packed
));
52 FILTER_OP_UNKNOWN
= 0,
64 FILTER_OP_BIN_AND
= 9,
65 FILTER_OP_BIN_OR
= 10,
66 FILTER_OP_BIN_XOR
= 11,
68 /* binary comparators */
76 /* string binary comparator: apply to */
77 FILTER_OP_EQ_STRING
= 18,
78 FILTER_OP_NE_STRING
= 19,
79 FILTER_OP_GT_STRING
= 20,
80 FILTER_OP_LT_STRING
= 21,
81 FILTER_OP_GE_STRING
= 22,
82 FILTER_OP_LE_STRING
= 23,
84 /* s64 binary comparator */
85 FILTER_OP_EQ_S64
= 24,
86 FILTER_OP_NE_S64
= 25,
87 FILTER_OP_GT_S64
= 26,
88 FILTER_OP_LT_S64
= 27,
89 FILTER_OP_GE_S64
= 28,
90 FILTER_OP_LE_S64
= 29,
92 /* double binary comparator */
93 FILTER_OP_EQ_DOUBLE
= 30,
94 FILTER_OP_NE_DOUBLE
= 31,
95 FILTER_OP_GT_DOUBLE
= 32,
96 FILTER_OP_LT_DOUBLE
= 33,
97 FILTER_OP_GE_DOUBLE
= 34,
98 FILTER_OP_LE_DOUBLE
= 35,
100 /* Mixed S64-double binary comparators */
101 FILTER_OP_EQ_DOUBLE_S64
= 36,
102 FILTER_OP_NE_DOUBLE_S64
= 37,
103 FILTER_OP_GT_DOUBLE_S64
= 38,
104 FILTER_OP_LT_DOUBLE_S64
= 39,
105 FILTER_OP_GE_DOUBLE_S64
= 40,
106 FILTER_OP_LE_DOUBLE_S64
= 41,
108 FILTER_OP_EQ_S64_DOUBLE
= 42,
109 FILTER_OP_NE_S64_DOUBLE
= 43,
110 FILTER_OP_GT_S64_DOUBLE
= 44,
111 FILTER_OP_LT_S64_DOUBLE
= 45,
112 FILTER_OP_GE_S64_DOUBLE
= 46,
113 FILTER_OP_LE_S64_DOUBLE
= 47,
116 FILTER_OP_UNARY_PLUS
= 48,
117 FILTER_OP_UNARY_MINUS
= 49,
118 FILTER_OP_UNARY_NOT
= 50,
119 FILTER_OP_UNARY_PLUS_S64
= 51,
120 FILTER_OP_UNARY_MINUS_S64
= 52,
121 FILTER_OP_UNARY_NOT_S64
= 53,
122 FILTER_OP_UNARY_PLUS_DOUBLE
= 54,
123 FILTER_OP_UNARY_MINUS_DOUBLE
= 55,
124 FILTER_OP_UNARY_NOT_DOUBLE
= 56,
131 FILTER_OP_LOAD_FIELD_REF
= 59,
132 FILTER_OP_LOAD_FIELD_REF_STRING
= 60,
133 FILTER_OP_LOAD_FIELD_REF_SEQUENCE
= 61,
134 FILTER_OP_LOAD_FIELD_REF_S64
= 62,
135 FILTER_OP_LOAD_FIELD_REF_DOUBLE
= 63,
137 /* load immediate from operand */
138 FILTER_OP_LOAD_STRING
= 64,
139 FILTER_OP_LOAD_S64
= 65,
140 FILTER_OP_LOAD_DOUBLE
= 66,
143 FILTER_OP_CAST_TO_S64
= 67,
144 FILTER_OP_CAST_DOUBLE_TO_S64
= 68,
145 FILTER_OP_CAST_NOP
= 69,
147 /* get context ref */
148 FILTER_OP_GET_CONTEXT_REF
= 70,
149 FILTER_OP_GET_CONTEXT_REF_STRING
= 71,
150 FILTER_OP_GET_CONTEXT_REF_S64
= 72,
151 FILTER_OP_GET_CONTEXT_REF_DOUBLE
= 73,
153 /* load userspace field ref */
154 FILTER_OP_LOAD_FIELD_REF_USER_STRING
= 74,
155 FILTER_OP_LOAD_FIELD_REF_USER_SEQUENCE
= 75,
158 * load immediate star globbing pattern (literal string)
161 FILTER_OP_LOAD_STAR_GLOB_STRING
= 76,
163 /* globbing pattern binary operator: apply to */
164 FILTER_OP_EQ_STAR_GLOB_STRING
= 77,
165 FILTER_OP_NE_STAR_GLOB_STRING
= 78,
170 typedef uint8_t filter_opcode_t
;
175 /* data to load. Size known by enum filter_opcode and null-term char. */
176 } __attribute__((packed
));
180 } __attribute__((packed
));
184 } __attribute__((packed
));
186 /* skip_offset is absolute from start of bytecode */
189 uint16_t skip_offset
; /* bytecode insn, if skip second test */
190 } __attribute__((packed
));
194 } __attribute__((packed
));
198 } __attribute__((packed
));
200 #endif /* _FILTER_BYTECODE_H */