summaryrefslogtreecommitdiff
path: root/Kernel/Arch/aarch64
diff options
context:
space:
mode:
authorJames Mintram <me@jamesrm.com>2021-10-14 20:18:56 +0100
committerLinus Groh <mail@linusgroh.de>2021-10-15 21:48:45 +0100
commite8f09279d34d3bdcdb350016f2e72defc4bb9c7a (patch)
tree9c7c117ae1d415101237883bc44131f1f199ce6b /Kernel/Arch/aarch64
parentdfe4810c3a1c4ca0e4714a23da3f233b9babf270 (diff)
downloadserenity-e8f09279d34d3bdcdb350016f2e72defc4bb9c7a.zip
Kernel: Move spinlock into Arch
Spinlocks are tied to the platform they are built for, this is why they have been moved into the Arch folder. They are still available via "Locking/Spinlock.h" An Aarch64 stub has been created
Diffstat (limited to 'Kernel/Arch/aarch64')
-rw-r--r--Kernel/Arch/aarch64/Spinlock.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/Kernel/Arch/aarch64/Spinlock.h b/Kernel/Arch/aarch64/Spinlock.h
new file mode 100644
index 0000000000..5dd711b0d5
--- /dev/null
+++ b/Kernel/Arch/aarch64/Spinlock.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/Noncopyable.h>
+#include <AK/Types.h>
+#include <Kernel/Locking/LockRank.h>
+
+namespace Kernel {
+
+class Spinlock {
+ AK_MAKE_NONCOPYABLE(Spinlock);
+ AK_MAKE_NONMOVABLE(Spinlock);
+
+public:
+ Spinlock(LockRank rank = LockRank::None)
+ {
+ (void)rank;
+ }
+
+ ALWAYS_INLINE u32 lock()
+ {
+ return 0;
+ }
+
+ ALWAYS_INLINE void unlock(u32 /*prev_flags*/)
+ {
+ }
+
+ [[nodiscard]] ALWAYS_INLINE bool is_locked() const
+ {
+ return false;
+ }
+
+ ALWAYS_INLINE void initialize()
+ {
+ }
+};
+
+class RecursiveSpinlock {
+ AK_MAKE_NONCOPYABLE(RecursiveSpinlock);
+ AK_MAKE_NONMOVABLE(RecursiveSpinlock);
+
+public:
+ RecursiveSpinlock(LockRank rank = LockRank::None)
+ {
+ (void)rank;
+ }
+
+ ALWAYS_INLINE u32 lock()
+ {
+ return 0;
+ }
+
+ ALWAYS_INLINE void unlock(u32 /*prev_flags*/)
+ {
+ }
+
+ [[nodiscard]] ALWAYS_INLINE bool is_locked() const
+ {
+ return false;
+ }
+
+ [[nodiscard]] ALWAYS_INLINE bool is_locked_by_current_processor() const
+ {
+ return false;
+ }
+
+ ALWAYS_INLINE void initialize()
+ {
+ }
+};
+
+}