summaryrefslogtreecommitdiff
path: root/Kernel/Arch
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-02-26 00:58:06 +0330
committerAndreas Kling <kling@serenityos.org>2022-03-04 20:07:05 +0100
commit4bd01b7fe94d81c670420e77ed7bd3cbc3e6caeb (patch)
tree33312d898d2455031c7b46f8c80bc6d76b413c59 /Kernel/Arch
parent585054d68b0a2e0446cd1cf7205bdc93ca93818f (diff)
downloadserenity-4bd01b7fe94d81c670420e77ed7bd3cbc3e6caeb.zip
Kernel: Add support for SA_SIGINFO
We currently don't really populate most of the fields, but that can wait :^)
Diffstat (limited to 'Kernel/Arch')
-rw-r--r--Kernel/Arch/mcontext.h15
-rw-r--r--Kernel/Arch/x86/mcontext.h58
2 files changed, 73 insertions, 0 deletions
diff --git a/Kernel/Arch/mcontext.h b/Kernel/Arch/mcontext.h
new file mode 100644
index 0000000000..ee62f487bd
--- /dev/null
+++ b/Kernel/Arch/mcontext.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2022, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Platform.h>
+
+#if ARCH(X86_64) || ARCH(I386)
+# include <Kernel/Arch/x86/mcontext.h>
+#elif ARCH(AARCH64)
+# error "Unknown architecture"
+#endif
diff --git a/Kernel/Arch/x86/mcontext.h b/Kernel/Arch/x86/mcontext.h
new file mode 100644
index 0000000000..a01376ef98
--- /dev/null
+++ b/Kernel/Arch/x86/mcontext.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2022, the SerenityOS developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Platform.h>
+#include <Kernel/API/POSIX/sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct __attribute__((packed)) __mcontext {
+#if ARCH(I386)
+ uint32_t eax;
+ uint32_t ecx;
+ uint32_t edx;
+ uint32_t ebx;
+ uint32_t esp;
+ uint32_t ebp;
+ uint32_t esi;
+ uint32_t edi;
+ uint32_t eip;
+ uint32_t eflags;
+#else
+ uint64_t rax;
+ uint64_t rcx;
+ uint64_t rdx;
+ uint64_t rbx;
+ uint64_t rsp;
+ uint64_t rbp;
+ uint64_t rsi;
+ uint64_t rdi;
+ uint64_t rip;
+ uint64_t r8;
+ uint64_t r9;
+ uint64_t r10;
+ uint64_t r11;
+ uint64_t r12;
+ uint64_t r13;
+ uint64_t r14;
+ uint64_t r15;
+ uint64_t rflags;
+#endif
+ uint32_t cs;
+ uint32_t ss;
+ uint32_t ds;
+ uint32_t es;
+ uint32_t fs;
+ uint32_t gs;
+};
+
+#ifdef __cplusplus
+}
+#endif