summaryrefslogtreecommitdiff
path: root/Kernel/API
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-24 02:15:07 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-25 14:08:50 +0200
commitdeff554096652c461e62767b5e065e9d4c3ec9cc (patch)
tree088a05402c14a1dcd2149bfc467d2721926f371c /Kernel/API
parent9b78ae5149f80d38c3ee18eb3dbf78c05c487f7c (diff)
downloadserenity-deff554096652c461e62767b5e065e9d4c3ec9cc.zip
Kernel+LibSystem: Add a 4th syscall argument
Let's allow passing 4 function arguments to a syscall. The 4th argument goes into ESI or RSI.
Diffstat (limited to 'Kernel/API')
-rw-r--r--Kernel/API/Syscall.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h
index 6377d38479..30b07a0369 100644
--- a/Kernel/API/Syscall.h
+++ b/Kernel/API/Syscall.h
@@ -531,6 +531,17 @@ inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3)
: "memory");
return result;
}
+
+template<typename T1, typename T2, typename T3, typename T4>
+inline uintptr_t invoke(Function function, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
+{
+ uintptr_t result;
+ asm volatile("int $0x82"
+ : "=a"(result)
+ : "a"(function), "d"((uintptr_t)arg1), "c"((uintptr_t)arg2), "b"((uintptr_t)arg3), "S"((uintptr_t)arg4)
+ : "memory");
+ return result;
+}
#endif
}