summaryrefslogtreecommitdiff
path: root/kernel/syscall.c
diff options
context:
space:
mode:
authorIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-25 11:51:09 -0400
committerIan McFarlane <i.mcfarlane2002@gmail.com>2025-04-25 11:51:09 -0400
commit25359ed1cb1a6131e9d3d26c8f2c8634670ed864 (patch)
tree559750220ff5084e33a2e1f5bc4f0c90b959a4f8 /kernel/syscall.c
parentfix freeing of virtual memory (diff)
parentpoweroff syscall (diff)
downloadcomus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.tar.gz
comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.tar.bz2
comus-25359ed1cb1a6131e9d3d26c8f2c8634670ed864.zip
resolve format conflict
Diffstat (limited to 'kernel/syscall.c')
-rw-r--r--kernel/syscall.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/kernel/syscall.c b/kernel/syscall.c
index 7944f46..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)
@@ -91,7 +100,4 @@ void syscall_handler(struct cpu_regs *regs)
// save return value
current_pcb->regs->rax = ret;
-
- // switch back to process ctx
- mem_ctx_switch(current_pcb->memctx);
}