Filter: add FILTER_OP_RETURN_S64 instruction
[deliverable/lttng-modules.git] / lttng-filter-interpreter.c
index b1e5ba7360261a651386ebfa4485093a4a566237..7263ce9636f6ccb3630babe5b348d93954c6ad3f 100644 (file)
@@ -771,6 +771,8 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                [ FILTER_OP_LOAD_FIELD_DOUBLE ] = &&LABEL_FILTER_OP_LOAD_FIELD_DOUBLE,
 
                [ FILTER_OP_UNARY_BIT_NOT ] = &&LABEL_FILTER_OP_UNARY_BIT_NOT,
+
+               [ FILTER_OP_RETURN_S64 ] = &&LABEL_FILTER_OP_RETURN_S64,
        };
 #endif /* #ifndef INTERPRETER_USE_SWITCH */
 
@@ -788,6 +790,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                        goto end;
 
                OP(FILTER_OP_RETURN):
+               OP(FILTER_OP_RETURN_S64):
                        /* LTTNG_FILTER_DISCARD  or LTTNG_FILTER_RECORD_FLAG */
                        retval = !!estack_ax_v;
                        ret = 0;
@@ -995,7 +998,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       res = (estack_bx_v >> estack_ax_v);
+                       res = ((uint64_t) estack_bx_v >> (uint32_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1010,7 +1013,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                                ret = -EINVAL;
                                goto end;
                        }
-                       res = (estack_bx_v << estack_ax_v);
+                       res = ((uint64_t) estack_bx_v << (uint32_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1020,7 +1023,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
-                       res = (estack_bx_v & estack_ax_v);
+                       res = ((uint64_t) estack_bx_v & (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1030,7 +1033,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
-                       res = (estack_bx_v | estack_ax_v);
+                       res = ((uint64_t) estack_bx_v | (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1040,7 +1043,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
                {
                        int64_t res;
 
-                       res = (estack_bx_v ^ estack_ax_v);
+                       res = ((uint64_t) estack_bx_v ^ (uint64_t) estack_ax_v);
                        estack_pop(stack, top, ax, bx);
                        estack_ax_v = res;
                        next_pc += sizeof(struct binary_op);
@@ -1059,7 +1062,7 @@ uint64_t lttng_filter_interpret_bytecode(void *filter_data,
 
                OP(FILTER_OP_UNARY_BIT_NOT):
                {
-                       estack_ax_v = ~estack_ax_v;
+                       estack_ax_v = ~(uint64_t) estack_ax_v;
                        next_pc += sizeof(struct unary_op);
                        PO;
                }
This page took 0.026231 seconds and 5 git commands to generate.