summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-09 08:16:00 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-09 08:58:26 +0100
commit84725ef3a5dfe9fb52f61af770b59d56de0b6f25 (patch)
tree9f3c7db7cf6c5b1e2adb94e098749f121c9296f4 /Kernel/Syscalls
parentd650b38eb9437347017039efc4652a116880023e (diff)
downloadserenity-84725ef3a5dfe9fb52f61af770b59d56de0b6f25.zip
Kernel+UserspaceEmulator: Add sys$emuctl() system call
This returns ENOSYS if you are running in the real kernel, and some other result if you are running in UserspaceEmulator. There are other ways we could check if we're inside an emulator, but it seemed easier to just ask. :^)
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/emuctl.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/Kernel/Syscalls/emuctl.cpp b/Kernel/Syscalls/emuctl.cpp
new file mode 100644
index 0000000000..872d7aeead
--- /dev/null
+++ b/Kernel/Syscalls/emuctl.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <Kernel/Process.h>
+
+namespace Kernel {
+
+KResultOr<int> Process::sys$emuctl()
+{
+ return ENOSYS;
+}
+
+}