mirror of
https://github.com/RGBCube/serenity
synced 2025-09-14 00:48:00 +00:00
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
This commit is contained in:
parent
dfe4810c3a
commit
e8f09279d3
4 changed files with 229 additions and 118 deletions
78
Kernel/Arch/aarch64/Spinlock.h
Normal file
78
Kernel/Arch/aarch64/Spinlock.h
Normal file
|
@ -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()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue