1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

Kernel/Userland: Add a halt syscall, and a shutdown binary to invoke it

This commit is contained in:
Robin Burchell 2019-06-16 11:49:39 +02:00 committed by Andreas Kling
parent 9e0f7acfe5
commit 952382b413
5 changed files with 38 additions and 1 deletions

View file

@ -1,6 +1,7 @@
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/Console.h>
#include <Kernel/Process.h>
#include <Kernel/IO.h>
#include <Kernel/ProcessTracer.h>
#include <Kernel/Scheduler.h>
#include <Kernel/Syscall.h>
@ -281,6 +282,15 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
return current->process().sys$sched_setparam((pid_t)arg1, (struct sched_param*)arg2);
case Syscall::SC_sched_getparam:
return current->process().sys$sched_setparam((pid_t)arg1, (struct sched_param*)arg2);
case Syscall::SC_halt: {
dbgprintf("<%u> halting! acquiring locks...\n");
FS::lock_all();
dbgprintf("<%u> halting! syncing...\n");
FS::sync();
dbgprintf("<%u> halting! bye, friends...\n");
IO::out16(0x604, 0x2000);
break;
}
default:
kprintf("<%u> int0x82: Unknown function %u requested {%x, %x, %x}\n", current->process().pid(), function, arg1, arg2, arg3);
return -ENOSYS;