1 #ifndef _FILTER_BYTECODE_H
2 #define _FILTER_BYTECODE_H
7 * LTTng filter bytecode
9 * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * This library is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License, version 2.1 only,
13 * as published by the Free Software Foundation.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "filter-ast.h"
26 #include "../../common/sessiond-comm/sessiond-comm.h"
29 * offsets are absolute from start of bytecode.
33 /* Initially, symbol offset. After link, field offset. */
35 } __attribute__((packed
));
37 struct literal_numeric
{
39 } __attribute__((packed
));
41 struct literal_double
{
43 } __attribute__((packed
));
45 struct literal_string
{
47 } __attribute__((packed
));
50 FILTER_OP_UNKNOWN
= 0,
66 /* binary comparators */
74 /* string binary comparator */
82 /* s64 binary comparator */
90 /* double binary comparator */
98 /* Mixed S64-double binary comparators */
99 FILTER_OP_EQ_DOUBLE_S64
,
100 FILTER_OP_NE_DOUBLE_S64
,
101 FILTER_OP_GT_DOUBLE_S64
,
102 FILTER_OP_LT_DOUBLE_S64
,
103 FILTER_OP_GE_DOUBLE_S64
,
104 FILTER_OP_LE_DOUBLE_S64
,
106 FILTER_OP_EQ_S64_DOUBLE
,
107 FILTER_OP_NE_S64_DOUBLE
,
108 FILTER_OP_GT_S64_DOUBLE
,
109 FILTER_OP_LT_S64_DOUBLE
,
110 FILTER_OP_GE_S64_DOUBLE
,
111 FILTER_OP_LE_S64_DOUBLE
,
114 FILTER_OP_UNARY_PLUS
,
115 FILTER_OP_UNARY_MINUS
,
117 FILTER_OP_UNARY_PLUS_S64
,
118 FILTER_OP_UNARY_MINUS_S64
,
119 FILTER_OP_UNARY_NOT_S64
,
120 FILTER_OP_UNARY_PLUS_DOUBLE
,
121 FILTER_OP_UNARY_MINUS_DOUBLE
,
122 FILTER_OP_UNARY_NOT_DOUBLE
,
129 FILTER_OP_LOAD_FIELD_REF
,
130 FILTER_OP_LOAD_FIELD_REF_STRING
,
131 FILTER_OP_LOAD_FIELD_REF_SEQUENCE
,
132 FILTER_OP_LOAD_FIELD_REF_S64
,
133 FILTER_OP_LOAD_FIELD_REF_DOUBLE
,
135 FILTER_OP_LOAD_STRING
,
137 FILTER_OP_LOAD_DOUBLE
,
140 FILTER_OP_CAST_TO_S64
,
141 FILTER_OP_CAST_DOUBLE_TO_S64
,
147 typedef uint8_t filter_opcode_t
;
152 /* data to load. Size known by enum filter_opcode and null-term char. */
153 } __attribute__((packed
));
157 } __attribute__((packed
));
161 } __attribute__((packed
));
163 /* skip_offset is absolute from start of bytecode */
166 uint16_t skip_offset
; /* bytecode insn, if skip second test */
167 } __attribute__((packed
));
171 } __attribute__((packed
));
175 } __attribute__((packed
));
177 struct lttng_filter_bytecode_alloc
{
179 struct lttng_filter_bytecode b
;
183 unsigned int bytecode_get_len(struct lttng_filter_bytecode
*bytecode
)
185 return bytecode
->len
;
188 #endif /* _FILTER_BYTECODE_H */