Kernel: Fix all broken locks from new mutexes

This commit is contained in:
2024-02-28 22:39:02 +02:00
parent 1971813336
commit d94f6388b7
66 changed files with 681 additions and 647 deletions

View File

@@ -1,6 +1,5 @@
#include <kernel/LockGuard.h>
#include <BAN/Atomic.h>
#include <kernel/Panic.h>
#include <kernel/SpinLock.h>
#define ATEXIT_MAX_FUNCS 128
@@ -115,22 +114,18 @@ void __cxa_finalize(void *f)
namespace __cxxabiv1
{
/* guard variables */
static Kernel::SpinLock s_spin_lock;
/* The ABI requires a 64-bit type. */
__extension__ typedef int __guard __attribute__((mode(__DI__)));
using __guard = uint64_t;
int __cxa_guard_acquire (__guard* g)
{
Kernel::LockGuard lock_guard(s_spin_lock);
return !*(int*)g;
auto& atomic = *reinterpret_cast<BAN::Atomic<__guard>*>(g);
return atomic == 0;
}
void __cxa_guard_release (__guard* g)
{
Kernel::LockGuard lock_guard(s_spin_lock);
*(int*)g = 1;
auto& atomic = *reinterpret_cast<BAN::Atomic<__guard>*>(g);
atomic = 1;
}
void __cxa_guard_abort (__guard*)