Skip to content
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

[BUG]: Crash when LoadExecPS2 is called in 128MB mode using old BIOS #11234

Open
DaZombieKiller opened this issue May 12, 2024 · 0 comments
Open

Comments

@DaZombieKiller
Copy link
Contributor

Describe the Bug

Note this is not necessarily a bug in the emulator itself, but it's a crash that can potentially be fixed emulator-side. This issue is intended to discuss an appropriate fix before a PR is prepared.

When a game switches ELFs using LoadExecPS2 with 128MB RAM mode enabled, the emulator may crash if the user has an older BIOS version. This is because some older BIOS versions do not have an entry for syscall 0x82 (_InitTLB)*. When the userland InitTLB function is run, it branches on the result of GetMemorySize(), calling InitTLB32MB when it is 0x2000000 or invoking the _InitTLB syscall otherwise.

* Despite _InitTLB not being present in the syscall table, the function itself does seem to exist within the BIOS.

This issue is currently confirmed to occur with BIOS 1.60, but it presumably occurs in all prior versions too. It is not yet known if any later versions exhibit the problem.

After determining affected BIOS versions or finding a way to tell if the _InitTLB syscall is missing, possible solutions could be:

  • HLE emulate the _InitTLB syscall on affected BIOS versions.
    • This seems like the most appropriate solution to me, though I'm not sure of the specifics of what _InitTLB does.
  • Don't intercept the GetMemorySize syscall for affected BIOS versions.
    • Not an ideal solution, but it would force games to still use InitTLB32MB instead of the BIOS implementation.
  • Display an additional startup warning when 128MB mode is used with an affected BIOS version.
  • Disable or disallow 128MB mode for affected BIOS versions.

Reproduction Steps

Option 1

  1. Enable 128MB RAM mode.
  2. Boot up a game that switches the running ELF.
  3. Reach a point where the ELF switch occurs.
  4. Observe the crash.

Option 2

  1. Enable 128MB RAM mode.
  2. Enable Host Filesystem.
  3. Boot main.elf (with load.elf next to it) from the samples provided in CDVD: Improve handling of host: paths in cdvdLoadElf #11195.
  4. Observe the crash.

Expected Behavior

No response

PCSX2 Revision

v1.7.5801

Operating System

Windows 11

If Linux - Specify Distro

No response

CPU

Ryzen 9 3900X

GPU

GTX 2080 Super

GS Settings

No response

Emulation Settings

No response

GS Window Screenshots

No response

Logs & Dumps

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants