aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/physical_core.cpp
diff options
context:
space:
mode:
authorlizzie <lizzie@eden-emu.dev>2025-11-03 20:36:38 +0100
committercrueter <crueter@eden-emu.dev>2025-11-03 20:36:38 +0100
commit82eb5a03f4713c039a379cedef9b3f7628b177fb (patch)
tree2cc9f65ba94cc6d3714d2f91747d57209fdb53dd /src/core/hle/kernel/physical_core.cpp
parent0e6ea2d9d66bc7bd4019ab10324e75e73e96f517 (diff)
[core/arm] introduce vtable bouncing (#2943)
Basically this just makes functions that go into zero-page or invalid addresses "bounce" back (with a return err of 0) such that it emulates a subroutine returning appropriatedly... this is mainly inspired by [this particular commit](https://git.citron-emu.org/Citron/Emulator/commit/fbb4f5c015d778ed0c8e2d91b01dcdffd7da9681); with the key difference of accounting for the scheduler fucking up some random bs. I don't like this hack but anyways maybe it fixes something? Signed-off-by: lizzie lizzie@eden-emu.dev Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2943 Reviewed-by: Maufeat <sahyno1996@gmail.com> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/core/hle/kernel/physical_core.cpp')
-rw-r--r--src/core/hle/kernel/physical_core.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 04f0010688..77cdab76d7 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -103,12 +103,26 @@ void PhysicalCore::RunThread(Kernel::KThread* thread) {
const bool data_abort = True(hr & Core::HaltReason::DataAbort);
const bool interrupt = True(hr & Core::HaltReason::BreakLoop);
+ bool may_abort = true; // Ignore aborting virtual functions (for debugging)
+ if (prefetch_abort && ::Settings::values.vtable_bouncing) {
+ auto& lock = m_kernel.GlobalSchedulerContext().SchedulerLock();
+ lock.Lock();
+ Kernel::Svc::ThreadContext ctx;
+ interface->GetContext(ctx);
+ LOG_WARNING(Core_ARM, "vtable bouncing {:016X}", ctx.lr);
+ ctx.pc = ctx.lr;
+ ctx.r[0] = 0;
+ interface->SetContext(ctx);
+ lock.Unlock();
+ may_abort = false;
+ }
+
// Since scheduling may occur here, we cannot use any cached
// state after returning from calls we make.
// Notify the debugger and go to sleep if a breakpoint was hit,
// or if the thread is unable to continue for any reason.
- if (breakpoint || prefetch_abort) {
+ if (breakpoint || (prefetch_abort && may_abort)) {
if (breakpoint) {
interface->RewindBreakpointInstruction();
}