From 8a168f2be5d90f972975abf0b40145a75c0231b7 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Wed, 21 Jul 2021 21:35:20 +0200 Subject: syscall parameter & return value passing Sadly, sysenter on i386 limits me to only 4 arguments (so, 1 for the syscall id + 3 real args). If that turns out to be an issue I'll either just switch to interrupts, or switch to x64. --- src/kernel/syscalls.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/kernel/syscalls.c') diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 25b8eb5..a42dc44 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -1,6 +1,15 @@ #include #include -void syscall_handler() { +int syscall_handler(int a, int b, int c, int d) { + // verify that the parameters get passed correctly + if (a != 1) panic(); + if (b != 2) panic(); + if (c != 3) panic(); + if (d != 4) panic(); + log_const("in a syscall!"); + + // used to check if the return value gets passed correctly + return 0x4e; } -- cgit v1.2.3