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 | Bin 2560 -> 2664 bytes arch/riscv64/conf/init.c | 11 ++++++++--- arch/riscv64/conf/initrd | Bin 3072 -> 3072 bytes 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'arch/riscv64/conf') diff --git a/arch/riscv64/conf/init b/arch/riscv64/conf/init index 47e733f..11d838c 100755 Binary files a/arch/riscv64/conf/init and b/arch/riscv64/conf/init differ 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); } diff --git a/arch/riscv64/conf/initrd b/arch/riscv64/conf/initrd index 24f9fb4..5c0c9bb 100644 Binary files a/arch/riscv64/conf/initrd and b/arch/riscv64/conf/initrd differ -- cgit v1.3