diff options
author | dzwdz | 2021-09-14 20:35:35 +0200 |
---|---|---|
committer | dzwdz | 2021-09-14 20:35:35 +0200 |
commit | 06f089b35046342fca2c30040749c632785ce6c6 (patch) | |
tree | 130e78e39b7a3afe091abdc0fcf60141712c2aa4 | |
parent | 1d0512957e802acfe7b677b30589a4e3bd26fac8 (diff) |
merge the `syscall_handler` and `_syscall` declarations
i think that making the call a bit more "transparent" makes the code
nicer
-rw-r--r-- | src/init/syscalls.c | 2 | ||||
-rw-r--r-- | src/kernel/arch/generic.h | 1 | ||||
-rw-r--r-- | src/kernel/arch/i386/sysenter.c | 5 | ||||
-rw-r--r-- | src/kernel/syscalls.c | 2 | ||||
-rw-r--r-- | src/shared/syscalls.h | 2 |
5 files changed, 6 insertions, 6 deletions
diff --git a/src/init/syscalls.c b/src/init/syscalls.c index a5d1024..fb50c35 100644 --- a/src/init/syscalls.c +++ b/src/init/syscalls.c @@ -2,8 +2,6 @@ #include <init/types.h> #include <shared/syscalls.h> -int _syscall(int, int, int, int, int); - _Noreturn void _syscall_exit(const char __user *msg, size_t len) { _syscall(_SYSCALL_EXIT, (int)msg, len, 0, 0); __builtin_unreachable(); diff --git a/src/kernel/arch/generic.h b/src/kernel/arch/generic.h index dd145f7..0696a96 100644 --- a/src/kernel/arch/generic.h +++ b/src/kernel/arch/generic.h @@ -18,7 +18,6 @@ void halt_cpu(void); // src/arch/i386/sysenter.s _Noreturn void sysexit(struct registers); -int syscall_handler(int, int, int, int, int); // all of those can allocate memory struct pagedir *pagedir_new(void); diff --git a/src/kernel/arch/i386/sysenter.c b/src/kernel/arch/i386/sysenter.c index 6419439..a0d4f73 100644 --- a/src/kernel/arch/i386/sysenter.c +++ b/src/kernel/arch/i386/sysenter.c @@ -1,5 +1,6 @@ #include <kernel/arch/generic.h> #include <kernel/proc.h> +#include <shared/syscalls.h> struct registers _sysexit_regs; // a hack @@ -21,8 +22,8 @@ _Noreturn void sysenter_stage2(void) { regs->esp = (userptr_t) regs->ecx; // fix them up regs->eip = (userptr_t) regs->edx; - val = syscall_handler(regs->eax, regs->ebx, - regs->esi, regs->edi, (uintptr_t)regs->ebp); + val = _syscall(regs->eax, regs->ebx, + regs->esi, regs->edi, (uintptr_t)regs->ebp); regs_savereturn(&process_current->regs, val); process_switch(process_current); // TODO process_resume diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 9002628..3ed4877 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -250,7 +250,7 @@ int _syscall_memflag(void __user *addr, size_t len, int flags) { return -1; } -int syscall_handler(int num, int a, int b, int c, int d) { +int _syscall(int num, int a, int b, int c, int d) { switch (num) { case _SYSCALL_EXIT: _syscall_exit((userptr_t)a, b); diff --git a/src/shared/syscalls.h b/src/shared/syscalls.h index e8e0843..11abf66 100644 --- a/src/shared/syscalls.h +++ b/src/shared/syscalls.h @@ -27,6 +27,8 @@ enum { _SYSCALL_MEMFLAG, }; +int _syscall(int, int, int, int, int); + /** Kills the current process. * TODO: what happens to the children? */ |