From 426a6508d13d2832a09e325468f63342256f3df0 Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Sun, 22 Aug 2021 19:04:15 +0200 Subject: [PATCH] removed trailing whitespaces --- kinclude/boot.S | 10 +++++----- kinclude/csr.c | 4 ++-- kinclude/ktypes.h | 4 ++-- kinclude/malloc.c | 2 +- kinclude/sched.c | 8 ++++---- kinclude/sched.h | 1 + 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/kinclude/boot.S b/kinclude/boot.S index 4f2be0d..db28f32 100644 --- a/kinclude/boot.S +++ b/kinclude/boot.S @@ -43,7 +43,7 @@ _start: // jump to init jal init - + // halt machine after returning from init li t0, -1 csrw CSR_HALT, t0 @@ -130,10 +130,10 @@ memset: // write a0 to memory starting at a1, until a2 (both must be four byte aligned) // this uses a loop which writes 32 (numbytes) bytes at a time -// to prevent overshooting the end, we first calulate how many instructions to +// to prevent overshooting the end, we first calulate how many instructions to // skip of the first iteration of the loop. this way, (a2 - a1) is a multiple of -// (numbytes) when we reach the blt instruction for the first time. -// this math works so good, because we write 4 bytes of mem, in 4 bytes of +// (numbytes) when we reach the blt instruction for the first time. +// this math works so good, because we write 4 bytes of mem, in 4 bytes of // instructions. Therefore instruction bytes to skip = write bytes to skip // bytes to skip = numbytes - ((a2 - a1) % numbytes) memset: @@ -149,7 +149,7 @@ memset: auipc t1, 0 // get current address add t1, t2, t1 // add calulated offset jalr zero, t1, 12 // skip the instructions by forward-jumping - // the 12 is added to compensate for the + // the 12 is added to compensate for the // three instructions auipc, add, jalr 1: sw a0, 0(a1) diff --git a/kinclude/csr.c b/kinclude/csr.c index 4e5d28f..b154a37 100644 --- a/kinclude/csr.c +++ b/kinclude/csr.c @@ -12,7 +12,7 @@ void write_mtimecmp(unsigned long long int mtimecmp) { __asm__( "li t0, %0\n" "sw %1, 0(t0)\n" - "sw %2, 4(t0)" :: + "sw %2, 4(t0)" :: "i"(TIMECMP_MEM_ADDR), "r"(lo), "r"(hi) ); } @@ -24,7 +24,7 @@ void write_mtimecmp(unsigned long long int mtimecmp) { unsigned int higher = mtimecmp >> 32; __asm__( "csrw %0, %2\n" - "csrw %1, %3" :: + "csrw %1, %3" :: "I"(CSR_MTIMECMP),"I"(CSR_MTIMECMPH), "r"(lower), "r"(higher) ); diff --git a/kinclude/ktypes.h b/kinclude/ktypes.h index 395def4..a7513ae 100644 --- a/kinclude/ktypes.h +++ b/kinclude/ktypes.h @@ -63,7 +63,7 @@ enum pcb_struct_registers { /* This struct holds information about binaries which are currently loaded into * memory. Currently the kernel is not able to load binaries into memory, as - * no file system layer is implemented. When the memory image is built, the + * no file system layer is implemented. When the memory image is built, the * list of loaded binaries is populated aswell. */ typedef struct loaded_binary { @@ -76,7 +76,7 @@ typedef struct loaded_binary { /* * Optionals * - * in this kernel, an optional can hold a value or an error, but we can't use + * in this kernel, an optional can hold a value or an error, but we can't use * unions here because we need to be able to distinguish errors from results. * this is a little space inefficient, but we'll have to deal with this, or else * we get global errno variables. diff --git a/kinclude/malloc.c b/kinclude/malloc.c index ac395a0..8bfc77f 100644 --- a/kinclude/malloc.c +++ b/kinclude/malloc.c @@ -16,7 +16,7 @@ void malloc_init(malloc_info* given_info) optional_voidptr malloc_stack(size_t size) { void* new_alloc_end = (void*) (((int) allocate_memory_end) - size); - if (new_alloc_end < global_malloc_info.allocate_memory_start) + if (new_alloc_end < global_malloc_info.allocate_memory_start) return (optional_voidptr) { .error = ENOMEM }; void* stack_top = allocate_memory_end; allocate_memory_end = new_alloc_end; diff --git a/kinclude/sched.c b/kinclude/sched.c index 7a002fe..ea8754f 100644 --- a/kinclude/sched.c +++ b/kinclude/sched.c @@ -70,7 +70,7 @@ ProcessControlBlock* scheduler_select_free() while (pcb != current_process) { if (pcb->status == PROC_RDY) return pcb; - + if (pcb->status == PROC_WAIT_SLEEP) { if (pcb->asleep_until < mtime) { return pcb; @@ -97,7 +97,7 @@ ProcessControlBlock* scheduler_select_free() } if (timeout_available == false) { - // either process deadlock or no processes alive. + // either process deadlock or no processes alive. //TODO: handle missing executable thread dbgln("No thread active!", 17); HALT(22); @@ -185,7 +185,7 @@ optional_pcbptr find_available_pcb_slot() { int start_index = index; ProcessControlBlock* pcb = processes + index; - while (pcb->status != PROC_DEAD) { + while (pcb->status != PROC_DEAD) { index = (index + 1) % PROCESS_COUNT; if (index == start_index) return (optional_pcbptr) { .error = ENOBUFS }; @@ -288,7 +288,7 @@ void kill_child_processes(ProcessControlBlock* pcb) { for (int i = 0; i < PROCESS_COUNT; i++) { ProcessControlBlock* proc = processes + i; - if (proc->parent != pcb) + if (proc->parent != pcb) continue; proc->status = PROC_DEAD; diff --git a/kinclude/sched.h b/kinclude/sched.h index 50366ab..cc7572a 100644 --- a/kinclude/sched.h +++ b/kinclude/sched.h @@ -18,6 +18,7 @@ int* get_current_process_registers(); ProcessControlBlock* get_current_process(); void mark_ecall_entry(); +// process creation / destruction optional_pcbptr create_new_process(loaded_binary*, int); optional_pcbptr create_new_thread(ProcessControlBlock*, void*, void*, int); void kill_child_processes(ProcessControlBlock* pcb);