From 1d37792fb7a47135f0e7b7fc245e83bb1d8fc496 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 11 Nov 2022 19:46:22 +0200 Subject: less buggy fork + Not strictly done yet, but we can swap between two processes :D --- arch/riscv64/conf/init.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'arch/riscv64/conf/init.c') diff --git a/arch/riscv64/conf/init.c b/arch/riscv64/conf/init.c index 1886760..45274d9 100644 --- a/arch/riscv64/conf/init.c +++ b/arch/riscv64/conf/init.c @@ -133,10 +133,15 @@ void _start() if (pid != 0) { print_value("Child pid: ", pid); puts("Swapping to child...\n"); - sys_swap(pid); - puts("We shouldn't be here?\n"); - while(1); + while(1) sys_swap(pid); } puts("Hello from child!\n"); + + puts("Doing 1M swaps...\n"); + start = sys_ticks(); + for (long i = 0; i < 1000000; ++i) + sys_swap(1); + uint64_t ticks = sys_ticks() - start; + print_value("1M swaps took ", ticks / second); } -- cgit v1.3