summaryrefslogtreecommitdiff
path: root/kernel/syscall.c
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-25 11:45:15 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-25 11:45:15 -0400
commit87e8de4f0050ec154286189783ddbd269fbcc7ee (patch)
tree70e518a288276ec1d306b153d3006c2a44e27ea2 /kernel/syscall.c
parentload init from ata and run it (diff)
downloadcomus-87e8de4f0050ec154286189783ddbd269fbcc7ee.tar.gz
comus-87e8de4f0050ec154286189783ddbd269fbcc7ee.tar.bz2
comus-87e8de4f0050ec154286189783ddbd269fbcc7ee.zip
poweroff syscall
Diffstat (limited to 'kernel/syscall.c')
-rw-r--r--kernel/syscall.c23
1 files changed, 16 insertions, 7 deletions
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 <comus/cpu.h>
#include <comus/syscalls.h>
-#include <comus/drivers/uart.h>
+#include <comus/drivers/acpi.h>
#include <comus/memory.h>
#include <comus/procs.h>
@@ -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)