Filter: add FILTER_OP_RETURN_S64 instruction
[lttng-ust.git] / liblttng-ust / lttng-filter-validator.c
index 4fe8e8938d9ccd889d47a50f8d58910c62fdf68a..92455c80a554766830dda045ccd5f73d76dc5b09 100644 (file)
@@ -296,6 +296,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)) {
@@ -578,6 +579,7 @@ int validate_instruction_context(struct bytecode_runtime *bytecode,
        }
 
        case FILTER_OP_RETURN:
+       case FILTER_OP_RETURN_S64:
        {
                goto end;
        }
@@ -1255,6 +1257,27 @@ int exec_insn(struct bytecode_runtime *bytecode,
                ret = 0;
                goto end;
        }
+       case FILTER_OP_RETURN_S64:
+       {
+               if (!vstack_ax(stack)) {
+                       ERR("Empty stack\n");
+                       ret = -EINVAL;
+                       goto end;
+               }
+               switch (vstack_ax(stack)->type) {
+               case REG_S64:
+                       break;
+               default:
+               case REG_UNKNOWN:
+                       ERR("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:
This page took 0.023557 seconds and 4 git commands to generate.