From 87e8de4f0050ec154286189783ddbd269fbcc7ee Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Fri, 25 Apr 2025 11:45:15 -0400 Subject: poweroff syscall --- kernel/syscall.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'kernel/syscall.c') diff --git a/kernel/syscall.c b/kernel/syscall.c index 12db401..00e6afb 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -52,13 +52,22 @@ static int sys_write(void) return nbytes; } +static int sys_poweroff(void) +{ + acpi_shutdown(); + return 1; +} + static int (*syscall_tbl[N_SYSCALLS])(void) = { - [SYS_exit] = sys_exit, [SYS_waitpid] = NULL, [SYS_fork] = NULL, - [SYS_exec] = NULL, [SYS_open] = NULL, [SYS_close] = NULL, - [SYS_read] = NULL, [SYS_write] = sys_write, [SYS_getpid] = NULL, - [SYS_getppid] = NULL, [SYS_gettime] = NULL, [SYS_getprio] = NULL, - [SYS_setprio] = NULL, [SYS_kill] = NULL, [SYS_sleep] = NULL, - [SYS_brk] = NULL, [SYS_sbrk] = NULL, + [SYS_exit] = sys_exit, [SYS_waitpid] = NULL, + [SYS_fork] = NULL, [SYS_exec] = NULL, + [SYS_open] = NULL, [SYS_close] = NULL, + [SYS_read] = NULL, [SYS_write] = sys_write, + [SYS_getpid] = NULL, [SYS_getppid] = NULL, + [SYS_gettime] = NULL, [SYS_getprio] = NULL, + [SYS_setprio] = NULL, [SYS_kill] = NULL, + [SYS_sleep] = NULL, [SYS_brk] = NULL, + [SYS_sbrk] = NULL, [SYS_poweroff] = sys_poweroff, }; void syscall_handler(struct cpu_regs *regs) -- cgit v1.2.3-freya