grumpycoders / pcsx-redux

The PCSX-Redux project is a collection of tools, research, hardware design, and libraries aiming at development and reverse engineering on the PlayStation 1. The core product itself, PCSX-Redux, is yet another fork of the Playstation emulator, PCSX.
https://pcsx-redux.consoledev.net
GNU General Public License v2.0
626 stars 94 forks source link

Interpreter-JIT discrepancies #430

Open wheremyfoodat opened 3 years ago

wheremyfoodat commented 3 years ago

Some ROMs show different behavior between the 2 CPU cores, and are even broken in the latter Example 1: Relevant files (reposting with the author's permission): https://cdn.discordapp.com/attachments/466353899670863873/806240805073190973/psx.bin https://cdn.discordapp.com/attachments/466353899670863873/806460090336149514/psx.cue

On the interpreter, this shows an anime girl listening to music, as it should On the JIT, there's no anime girl nor music to be found.

image image

Example 2: The BIOS shell (with my memcard) is colored differently between the 2 CPU cores Picture 1 is interpreter, picture 2 is JIT

image image

My memory card: memcard1.zip

nicolasnoble commented 3 years ago

The bios' color is supposed to be random, isn't it?

wheremyfoodat commented 3 years ago

JIT: Tekken 2 has broken graphics. I'd initially thought this would be due to the game's weird handling of GPU DMAs (being the icon of infinite linked list DMAs), but this works in the interpreter and should be before it issues any weird DMA image

wheremyfoodat commented 3 years ago

The bios' color is supposed to be random, isn't it?

I believe it's generated based on memcard contents? Not sure

nicolasnoble commented 3 years ago

Not sure where it's taking its entropy from.

wheremyfoodat commented 3 years ago

I'll change my memcard contents as an experiment and see if the color changes

wheremyfoodat commented 3 years ago

After changing my memory card contents, the screen seems to stay the same image Not sure on the entropy source now.

nicolasnoble commented 3 years ago

To be fair, the only "good" source of srand would be root counters. JIT and Interpreter have different cycle bias in general due to differences in memory access functions. This might be what's happening here. A good test would be to fuzz the delay of the cdrom interrupts, which would definitely influence the value of the root counters when the shell decides to pop into the menu. There's interrupt scalers for this.

wheremyfoodat commented 3 years ago

I'll make sure tomorrow but yeah seems to be timing-dependent, will have to look deeper for the other ones though.

There's also the "JIT literally segfaults on Amidog's CPU test" thing which makes it harder to debug, regrettably.

wheremyfoodat commented 3 years ago

JIT jumps to this point in the BIOS (system exit) in Gran Turismo, after several failed CDFileQuery calls, and hangs. image

Screen where it hangs image

Last CD-ROM activity before hanging (same sequence of commands gets repeated a few times) image

wheremyfoodat commented 2 years ago

Gran Turismo works on x86-64 JIT

wheremyfoodat commented 2 years ago

JIT: Tekken 2 has broken graphics. I'd initially thought this would be due to the game's weird handling of GPU DMAs (being the icon of infinite linked list DMAs), but this works in the interpreter and should be before it issues any weird DMA image

This relies on GTE->GPR loads (MFC2/CFC2) being delayed

wheremyfoodat commented 2 years ago

Tekken has been fixed on the x64 backend in #744

wheremyfoodat commented 2 years ago

Cross post from #850: Disney's Tarzan reportedly works on x64, not on x86-32

StanleyKid-22 commented 2 years ago

Cross post from #850: Disney's Tarzan reportedly works on x64, not on x86-32

I clarify issue: it was about ROM's version 1.1. 1.0 works great on x86-32.

StanleyKid-22 commented 2 years ago

x86-32 Gekido: Urban Fighters and Metal Slug X shutdown emulator altogether. Mortal Kombat 4 works, but rarely crashes on intro movies.

wheremyfoodat commented 2 years ago

Oh, nice catch, thanks