|
|
@ -78,14 +78,16 @@ optional_int ecall_handle_exit(int* args, ProcessControlBlock* pcb)
|
|
|
|
pcb->status = PROC_DEAD;
|
|
|
|
pcb->status = PROC_DEAD;
|
|
|
|
pcb->exit_code = *args;
|
|
|
|
pcb->exit_code = *args;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (DEBUGGING) {
|
|
|
|
dbgln("exit", 4);
|
|
|
|
dbgln("exit", 4);
|
|
|
|
|
|
|
|
|
|
|
|
char msg[34] = "process exited with code ";
|
|
|
|
char msg[34] = "process exited with code ";
|
|
|
|
|
|
|
|
|
|
|
|
itoa(pcb->pid, &msg[8], 10);
|
|
|
|
itoa(pcb->pid, &msg[8], 10);
|
|
|
|
itoa(*args % 10, &msg[28], 10);
|
|
|
|
itoa(*args, &msg[28], 10);
|
|
|
|
|
|
|
|
|
|
|
|
dbgln(msg, 34);
|
|
|
|
dbgln(msg, 34);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// recursively kill all child processes
|
|
|
|
// recursively kill all child processes
|
|
|
|
kill_child_processes(pcb);
|
|
|
|
kill_child_processes(pcb);
|
|
|
@ -95,7 +97,8 @@ optional_int ecall_handle_exit(int* args, ProcessControlBlock* pcb)
|
|
|
|
|
|
|
|
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
|
|
|
|
|
|
|
|
void trap_handle_ecall() {
|
|
|
|
void trap_handle_ecall()
|
|
|
|
|
|
|
|
{
|
|
|
|
mark_ecall_entry();
|
|
|
|
mark_ecall_entry();
|
|
|
|
ProcessControlBlock* pcb = get_current_process();
|
|
|
|
ProcessControlBlock* pcb = get_current_process();
|
|
|
|
int *regs = pcb->regs;
|
|
|
|
int *regs = pcb->regs;
|
|
|
|