From 1961b4b237083f4cfac9ca6b249c1d6cb665d149 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Tue, 14 Jul 2026 17:29:02 +0200 Subject: Initial (refactor) --- test/ui/v1/allos/ui.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 test/ui/v1/allos/ui.c (limited to 'test/ui/v1/allos/ui.c') diff --git a/test/ui/v1/allos/ui.c b/test/ui/v1/allos/ui.c new file mode 100644 index 0000000..5b0da79 --- /dev/null +++ b/test/ui/v1/allos/ui.c @@ -0,0 +1,80 @@ +// file : test/ui/v1/allos/ui.c +// project : Salis-VM +// author : Paul Oliver + +#include +#include +#include +#include + +#include "arch_spec.h" +#include "arch_inst.h" +#include "compress.h" +#include "salis.h" + +#define CHILD_SIZE 4 + +static const struct Proc *first_proc(void) { + return proc_fetch(g_cores, g_cores->pfst); +} + +static void check_new_proc(void) { + const struct Proc *proc = proc_get(g_cores, g_cores->plst); + + assert(proc->mb0s == CHILD_SIZE); + assert(proc->mb1a == 0); + assert(proc->mb1s == 0); + assert(proc->r0x == 0); + assert(proc->r1x == 0); + assert(proc->r2x == 0); + assert(proc->r3x == 0); + assert(proc->s0 == 0); + assert(proc->s1 == 0); + assert(proc->s2 == 0); + assert(proc->s3 == 0); + assert(proc->s4 == 0); + assert(proc->s5 == 0); + assert(proc->s6 == 0); + assert(proc->s7 == 0); + + uint64_t birth_addr = (uint64_t)-1; + + switch (g_cores->plst) { + case 1: + birth_addr = ANC_SIZE; + break; + case 2: + birth_addr = ANC_SIZE - 7; + break; + default: + assert(false); + } + + assert(proc->ip == birth_addr); + assert(proc->sp == birth_addr); + assert(proc->mb0a == birth_addr); +} + +int main(void) { + salis_init(); + + while (first_proc()->ip < (ANC_SIZE + (CHILD_SIZE * 2))) { + bool will_split = g_cores->pcur == g_cores->pfst && mvec_get_inst(g_cores, first_proc()->ip) == bspl && first_proc()->mb1s; + uint64_t pnum = g_cores->pnum; + + salis_step(1); + + if (will_split) { + assert(g_cores->pnum == pnum + 1); + assert(g_cores->plst == pnum); + check_new_proc(); + } else { + assert(g_cores->pnum == pnum); + } + } + + assert(g_cores->pnum == 3); + + salis_save_and_free(); + return 0; +} -- cgit v1.2.1