+#pragma once
+
+#include <stdio.h>
+#include <stdint.h>
+#include <sys/time.h>
+
+struct ecall_entry {
+ long number;
+ char const *name;
+};
+
+#include "opcodes.h"
+#include "insn.h"
+#include "core.h"
+
+#include "ecall_nums.h"
+
+static inline struct ecall_entry const *
+ecall_entry(long id) {
+ return &rv_to_host[id];
+}
+
+static inline long
+ecall_idargs(struct core_t const *cpu, long arguments[6]) {
+ arguments[0] = cpu->reg[10].l;
+ arguments[1] = cpu->reg[11].l;
+ arguments[2] = cpu->reg[12].l;
+ arguments[3] = cpu->reg[13].l;
+ arguments[4] = cpu->reg[14].l;
+ arguments[5] = cpu->reg[15].l;
+
+ return cpu->reg[17].l;
+}