Browse Source
Revert "[core/memory] Remove defered heap allocation on Linux." (#2974)
Revert "[core/memory] Remove defered heap allocation on Linux." (#2974)
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2974 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: PavelBARABANOV <pavelbarabanov94@gmail.com> Co-committed-by: PavelBARABANOV <pavelbarabanov94@gmail.com>pull/2996/head
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
8 changed files with 151 additions and 28 deletions
-
79src/common/heap_tracker.cpp
-
1src/core/CMakeLists.txt
-
52src/core/arm/dynarmic/arm_dynarmic.cpp
-
20src/core/arm/dynarmic/arm_dynarmic.h
-
5src/core/arm/dynarmic/arm_dynarmic_32.cpp
-
5src/core/arm/dynarmic/arm_dynarmic_64.cpp
-
15src/core/memory.cpp
-
2src/core/memory.h
@ -0,0 +1,52 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
|
||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
|
||||
|
#ifdef __linux__
|
||||
|
|
||||
|
#include "common/signal_chain.h"
|
||||
|
|
||||
|
#include "core/arm/dynarmic/arm_dynarmic.h"
|
||||
|
#include "core/hle/kernel/k_process.h"
|
||||
|
#include "core/memory.h"
|
||||
|
|
||||
|
namespace Core { |
||||
|
|
||||
|
namespace { |
||||
|
|
||||
|
thread_local Core::Memory::Memory* g_current_memory{}; |
||||
|
std::once_flag g_registered{}; |
||||
|
struct sigaction g_old_segv {}; |
||||
|
|
||||
|
void HandleSigSegv(int sig, siginfo_t* info, void* ctx) { |
||||
|
if (g_current_memory && g_current_memory->InvalidateSeparateHeap(info->si_addr)) { |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
return g_old_segv.sa_sigaction(sig, info, ctx); |
||||
|
} |
||||
|
|
||||
|
} // namespace
|
||||
|
|
||||
|
ScopedJitExecution::ScopedJitExecution(Kernel::KProcess* process) { |
||||
|
g_current_memory = std::addressof(process->GetMemory()); |
||||
|
} |
||||
|
|
||||
|
ScopedJitExecution::~ScopedJitExecution() { |
||||
|
g_current_memory = nullptr; |
||||
|
} |
||||
|
|
||||
|
void ScopedJitExecution::RegisterHandler() { |
||||
|
std::call_once(g_registered, [] { |
||||
|
struct sigaction sa {}; |
||||
|
sa.sa_sigaction = &HandleSigSegv; |
||||
|
sa.sa_flags = SA_SIGINFO | SA_ONSTACK; |
||||
|
Common::SigAction(SIGSEGV, std::addressof(sa), std::addressof(g_old_segv)); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
} // namespace Core
|
||||
|
|
||||
|
#endif
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue