forked from Bananymous/banan-os
Kernel: Add some more cxxabi functionality
We can now declate static variables in functions
This commit is contained in:
parent
f6b05212e0
commit
6cbad718fb
|
@ -1,3 +1,7 @@
|
|||
#include <kernel/LockGuard.h>
|
||||
#include <kernel/Panic.h>
|
||||
#include <kernel/SpinLock.h>
|
||||
|
||||
#define ATEXIT_MAX_FUNCS 128
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -109,6 +113,35 @@ 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__)));
|
||||
|
||||
int __cxa_guard_acquire (__guard* g)
|
||||
{
|
||||
Kernel::LockGuard lock_guard(s_spin_lock);
|
||||
return !*(int*)g;
|
||||
}
|
||||
|
||||
void __cxa_guard_release (__guard* g)
|
||||
{
|
||||
Kernel::LockGuard lock_guard(s_spin_lock);
|
||||
*(int*)g = 1;
|
||||
}
|
||||
|
||||
void __cxa_guard_abort (__guard*)
|
||||
{
|
||||
Kernel::panic("__cxa_guard_abort");
|
||||
__builtin_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue