From 9ea278997c0d575d823dba3dbbb45d3eae997389 Mon Sep 17 00:00:00 2001
From: Jeremy Soller <jeremy@system76.com>
Date: Wed, 20 Oct 2021 20:05:47 -0600
Subject: [PATCH] Disable threaded syscalls until threaded allocation issues
 are solved

---
 Cargo.toml         | 4 +++-
 src/syscall/mod.rs | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index c58a7ec9..65a724eb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -42,13 +42,15 @@ raw-cpuid = "8.0.0"
 x86 = { version = "0.32.0", default-features = false }
 
 [features]
-default = ["acpi", "multi_core", "serial_debug"]
+default = ["acpi", "multi_core", "no_threaded_syscalls", "serial_debug"]
 acpi = []
 doc = []
 graphical_debug = []
 live = []
 lpss_debug = []
 multi_core = ["acpi"]
+#TODO: remove when threading issues are fixed
+no_threaded_syscalls = []
 pti = []
 qemu_debug = []
 serial_debug = []
diff --git a/src/syscall/mod.rs b/src/syscall/mod.rs
index 3955af57..5afa381d 100644
--- a/src/syscall/mod.rs
+++ b/src/syscall/mod.rs
@@ -253,8 +253,17 @@ pub fn syscall(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize, bp: u
         }
     }
 
+    #[cfg(feature = "no_threaded_syscalls")]
+    let syscall_lock = {
+        static SYSCALL_LOCK: spin::Mutex<()> = spin::Mutex::new(());
+        SYSCALL_LOCK.lock();
+    };
+
     let result = inner(a, b, c, d, e, f, bp, stack);
 
+    #[cfg(feature = "no_threaded_syscalls")]
+    drop(syscall_lock);
+
     {
         let contexts = crate::context::contexts();
         if let Some(context_lock) = contexts.current() {
-- 
GitLab