Skip to content

DSP: Fix missed external interrupts due to external interrupts being disabled #13463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

Pokechu22
Copy link
Contributor

This is a very old branch that I last haven't touched since 2023 (other than last rebasing it in September 2024). I haven't even confirmed it builds, but I think it used to fix https://bugs.dolphin-emu.org/issues/11384 based on my findings in #11319.

I believe I ran into issues with tests that were nondeterministic on real hardware, or perhaps just weirdness with cycle timings between different instructions. I don't remember the details.

@Pokechu22
Copy link
Contributor Author

Reverted commit from #11593, which was causing build failures. I'm not sure if it's still needed or not.

@JMC47
Copy link
Contributor

JMC47 commented Mar 29, 2025

The Mario Sunshine hang should be really easy to reproduce on master right now, as it seems to be happening on every boot. So, if this is working then that should boot.

@Pokechu22
Copy link
Contributor Author

This change definitely fixes SMS with the interpreter, and probably also with the recompiler (but since that's random I haven't been able to confirm it).

However, I did run into crashes and other weird hangs with DSPSpy and toggling settings (e.g. vsync), so there still seems to be an issue with the CPU thread (#11593). But that's probably separate.

@Pokechu22
Copy link
Contributor Author

I also thought I updated GameCube_DSP_Users_Manual.tex at some point but it looks like I didn't.

Pokechu22 added 6 commits June 6, 2025 00:17
Before, I was getting an abort() call in debug builds when selecting Tools -> Load Wii System Menu (although I'm not sure if this will work on other machines consistently). It seems that CodeViewWidget::Update was constructing a CPUThreadGuard instance, and thus was calling Core::PauseAndLock(true, true), but the CPU thread hadn't started yet so Core::IsRunningAndStarted() returned false and thus Core::PauseAndLock() did nothing. However, after the code widget finished updating, CPUThreadGuard's destructor called PauseAndLock(false, true), and by this time the CPU thread *had* started so Core::PauseAndLock eventually called CPU::PauseAndLock(false, true, true). This resulted in s_stepping_lock.unlock() being called without a corresponding s_stepping_lock.lock() call, which calls abort() in debug builds.
This affected my interrupt_nested test; SR_100 always is clear, but after using SBSET dolphin-emu#2, it was temporarily set. This doesn't really make sense (why do they have an instruction to set a bit that cannot be set? why does this bit even exist?) but this change makes behavior match real hardware. The recompiler behaved correctly (as it uses dsp_op_write_reg).
@Pokechu22 Pokechu22 force-pushed the dsp-missed-interrupts branch from 13ea2c7 to c8dcbb6 Compare June 6, 2025 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants