From 8dc72a2d8e35f4767059eecd0b4b84ec78658105 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Tue, 31 Aug 2021 11:46:53 +0200 Subject: [PATCH] general cleanup in kernel code removing unised defines etc --- kernel.c | 8 ++++---- kernel.h | 6 ------ kinclude/sched.c | 6 +++--- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/kernel.c b/kernel.c index b83bbb0..084629a 100644 --- a/kernel.c +++ b/kernel.c @@ -33,10 +33,10 @@ void read_binary_table() { char msg[28] = "found bin with id 0 at pos 0"; - malloc_info info; - - info.allocate_memory_end = (void*) 0xFF0000; - info.allocate_memory_start = (void*) 0; + malloc_info info = { + .allocate_memory_end = (void*) 0xFF0000, + .allocate_memory_start = (void*) 0 + }; // calculate the end of loaded binaries for (int i = 0; i < NUM_BINARIES; i++) { diff --git a/kernel.h b/kernel.h index f336a57..9b2e8bd 100644 --- a/kernel.h +++ b/kernel.h @@ -1,12 +1,6 @@ #ifndef H_KERNEL #define H_KERNEL -#define true 1 -#define false 0 - -#define PROCESS_COUNT 8 // number of concurrent processes -#define NUM_BINARIES 4 // number of binaries loaded simultaneously - // scheduler settings #define TIME_SLICE_LEN 10 // number of cpu time ticks per slice diff --git a/kinclude/sched.c b/kinclude/sched.c index 63d41e0..ac0ee12 100644 --- a/kinclude/sched.c +++ b/kinclude/sched.c @@ -86,7 +86,7 @@ struct process_control_block* scheduler_select_free() pcb->status = PROC_RDY; return pcb; } - timeout_available = true; + timeout_available = 1; } // if it's waiting for another process, check if the process exited @@ -107,13 +107,13 @@ struct process_control_block* scheduler_select_free() pcb->status = PROC_RDY; return pcb; } - timeout_available = true; + timeout_available = 1; } } } while (pcb != current_process); // when we finished iterating over all processes and no process can be scheduled we have a problem - if (timeout_available == false) { + if (timeout_available == 0) { // either process deadlock without timeout or no processes alive. //TODO: handle deadlocks by killing a process dbgln("No thread active!", 17);