ecall module now kills processes which trigger an exception

master
Anton Lydike 3 years ago
parent b08198d166
commit 14c2dd95a6

@ -202,7 +202,12 @@ void init_ecall_table()
void handle_exception(int ecode, int mtval)
{
//TODO: handle exceptions well
dbgln("exception encountered!", 17);
__asm__ ("ebreak");
// kill off offending process
ProcessControlBlock* pcb = get_current_process();
pcb->status = PROC_DEAD;
pcb->exit_code = -99;
destroy_process(pcb);
// run the next process
scheduler_run_next();
}

@ -96,7 +96,7 @@ ProcessControlBlock* scheduler_select_free()
pcb->waiting_for_process->status == PROC_DEAD) {
// the requested process exited, so we can set the status code and
pcb->regs[REG_A0] = pcb->waiting_for_process->exit_code;
pcb->regs[REG_A0+1] = 0;
pcb->regs[REG_A0 + 1] = 0;
pcb->status = PROC_RDY;
return pcb;
}

Loading…
Cancel
Save