aboutsummaryrefslogtreecommitdiff
path: root/test/ui/v1/allos/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/ui/v1/allos/ui.c')
-rw-r--r--test/ui/v1/allos/ui.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/test/ui/v1/allos/ui.c b/test/ui/v1/allos/ui.c
new file mode 100644
index 0000000..1a02c30
--- /dev/null
+++ b/test/ui/v1/allos/ui.c
@@ -0,0 +1,90 @@
+#if !defined(COMMAND_NEW)
+#error
+#endif
+
+#if CLONES != 2
+#error
+#endif
+
+#define CHILD_SIZE 4
+
+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 2:
+ birth_addr = ANC_SIZE;
+ break;
+ case 3:
+ birth_addr = ANC_SIZE + (MVEC_SIZE / 2);
+ break;
+ case 4:
+ birth_addr = ANC_SIZE + CHILD_SIZE;
+ break;
+ case 5:
+ birth_addr = ANC_SIZE + CHILD_SIZE + (MVEC_SIZE / 2);
+ break;
+ case 6:
+ birth_addr = (MVEC_SIZE / 2) - CHILD_SIZE;
+ 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 (mvec_is_proc_owner(g_cores, proc_fetch(g_cores, 1)->ip, 1)) {
+ const struct Proc *proc_next = proc_get(g_cores, (g_cores->pcur + 1) % g_cores->pnum);
+ bool will_split = mvec_get_inst(g_cores, proc_next->ip) == splt && proc_next->mb1s;
+ uint64_t pnum = g_cores->pnum;
+
+ salis_step(1);
+
+ if (will_split) {
+ assert(g_cores->pnum == pnum + 1);
+ assert(g_cores->plst == pnum);
+
+ switch (g_cores->pnum) {
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ check_new_proc();
+ break;
+ default:
+ assert(false);
+ }
+ }
+ }
+
+ assert(mvec_is_proc_owner(g_cores, proc_fetch(g_cores, 0)->ip, 0));
+ assert(g_cores->pnum == 7);
+ assert(g_cores->pvec[0].sp > MVEC_SIZE);
+
+ salis_free();
+ return 0;
+}