From 9de5e07bc3920d4b03903eb5b78847973075059b Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sat, 19 Feb 2022 13:40:17 -0700 Subject: Added comments and cleanup --- src/sys/kernel.S | 5 +---- src/sys/schedule.c | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/sys') diff --git a/src/sys/kernel.S b/src/sys/kernel.S index 90e1c4f..3ffc6a5 100644 --- a/src/sys/kernel.S +++ b/src/sys/kernel.S @@ -4,10 +4,7 @@ kernel_main: ///https://wiki.osdev.org/ARM_Paging // Query the ID_MMFR0 register - mrc p15, 0, r2, c0, c1, 4 - mov r0, #0 - mov r1, #7 - bl draw_hex32 + mrc p15, 0, r0, c0, c1, 4 bl sysinit // Intentional undefined instruction // .word 0xf7f0a000 diff --git a/src/sys/schedule.c b/src/sys/schedule.c index dd59891..347b91a 100644 --- a/src/sys/schedule.c +++ b/src/sys/schedule.c @@ -42,8 +42,10 @@ void init_scheduler(void) struct RStack get_stack(void) { struct RStack r = {.sp = 0, .idx = -1}; + // Find an available stack for (int i = 0; i < MAX_THREADS; i++) { if (stacks_table[i] == 0) { + // Mark unavailable stacks_table[i] = 1; r.idx = i; r.sp = (void*)0x20000000 - STACK_SIZE*i; -- cgit v1.2.1