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 #include <lttng/ust-abi.h>
34 #error "LTTNG_PACKED should be defined"
38 * offsets are absolute from start of bytecode.
42 /* Initially, symbol offset. After link, field offset. */
44 } __attribute__((packed
));
51 struct get_index_u16
{
55 struct get_index_u64
{
59 struct literal_numeric
{
61 } __attribute__((packed
));
63 struct literal_double
{
65 } __attribute__((packed
));
67 struct literal_string
{
69 } __attribute__((packed
));
72 BYTECODE_OP_UNKNOWN
= 0,
74 BYTECODE_OP_RETURN
= 1,
81 BYTECODE_OP_MINUS
= 6,
82 BYTECODE_OP_BIT_RSHIFT
= 7,
83 BYTECODE_OP_BIT_LSHIFT
= 8,
84 BYTECODE_OP_BIT_AND
= 9,
85 BYTECODE_OP_BIT_OR
= 10,
86 BYTECODE_OP_BIT_XOR
= 11,
88 /* binary comparators */
96 /* string binary comparator: apply to */
97 BYTECODE_OP_EQ_STRING
= 18,
98 BYTECODE_OP_NE_STRING
= 19,
99 BYTECODE_OP_GT_STRING
= 20,
100 BYTECODE_OP_LT_STRING
= 21,
101 BYTECODE_OP_GE_STRING
= 22,
102 BYTECODE_OP_LE_STRING
= 23,
104 /* s64 binary comparator */
105 BYTECODE_OP_EQ_S64
= 24,
106 BYTECODE_OP_NE_S64
= 25,
107 BYTECODE_OP_GT_S64
= 26,
108 BYTECODE_OP_LT_S64
= 27,
109 BYTECODE_OP_GE_S64
= 28,
110 BYTECODE_OP_LE_S64
= 29,
112 /* double binary comparator */
113 BYTECODE_OP_EQ_DOUBLE
= 30,
114 BYTECODE_OP_NE_DOUBLE
= 31,
115 BYTECODE_OP_GT_DOUBLE
= 32,
116 BYTECODE_OP_LT_DOUBLE
= 33,
117 BYTECODE_OP_GE_DOUBLE
= 34,
118 BYTECODE_OP_LE_DOUBLE
= 35,
120 /* Mixed S64-double binary comparators */
121 BYTECODE_OP_EQ_DOUBLE_S64
= 36,
122 BYTECODE_OP_NE_DOUBLE_S64
= 37,
123 BYTECODE_OP_GT_DOUBLE_S64
= 38,
124 BYTECODE_OP_LT_DOUBLE_S64
= 39,
125 BYTECODE_OP_GE_DOUBLE_S64
= 40,
126 BYTECODE_OP_LE_DOUBLE_S64
= 41,
128 BYTECODE_OP_EQ_S64_DOUBLE
= 42,
129 BYTECODE_OP_NE_S64_DOUBLE
= 43,
130 BYTECODE_OP_GT_S64_DOUBLE
= 44,
131 BYTECODE_OP_LT_S64_DOUBLE
= 45,
132 BYTECODE_OP_GE_S64_DOUBLE
= 46,
133 BYTECODE_OP_LE_S64_DOUBLE
= 47,
136 BYTECODE_OP_UNARY_PLUS
= 48,
137 BYTECODE_OP_UNARY_MINUS
= 49,
138 BYTECODE_OP_UNARY_NOT
= 50,
139 BYTECODE_OP_UNARY_PLUS_S64
= 51,
140 BYTECODE_OP_UNARY_MINUS_S64
= 52,
141 BYTECODE_OP_UNARY_NOT_S64
= 53,
142 BYTECODE_OP_UNARY_PLUS_DOUBLE
= 54,
143 BYTECODE_OP_UNARY_MINUS_DOUBLE
= 55,
144 BYTECODE_OP_UNARY_NOT_DOUBLE
= 56,
147 BYTECODE_OP_AND
= 57,
151 BYTECODE_OP_LOAD_FIELD_REF
= 59,
152 BYTECODE_OP_LOAD_FIELD_REF_STRING
= 60,
153 BYTECODE_OP_LOAD_FIELD_REF_SEQUENCE
= 61,
154 BYTECODE_OP_LOAD_FIELD_REF_S64
= 62,
155 BYTECODE_OP_LOAD_FIELD_REF_DOUBLE
= 63,
157 /* load immediate from operand */
158 BYTECODE_OP_LOAD_STRING
= 64,
159 BYTECODE_OP_LOAD_S64
= 65,
160 BYTECODE_OP_LOAD_DOUBLE
= 66,
163 BYTECODE_OP_CAST_TO_S64
= 67,
164 BYTECODE_OP_CAST_DOUBLE_TO_S64
= 68,
165 BYTECODE_OP_CAST_NOP
= 69,
167 /* get context ref */
168 BYTECODE_OP_GET_CONTEXT_REF
= 70,
169 BYTECODE_OP_GET_CONTEXT_REF_STRING
= 71,
170 BYTECODE_OP_GET_CONTEXT_REF_S64
= 72,
171 BYTECODE_OP_GET_CONTEXT_REF_DOUBLE
= 73,
173 /* load userspace field ref */
174 BYTECODE_OP_LOAD_FIELD_REF_USER_STRING
= 74,
175 BYTECODE_OP_LOAD_FIELD_REF_USER_SEQUENCE
= 75,
178 * load immediate star globbing pattern (literal string)
181 BYTECODE_OP_LOAD_STAR_GLOB_STRING
= 76,
183 /* globbing pattern binary operator: apply to */
184 BYTECODE_OP_EQ_STAR_GLOB_STRING
= 77,
185 BYTECODE_OP_NE_STAR_GLOB_STRING
= 78,
188 * Instructions for recursive traversal through composed types.
190 BYTECODE_OP_GET_CONTEXT_ROOT
= 79,
191 BYTECODE_OP_GET_APP_CONTEXT_ROOT
= 80,
192 BYTECODE_OP_GET_PAYLOAD_ROOT
= 81,
194 BYTECODE_OP_GET_SYMBOL
= 82,
195 BYTECODE_OP_GET_SYMBOL_FIELD
= 83,
196 BYTECODE_OP_GET_INDEX_U16
= 84,
197 BYTECODE_OP_GET_INDEX_U64
= 85,
199 BYTECODE_OP_LOAD_FIELD
= 86,
200 BYTECODE_OP_LOAD_FIELD_S8
= 87,
201 BYTECODE_OP_LOAD_FIELD_S16
= 88,
202 BYTECODE_OP_LOAD_FIELD_S32
= 89,
203 BYTECODE_OP_LOAD_FIELD_S64
= 90,
204 BYTECODE_OP_LOAD_FIELD_U8
= 91,
205 BYTECODE_OP_LOAD_FIELD_U16
= 92,
206 BYTECODE_OP_LOAD_FIELD_U32
= 93,
207 BYTECODE_OP_LOAD_FIELD_U64
= 94,
208 BYTECODE_OP_LOAD_FIELD_STRING
= 95,
209 BYTECODE_OP_LOAD_FIELD_SEQUENCE
= 96,
210 BYTECODE_OP_LOAD_FIELD_DOUBLE
= 97,
212 BYTECODE_OP_UNARY_BIT_NOT
= 98,
214 BYTECODE_OP_RETURN_S64
= 99,
219 typedef uint8_t bytecode_opcode_t
;
222 bytecode_opcode_t op
;
224 * data to load. Size known by enum bytecode_opcode and null-term char.
227 } __attribute__((packed
));
230 bytecode_opcode_t op
;
231 } __attribute__((packed
));
234 bytecode_opcode_t op
;
235 } __attribute__((packed
));
237 /* skip_offset is absolute from start of bytecode */
239 bytecode_opcode_t op
;
240 uint16_t skip_offset
; /* bytecode insn, if skip second test */
241 } __attribute__((packed
));
244 bytecode_opcode_t op
;
245 } __attribute__((packed
));
248 bytecode_opcode_t op
;
249 } __attribute__((packed
));
251 #endif /* _BYTECODE_H */