From d0dd6595c317becc52ecafede33684c8e67c327c Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Tue, 31 Aug 2021 10:26:31 +0200 Subject: [PATCH] cleaned up ecall code --- kinclude/ecall.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kinclude/ecall.c b/kinclude/ecall.c index 02abaa2..6474a4b 100644 --- a/kinclude/ecall.c +++ b/kinclude/ecall.c @@ -101,8 +101,6 @@ optional_int ecall_handle_exit(int* args, ProcessControlBlock* pcb) pcb->exit_code = *args; if (DEBUGGING) { - dbgln("exit", 4); - char msg[34] = "process exited with code "; itoa(pcb->pid, &msg[8], 10); @@ -124,12 +122,10 @@ void trap_handle_ecall() mark_ecall_entry(); ProcessControlBlock* pcb = get_current_process(); int *regs = pcb->regs; - int code = regs[REG_A0 + 7]; // code is inside a7 - - dbgln("ecall:", 6); + int code = regs[REG_A0 + 7]; // code is stored inside a7 // check if the code is too large/small or if the handler is zero - if (code < 0 || code > ECALL_TABLE_LEN || ecall_table[code] == 0) { + if (code < 0 || code > ECALL_TABLE_LEN || ecall_table[code] == NULL) { regs[REG_A0] = ENOCODE; } else { // run the corresponding ecall handler @@ -204,6 +200,7 @@ void handle_exception(int ecode, int mtval) { // kill off offending process ProcessControlBlock* pcb = get_current_process(); + pcb->status = PROC_DEAD; pcb->exit_code = -99; destroy_process(pcb);