summaryrefslogtreecommitdiffhomepage
path: root/DDKit/DispatchKernelCall.S
diff options
context:
space:
mode:
authorAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 08:49:23 +0200
committerAmlal EL Mahrouss <amlalelmahrouss@icloud.com>2024-07-30 08:49:23 +0200
commitbf642edd6c77d405637f0695452460640b8e540d (patch)
treee8e78f658e5eac62790a0fb8129a491183db92d5 /DDKit/DispatchKernelCall.S
parent60902ec5fc462128d264f63f279c7fc362a72e1d (diff)
[Refactor] SCIKit and DDKit.
[IMP} Prevent DDK from being included when we aren't in kernel mode. Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'DDKit/DispatchKernelCall.S')
-rw-r--r--DDKit/DispatchKernelCall.S36
1 files changed, 36 insertions, 0 deletions
diff --git a/DDKit/DispatchKernelCall.S b/DDKit/DispatchKernelCall.S
new file mode 100644
index 00000000..b6ce8004
--- /dev/null
+++ b/DDKit/DispatchKernelCall.S
@@ -0,0 +1,36 @@
+/**
+ lang: asm
+ compiler: gnu
+ */
+
+.globl __kernelCallDispatch
+
+.text
+
+/* Really simple function, takes our va-list,
+ and brings it to the trap handler in the kernel. */
+
+#ifdef __DDK_AMD64__
+
+/* args rcx, rdx, r8, r9 */
+__kernelCallDispatch:
+ int $0x33
+ ret
+
+#elif defined(__DDK_POWER64__)
+
+/* args r8, r9, r10, r11 */
+__kernelCallDispatch:
+ /* There is no specific interrupt request id for a system call in POWER. */
+ sc
+ blr
+
+#elif defined(__DDK_ARM64__)
+
+/* args x0, x8, x9, x10, x11 is kept to tell that this is a kernel call */
+__kernelCallDispatch:
+ /* There is no specific interrupt request id for a system call in ARM64 as well. */
+ mov x11, #0x33
+ svc #0
+
+#endif