1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

Add a sys$exit and make init_stage2 call it when finished.

This commit is contained in:
Andreas Kling 2018-10-22 11:43:55 +02:00
parent 79ffdb7205
commit 3a3c57357c
5 changed files with 35 additions and 3 deletions

View file

@ -235,6 +235,26 @@ void Task::dumpRegions()
}
}
void Task::sys$exit(int status)
{
cli();
kprintf("sys$exit: %s(%u) exit with status %d\n", name().characters(), pid(), status);
setState(Exiting);
dumpRegions();
s_tasks->remove(this);
if (!scheduleNewTask()) {
kprintf("Task::taskDidCrash: Failed to schedule a new task :(\n");
HANG;
}
delete this;
switchNow();
}
void Task::taskDidCrash(Task* crashedTask)
{
// NOTE: This is called from an excepton handler, so interrupts are disabled.