Filter: add FILTER_OP_RETURN_S64 instruction
[lttng-modules.git] / lttng-filter-validator.c
index c7b81bb6bbd193187434bd5f2b5f21a48f3fff7a..051db49c87e5f75d7ea5c525ce76fcba90ddef7a 100644 (file)
@@ -303,6 +303,7 @@ int bytecode_validate_overflow(struct bytecode_runtime *bytecode,
        }
 
        case FILTER_OP_RETURN:
+       case FILTER_OP_RETURN_S64:
        {
                if (unlikely(pc + sizeof(struct return_op)
                                > start_pc + bytecode->len)) {
@@ -586,6 +587,7 @@ int validate_instruction_context(struct bytecode_runtime *bytecode,
        }
 
        case FILTER_OP_RETURN:
+       case FILTER_OP_RETURN_S64:
        {
                goto end;
        }
@@ -1183,6 +1185,28 @@ int exec_insn(struct bytecode_runtime *bytecode,
                goto end;
        }
 
+       case FILTER_OP_RETURN_S64:
+       {
+               if (!vstack_ax(stack)) {
+                       printk(KERN_WARNING "Empty stack\n");
+                       ret = -EINVAL;
+                       goto end;
+               }
+               switch (vstack_ax(stack)->type) {
+               case REG_S64:
+                       break;
+               default:
+               case REG_TYPE_UNKNOWN:
+                       printk(KERN_WARNING "Unexpected register type %d at end of bytecode\n",
+                               (int) vstack_ax(stack)->type);
+                       ret = -EINVAL;
+                       goto end;
+               }
+
+               ret = 0;
+               goto end;
+       }
+
        /* binary */
        case FILTER_OP_MUL:
        case FILTER_OP_DIV:
This page took 0.023743 seconds and 4 git commands to generate.