fc2d6c8d4c5cf78f8e9965673040b112c6d5bbc8
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"
28 * offsets are absolute from start of bytecode.
31 enum filter_register
{
38 FIELD_REF_UNKNOWN
= 0,
45 /* Initially, symbol offset. After link, field offset. */
47 uint8_t type
; /* enum field_ref_type */
48 } __attribute__((packed
));
50 struct literal_numeric
{
52 } __attribute__((packed
));
54 struct literal_string
{
56 } __attribute__((packed
));
59 FILTER_OP_UNKNOWN
= 0,
83 FILTER_OP_UNARY_MINUS
,
91 FILTER_OP_LOAD_FIELD_REF
,
92 FILTER_OP_LOAD_STRING
,
98 typedef uint8_t filter_opcode_t
;
102 uint8_t reg
; /* enum filter_register */
104 /* data to load. Size known by enum filter_opcode and null-term char. */
105 } __attribute__((packed
));
109 } __attribute__((packed
));
113 uint8_t reg
; /* enum filter_register */
114 } __attribute__((packed
));
116 /* skip_offset is absolute from start of bytecode */
119 uint16_t skip_offset
; /* bytecode insn, if skip second test */
120 } __attribute__((packed
));
124 } __attribute__((packed
));
127 * The reloc table is located at the end of the bytecode. It is made of
128 * tuples: (uint16_t, var. len. string). It starts at
129 * reloc_table_offset.
131 struct filter_bytecode
{
133 uint16_t reloc_table_offset
;
137 struct filter_bytecode_alloc
{
139 struct filter_bytecode b
;
143 unsigned int bytecode_get_len(struct filter_bytecode
*bytecode
)
145 return bytecode
->len
;
148 #endif /* _FILTER_BYTECODE_H */
This page took 0.031249 seconds and 4 git commands to generate.