-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Return To Castle Wolfenstein: Crash in VM due to null pointer exception, possibly triggered by difference in cpuid
handling
#509
Comments
Very cool! It would be great if someone could volunteer to build a test bench app that does a full cpuid dump and comparison. I'm not sure it's been done yet. I seem to recall @GXTX doing something like this before but not sure where the app/results are. |
I'll probably take a stab at that shortly. Modifying cpu.c to blindly return the correct values for |
https://github.com/abaire/nxdk_check_cpuid XEMU:
XBOX (1.0):
|
Sadly even with blindly returning the values I retrieved from my XBOX it still crashes later on; will continue debugging. |
Interestingly, if I copy the game onto the Running from an iso consistently fails, though this time it seems like it's failing to alloc in a way that causes it to write to abaire@12da5ac has the change I applied that makes it work (off disk), but I need to update and redump as I see a note indicating that 4+ are only available if |
Reading more of the docs:
So I think the method can safely be updated to just return the 3 sets of values with a default == mode 2. |
Following a bit further, this seems to be related to the ATAPI handling in xemu. It looks like there is a global heap linked list that is getting corrupted when attempting to read from the virtual DVD device.The crash is set up in the depths of In the HDD case, the read results in This will break gdb at the interesting
After awhile it gets into code that I assume is doing the system call to the appropriate device, with paths diverging at |
Good work on the CPUID issue! As for the disc reading stuff: Where exactly is the game crashing? I am able to get in game without issue, with the patch for CPUID. As a sanity check before diving into the CDROM stack, how did you create your game ISO? I recommend using extract-xiso and ensuring the build is 32b; 64b builds are known to produce bad ISOs. |
Interesting, I'll try recreating, I probably used the version of extract-xiso that happened to be at head in the nxdk at the time. To the end user, the crash comes in the black screen between the copyright screen and the ESRB notice. Hopefully recreating the ISO fixes the issue for me as well - I can see the call to |
Yup, that was 100% the problem, thanks for saving me from more debugging! I wonder if there's a way to detect that an xiso was produced with the 64-bit build so that xemu could bomb out early and prevent erroneous error reports? |
Glad to hear it! xemu itself shouldn't care what the disc filesystem looks like. I think the best solution here would be to develop a solid ISO packing tool, and have it be able to do such checks; then suggest every user use that tool |
Makes sense. I just verified that an image built with 64-bit |
Title
https://xemu.app/titles/41560010/#Return-to-Castle-Wolfenstein-Tides-of-War
Bug Description
RTCW crashes shortly after boot while displaying the copyright screen. The underlying reason for the crash is that the client init function is never called due to the fact that it ends up having an unexpectedly changed value for the EBX register after calling
cpuid
at 0x00140c39. This leads to the init being skipped which ends up leading to a crash awhile later after initialization.On XEMU before
cpuid
:After the call:
On XBOX hardware:
After:
Expected Behavior
The guest machine should not crash and
cpuid
should emulate XBOX hardware in all modified registers.xemu Version
0.6.1-24-gc6e05f51b2
System Information
OS: Ubuntu (same crash happens on macOS and Windows)
GPU: GTX 1070
Additional Context
No response
The text was updated successfully, but these errors were encountered: