// 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; }