mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
LibC: Remove the initialization workaround from s_allocation_enabled
This commit is contained in:
parent
3f59cb5e70
commit
7c824b84e2
2 changed files with 1 additions and 12 deletions
|
@ -291,9 +291,7 @@ enum class CallerWillInitializeMemory {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef NO_TLS
|
#ifndef NO_TLS
|
||||||
// HACK: This is a __thread - marked thread-local variable. If we initialize it globally here, VERY weird errors happen.
|
__thread bool s_allocation_enabled = true;
|
||||||
// The initialization happens in __malloc_init() and pthread_create_helper().
|
|
||||||
__thread bool s_allocation_enabled;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static ErrorOr<void*> malloc_impl(size_t size, size_t align, CallerWillInitializeMemory caller_will_initialize_memory)
|
static ErrorOr<void*> malloc_impl(size_t size, size_t align, CallerWillInitializeMemory caller_will_initialize_memory)
|
||||||
|
@ -697,12 +695,6 @@ void* realloc(void* ptr, size_t size)
|
||||||
|
|
||||||
void __malloc_init()
|
void __malloc_init()
|
||||||
{
|
{
|
||||||
#ifndef NO_TLS
|
|
||||||
// HACK: This is a __thread - marked thread-local variable. If we initialize it globally, VERY weird errors happen.
|
|
||||||
// Therefore, we need to do the initialization here and in pthread_create_helper().
|
|
||||||
s_allocation_enabled = true;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
s_in_userspace_emulator = (int)syscall(SC_emuctl, 0) != -ENOSYS;
|
s_in_userspace_emulator = (int)syscall(SC_emuctl, 0) != -ENOSYS;
|
||||||
if (s_in_userspace_emulator) {
|
if (s_in_userspace_emulator) {
|
||||||
// Don't bother scrubbing memory if we're running in UE since it
|
// Don't bother scrubbing memory if we're running in UE since it
|
||||||
|
|
|
@ -64,9 +64,6 @@ extern "C" {
|
||||||
|
|
||||||
static void* pthread_create_helper(void* (*routine)(void*), void* argument, void* stack_location, size_t stack_size)
|
static void* pthread_create_helper(void* (*routine)(void*), void* argument, void* stack_location, size_t stack_size)
|
||||||
{
|
{
|
||||||
// HACK: This is a __thread - marked thread-local variable. If we initialize it globally, VERY weird errors happen.
|
|
||||||
// Therefore, we need to do the initialization here and in __malloc_init().
|
|
||||||
s_allocation_enabled = true;
|
|
||||||
s_stack_location = stack_location;
|
s_stack_location = stack_location;
|
||||||
s_stack_size = stack_size;
|
s_stack_size = stack_size;
|
||||||
void* ret_val = routine(argument);
|
void* ret_val = routine(argument);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue