diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2026-07-14 17:29:02 +0200 |
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2026-08-30 16:24:48 +0200 |
| commit | 1961b4b237083f4cfac9ca6b249c1d6cb665d149 (patch) | |
| tree | fd9fc8260360e2ac30be9747ca558bcfc824a4c4 /test/ui/v1/ioops | |
Diffstat (limited to 'test/ui/v1/ioops')
| -rw-r--r-- | test/ui/v1/ioops/links.json | 1 | ||||
| -rw-r--r-- | test/ui/v1/ioops/ui.c | 66 |
2 files changed, 67 insertions, 0 deletions
diff --git a/test/ui/v1/ioops/links.json b/test/ui/v1/ioops/links.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/test/ui/v1/ioops/links.json @@ -0,0 +1 @@ +[] diff --git a/test/ui/v1/ioops/ui.c b/test/ui/v1/ioops/ui.c new file mode 100644 index 0000000..8ec21b2 --- /dev/null +++ b/test/ui/v1/ioops/ui.c @@ -0,0 +1,66 @@ +// file : test/ui/v1/ioops/ui.c +// project : Salis-VM +// author : Paul Oliver <contact@pauloliver.dev> + +#include <assert.h> +#include <stdint.h> +#include <threads.h> +#include <zlib.h> + +#include "arch_spec.h" +#include "arch_inst.h" +#include "compress.h" +#include "salis.h" + +int main(void) { + salis_init(); + + while (mvec_is_proc_owner(g_cores, g_cores->pvec->ip, g_cores->pcur)) { + uint8_t inst = mvec_get_inst(g_cores, g_cores->pvec->ip); + + if (inst != rloa && inst != rwrt) { + salis_step(1); + continue; + } + + uint64_t *regs[2] = { + &g_cores->pvec->r0x, + &g_cores->pvec->r0x, + }; + + for (uint64_t i = 0; i < 2; i++) { + uint8_t rmod = mvec_get_inst(g_cores, g_cores->pvec->ip + 1 + i); + + if (rmod == nop0) regs[i] = &g_cores->pvec->r0x; + else if (rmod == nop1) regs[i] = &g_cores->pvec->r1x; + else if (rmod == nop2) regs[i] = &g_cores->pvec->r2x; + else if (rmod == nop3) regs[i] = &g_cores->pvec->r3x; + else break; + } + + if (g_cores->pvec->sp != *regs[0]) { + salis_step(1); + continue; + } + + uint64_t reg_vals[2] = {*regs[0], *regs[1]}; + + assert(g_cores->pvec->sp == *regs[0]); + salis_step(1); + assert(g_cores->pvec->sp == g_cores->pvec->ip); + + switch (inst) { + case rloa: + assert(*regs[1] == (uint64_t)mvec_get_inst(g_cores, reg_vals[0])); + break; + case rwrt: + assert(*regs[0] == reg_vals[0]); + assert(*regs[1] == reg_vals[1]); + assert(mvec_get_inst(g_cores, *regs[0]) == (*regs[1] & ARCH_INST_MASK)); + break; + } + } + + salis_save_and_free(); + return 0; +} |
