caveat: introduce ecall.h header
[cavatools.git] / caveat / ecall.h
1 #pragma once
2
3 #include <stdio.h>
4 #include <stdint.h>
5 #include <sys/time.h>
6
7 struct ecall_entry {
8 long number;
9 char const *name;
10 };
11
12 #include "opcodes.h"
13 #include "insn.h"
14 #include "core.h"
15
16 #include "ecall_nums.h"
17
18 static inline struct ecall_entry const *
19 ecall_entry(long id) {
20 return &rv_to_host[id];
21 }
22
23 static inline long
24 ecall_idargs(struct core_t const *cpu, long arguments[6]) {
25 arguments[0] = cpu->reg[10].l;
26 arguments[1] = cpu->reg[11].l;
27 arguments[2] = cpu->reg[12].l;
28 arguments[3] = cpu->reg[13].l;
29 arguments[4] = cpu->reg[14].l;
30 arguments[5] = cpu->reg[15].l;
31
32 return cpu->reg[17].l;
33 }