X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Ffilter-bytecode.h;h=7df0288ae071c46ecd6edb016b77a32fbd61d2c8;hb=HEAD;hp=d5194bc25ddf02a2efc4c256c4f712686dd9eeba;hpb=7e50015d099795fcce0602bdb670fd6ae0510026;p=lttng-ust.git diff --git a/liblttng-ust/filter-bytecode.h b/liblttng-ust/filter-bytecode.h deleted file mode 100644 index d5194bc2..00000000 --- a/liblttng-ust/filter-bytecode.h +++ /dev/null @@ -1,188 +0,0 @@ -#ifndef _FILTER_BYTECODE_H -#define _FILTER_BYTECODE_H - -/* - * filter-bytecode.h - * - * LTTng filter bytecode - * - * Copyright 2012-2016 - Mathieu Desnoyers - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#include - -/* - * offsets are absolute from start of bytecode. - */ - -struct field_ref { - /* Initially, symbol offset. After link, field offset. */ - uint16_t offset; -} __attribute__((packed)); - -struct literal_numeric { - int64_t v; -} __attribute__((packed)); - -struct literal_double { - double v; -} __attribute__((packed)); - -struct literal_string { - char string[0]; -} __attribute__((packed)); - -enum filter_op { - FILTER_OP_UNKNOWN = 0, - - FILTER_OP_RETURN, - - /* binary */ - FILTER_OP_MUL, - FILTER_OP_DIV, - FILTER_OP_MOD, - FILTER_OP_PLUS, - FILTER_OP_MINUS, - FILTER_OP_RSHIFT, - FILTER_OP_LSHIFT, - FILTER_OP_BIN_AND, - FILTER_OP_BIN_OR, - FILTER_OP_BIN_XOR, - - /* binary comparators */ - FILTER_OP_EQ, - FILTER_OP_NE, - FILTER_OP_GT, - FILTER_OP_LT, - FILTER_OP_GE, - FILTER_OP_LE, - - /* string binary comparator */ - FILTER_OP_EQ_STRING, - FILTER_OP_NE_STRING, - FILTER_OP_GT_STRING, - FILTER_OP_LT_STRING, - FILTER_OP_GE_STRING, - FILTER_OP_LE_STRING, - - /* s64 binary comparator */ - FILTER_OP_EQ_S64, - FILTER_OP_NE_S64, - FILTER_OP_GT_S64, - FILTER_OP_LT_S64, - FILTER_OP_GE_S64, - FILTER_OP_LE_S64, - - /* double binary comparator */ - FILTER_OP_EQ_DOUBLE, - FILTER_OP_NE_DOUBLE, - FILTER_OP_GT_DOUBLE, - FILTER_OP_LT_DOUBLE, - FILTER_OP_GE_DOUBLE, - FILTER_OP_LE_DOUBLE, - - /* Mixed S64-double binary comparators */ - FILTER_OP_EQ_DOUBLE_S64, - FILTER_OP_NE_DOUBLE_S64, - FILTER_OP_GT_DOUBLE_S64, - FILTER_OP_LT_DOUBLE_S64, - FILTER_OP_GE_DOUBLE_S64, - FILTER_OP_LE_DOUBLE_S64, - - FILTER_OP_EQ_S64_DOUBLE, - FILTER_OP_NE_S64_DOUBLE, - FILTER_OP_GT_S64_DOUBLE, - FILTER_OP_LT_S64_DOUBLE, - FILTER_OP_GE_S64_DOUBLE, - FILTER_OP_LE_S64_DOUBLE, - - /* unary */ - FILTER_OP_UNARY_PLUS, - FILTER_OP_UNARY_MINUS, - FILTER_OP_UNARY_NOT, - FILTER_OP_UNARY_PLUS_S64, - FILTER_OP_UNARY_MINUS_S64, - FILTER_OP_UNARY_NOT_S64, - FILTER_OP_UNARY_PLUS_DOUBLE, - FILTER_OP_UNARY_MINUS_DOUBLE, - FILTER_OP_UNARY_NOT_DOUBLE, - - /* logical */ - FILTER_OP_AND, - FILTER_OP_OR, - - /* load field ref */ - FILTER_OP_LOAD_FIELD_REF, - FILTER_OP_LOAD_FIELD_REF_STRING, - FILTER_OP_LOAD_FIELD_REF_SEQUENCE, - FILTER_OP_LOAD_FIELD_REF_S64, - FILTER_OP_LOAD_FIELD_REF_DOUBLE, - - /* load immediate from operand */ - FILTER_OP_LOAD_STRING, - FILTER_OP_LOAD_S64, - FILTER_OP_LOAD_DOUBLE, - - /* cast */ - FILTER_OP_CAST_TO_S64, - FILTER_OP_CAST_DOUBLE_TO_S64, - FILTER_OP_CAST_NOP, - - /* get context ref */ - FILTER_OP_GET_CONTEXT_REF, - FILTER_OP_GET_CONTEXT_REF_STRING, - FILTER_OP_GET_CONTEXT_REF_S64, - FILTER_OP_GET_CONTEXT_REF_DOUBLE, - - NR_FILTER_OPS, -}; - -typedef uint8_t filter_opcode_t; - -struct load_op { - filter_opcode_t op; - char data[0]; - /* data to load. Size known by enum filter_opcode and null-term char. */ -} __attribute__((packed)); - -struct binary_op { - filter_opcode_t op; -} __attribute__((packed)); - -struct unary_op { - filter_opcode_t op; -} __attribute__((packed)); - -/* skip_offset is absolute from start of bytecode */ -struct logical_op { - filter_opcode_t op; - uint16_t skip_offset; /* bytecode insn, if skip second test */ -} __attribute__((packed)); - -struct cast_op { - filter_opcode_t op; -} __attribute__((packed)); - -struct return_op { - filter_opcode_t op; -} __attribute__((packed)); - -#endif /* _FILTER_BYTECODE_H */