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

Illegal instruction with White Knight Chronicles Origin on alpine linux #14538

Closed
4 tasks done
sodomon2 opened this issue Jun 17, 2021 · 28 comments
Closed
4 tasks done

Illegal instruction with White Knight Chronicles Origin on alpine linux #14538

sodomon2 opened this issue Jun 17, 2021 · 28 comments

Comments

@sodomon2
Copy link

sodomon2 commented Jun 17, 2021

Hi.

What happens?

The game crashes right after finishing the train ride.

What should happen?

you should save the game and let me continue the story.

What are you using?

What hardware / device and operating system?

Hardware: Intel powered classmate PC Clamshell
Operating system: Alpine Linux v3.11 x86_64

What graphics card (GPU) or mobile phone model?

What PPSSPP version (standalone/official), and did it work before?

PPSSPP v1.11.0

Which game or games?

UCES01511

Checklist

  • Test in the latest git build in case it's already fixed.
  • Search for other reports of the same issue.
  • Try resetting settings or older versions and include if the issue is related.
  • Include logs or screenshots of issue.

UCES01511.log

screenshot-1
screenshot-2

@anr2me
Copy link
Collaborator

anr2me commented Jun 18, 2021

v1.11.0 is a bit old isn't? there have been many crash fix since that version on dev build
you should get the log from the latest master, and it would be nice to get the debug log instead of info log (you will need to build the debug version of PPSSPP to get the debug log)

@sodomon2
Copy link
Author

v1.11.0 is a bit old isn't? there have been many crash fix since that version on dev build
you should get the log from the latest master, and it would be nice to get the debug log instead of info log (you will need to build the debug version of PPSSPP to get the debug log)

I must say that I found this bug in the game in version v1.8.0 and still in v1.11.0 it had not been corrected

but well I will build version 1.11.3 or if not the master version and I will check it :)

@iota97
Copy link
Contributor

iota97 commented Jun 18, 2021

Illegal instruction happen when your CPU does not support some assembly instruction usually. Does this happen even with interpreter or IR CPU backend or is JIT only? It could also mean the binary was build with some CPU specific flag that your CPU does not support, have you tried build PPSSPP yourself?

@sodomon2
Copy link
Author

sodomon2 commented Jun 18, 2021

Illegal instruction happen when your CPU does not support some assembly instruction usually. Does this happen even with interpreter or IR CPU backend or is JIT only? It could also mean the binary was build with some CPU specific flag that your CPU does not support, have you tried build PPSSPP yourself?

Ok, I switched to IR interperter and the game still gives illegal instruction.

yes, actually ppsspp is compiled by myself as alpine is not glibc and only supports musl

the ppsspp building instructions I gave you were as follows:
cmake -DUSE_SYSTEM_FFMPEG=ON -DUSING_QT_UI=ON ..

@sodomon2
Copy link
Author

I think that might be related to my problem.

#997
#5046

@unknownbrackets
Copy link
Collaborator

Please try compiling the version of FFmpeg (3.0.2) inside ffmpeg/ and don't use system FFmpeg. To properly emulate PSP game behavior, PPSSPP needs to use some APIs of FFmpeg that were removed in later versions, so using system FFmpeg disables some functionality.

It seems like the illegal instruction happens right around playing a video, so your FFmpeg build seems suspect.

I guess you probably have an Intel Atom N270. and this supports up to SSSE3 but not SSE4:
https://ark.intel.com/content/www/us/en/ark/products/36331/intel-atom-processor-n270-512k-cache-1-60-ghz-533-mhz-fsb.html

We dynamically detect SSE4 support in PPSSPP, even for the jit. But your FFmpeg package may have been compiled with SSE4 support baked in (incorrectly.) Recompiling the older version we recommend using anyway may therefore help this issue and others you haven't (yet) noticed from the newer FFmpeg.

-[Unknown]

@sodomon2
Copy link
Author

@unknownbrackets do you mean compile the ffmpeg version from hrydgard or download the official ffmpeg version 3.0.2 and compile it inside the ffmpeg directory?

@unknownbrackets
Copy link
Collaborator

Either one. I'd recommend the fork because it has a build script, but it's actually just original FFmpeg 3.0.2 code. So you can compile ffmpeg/ffmpeg 3.0.2 as well.

-[Unknown]

@sodomon2
Copy link
Author

@unknownbrackets I have compiled the ffmpeg with the script and downloaded ppsspp version 1.11.3 but it keeps giving Illegal instruction

@unknownbrackets
Copy link
Collaborator

Darn. In that case the best thing would be the capture the error in gdb so we can see the detail:

#11312 (comment)

For getting a backtrace, you'd first need gdb, installed via package manager:
http://www.gdbtutorial.com/tutorial/how-install-gdb

Next, you'll ideally want to compile PPSSPP yourself (this is easy, even if you're using a ppa or something right now.) That's done like this:

sudo apt-get install git cmake build-essential libsdl2-dev libgl1-mesa-dev libglu1-mesa-dev
git clone --recurse-submodules https://github.com/hrydgard/ppsspp.git
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
gdb ./PPSSPPSDL

At this point you should see a line like this:

(gdb)

You can exit any time by typing "quit". But to continue, type "run". Then just reproduce the issue.

At some point, when it crashes, you should see that (gdb) prompt again in the terminal window. Once it does, type bt or backtrace. Then paste the output of that here.

It will log messages within the terminal window as well, above the (gdb) line when it crashes.

-[Unknown]

@sodomon2
Copy link
Author

sodomon2 commented Jun 21, 2021

@unknownbrackets Oh, what a surprise I got when I ran the game with PPSSPP debugging.

It turns out that after doing the train ride the game didn't crash for some strange reason.

As it doesn't crash I don't think the backtrace shows the error, anyway here I leave it.

(gdb) 
(gdb) bt
#0  0x00007ffff7fada12 in kill () from /lib/ld-musl-x86_64.so.1
#1  0x0000000000005b3a in ?? ()
#2  0x0000555555c7f886 in GLRenderManager::~GLRenderManager (this=0x55555724d650, __in_chrg=<optimized out>)
    at ../Common/GPU/OpenGL/GLRenderManager.cpp:120
#3  0x0000555555c7730f in Draw::OpenGLContext::~OpenGLContext (this=0x55555724d520, __in_chrg=<optimized out>)
    at ../Common/GPU/OpenGL/thin3d_gl.cpp:672
#4  0x0000555555c77336 in Draw::OpenGLContext::~OpenGLContext (this=0x55555724d520, __in_chrg=<optimized out>)
    at ../Common/GPU/OpenGL/thin3d_gl.cpp:677
#5  0x00005555556724e2 in QtGLGraphicsContext::~QtGLGraphicsContext (this=0x555556f03400, __in_chrg=<optimized out>)
    at ../Qt/QtMain.h:63
#6  0x0000555555672522 in QtGLGraphicsContext::~QtGLGraphicsContext (this=0x555556f03400, __in_chrg=<optimized out>)
    at ../Qt/QtMain.h:66
#7  0x000055555566e658 in MainUI::~MainUI (this=0x555556eb70a0, __in_chrg=<optimized out>) at ../Qt/QtMain.cpp:382
#8  0x000055555566e6a4 in MainUI::~MainUI (this=0x555556eb70a0, __in_chrg=<optimized out>) at ../Qt/QtMain.cpp:384
#9  0x000055555566e1e2 in mainInternal (a=...) at ../Qt/QtMain.cpp:315
#10 0x000055555566ff06 in main (argc=1, argv=0x7fffffffe708) at ../Qt/QtMain.cpp:740
(gdb) Quit

2021-06-20_22-04

@unknownbrackets
Copy link
Collaborator

https://github.com/hrydgard/ppsspp/blob/master/Common/GPU/OpenGL/GLRenderManager.cpp#L120

Hmm, that isn't great but should've only happened when shutting down.

Maybe it's from compiling in debug mode? You can try release mode again and see if it's any clearer.

-[Unknown]

@sodomon2
Copy link
Author

ok, this is the backtrace it is from the release version
2021-06-21_01-58

@anr2me
Copy link
Collaborator

anr2me commented Jun 21, 2021

Try switching to assembly layout to get more info like mentioned here https://stackoverflow.com/questions/10354147/find-which-assembly-instruction-caused-an-illegal-instruction-error-without-debu

(gdb) layout asm
>|0x7f58e9efd019  vpmaskmovd (%r8),%ymm15,%ymm0
 |0x7f58e9efd01e  vpmaskmovd %ymm0,%ymm15,(%rdi)
 |0x7f58e9efd023  add    $0x4,%rdi
 |0x7f58e9efd027  add    $0x0,%rdi

@sodomon2
Copy link
Author

sodomon2 commented Jul 4, 2021

I have done this, I have run layout asm and activated everything else, but it gives me an endless list.

2

@unknownbrackets
Copy link
Collaborator

https://stackoverflow.com/questions/11140136/whats-the-purpose-of-the-ud2-opcode-in-the-linux-kernel

So that might indicate an assert tripped or an exception was thrown. At least it seems clear this isn't some SSE op or similar that's unsupported.

Sorry, can you try building one more time, but this time using "RelWithDebInfo"? I'm hoping that'll still trip the error as before but show a proper stack trace.

-[Unknown]

@sodomon2
Copy link
Author

sodomon2 commented Jul 5, 2021

@unknownbrackets I have already compiled it as RelWithDebInfo and this is the backtrace

[Switching to LWP 18598]
Replace_memcpy () at ../Core/HLE/ReplaceTables.cpp:144
144					memcpy(dst + offset, src + offset, 0x10);
(gdb) backtrace
#0  Replace_memcpy () at ../Core/HLE/ReplaceTables.cpp:144
#1  0x000055553569f682 in ?? ()
#2  0x00005555564d360c in pixel_xres ()
#3  0x00005555564d360c in pixel_xres ()
#4  0x00005555564d3610 in dp_yres ()
#5  0x00005555564849e0 in config_filename[abi:cxx11] ()
#6  0x0000555556c9a200 in ?? ()
#7  0x000000058268fb95 in ?? ()
#8  0x000055555647da2c in ?? ()
#9  0x00005555558ad74a in MIPSState::RunLoopUntil (this=<optimized out>, globalTicks=146419588, globalTicks@entry=23662754709)
    at ../Core/MIPS/MIPS.cpp:316
#10 0x00005555558cf8eb in PSP_RunLoopUntil (globalticks=23662754709) at ../Core/System.cpp:554
#11 PSP_RunLoopUntil (globalticks=23662754709) at ../Core/System.cpp:545
#12 0x00005555558cf984 in PSP_RunLoopWhileState () at ../Core/System.cpp:537
#13 0x00005555556ce49f in EmuScreen::render (this=0x555557732740) at ../UI/EmuScreen.cpp:1520
#14 0x0000555555ace2ca in ScreenManager::render (this=0x55555688eb60) at ../Common/UI/Screen.cpp:177
#15 0x00005555556a7be4 in NativeRender (graphicsContext=0x55555694fa20) at ../UI/NativeApp.cpp:1109
#16 0x000055555569561d in MainUI::EmuThreadFunc (this=0x555556901b20) at ../Qt/QtMain.cpp:329
#17 0x00007ffff6888045 in ?? () from /usr/lib/libstdc++.so.6
#18 0x00007ffff7fba71e in ?? () from /lib/ld-musl-x86_64.so.1
#19 0x0000000000000000 in ?? ()
(gdb) 
#0  Replace_memcpy () at ../Core/HLE/ReplaceTables.cpp:144
#1  0x000055553569f682 in ?? ()
#2  0x00005555564d360c in pixel_xres ()
#3  0x00005555564d360c in pixel_xres ()
#4  0x00005555564d3610 in dp_yres ()
#5  0x00005555564849e0 in config_filename[abi:cxx11] ()
#6  0x0000555556c9a200 in ?? ()
#7  0x000000058268fb95 in ?? ()
#8  0x000055555647da2c in ?? ()
#9  0x00005555558ad74a in MIPSState::RunLoopUntil (this=<optimized out>, globalTicks=146419588, globalTicks@entry=23662754709)
    at ../Core/MIPS/MIPS.cpp:316
#10 0x00005555558cf8eb in PSP_RunLoopUntil (globalticks=23662754709) at ../Core/System.cpp:554
#11 PSP_RunLoopUntil (globalticks=23662754709) at ../Core/System.cpp:545
#12 0x00005555558cf984 in PSP_RunLoopWhileState () at ../Core/System.cpp:537
#13 0x00005555556ce49f in EmuScreen::render (this=0x555557732740) at ../UI/EmuScreen.cpp:1520
#14 0x0000555555ace2ca in ScreenManager::render (this=0x55555688eb60) at ../Common/UI/Screen.cpp:177
#15 0x00005555556a7be4 in NativeRender (graphicsContext=0x55555694fa20) at ../UI/NativeApp.cpp:1109
#16 0x000055555569561d in MainUI::EmuThreadFunc (this=0x555556901b20) at ../Qt/QtMain.cpp:329
#17 0x00007ffff6888045 in ?? () from /usr/lib/libstdc++.so.6
#18 0x00007ffff7fba71e in ?? () from /lib/ld-musl-x86_64.so.1
#19 0x0000000000000000 in ?? ()
(gdb)

@unknownbrackets
Copy link
Collaborator

Okay, this seems like an assert from the memcpy parameters. This could mean that the size of the copy goes outside valid memory, which is a bit strange. A few possibilities:

  • Maybe there's corruption in your ISO. Please double check the CRC.
  • Maybe you're using cheats, or used when creating some savedata?
  • Maybe your save directory includes corrupted save data that's being read, even if you're not using it.

That said, I suspect we might be able to workaround this glitch - at least not crash. Try patching Core/HLE/ReplaceTables.cpp. Find:

		if (!dst || !src) {
			// Already logged.

And replace as a test:

		if (!dst || !src || bytes != Memory::ValidSize(srcPtr, bytes) || bytes != Memory::ValidSize(destPtr, bytes)) {
			// Already logged (unless size.)

There might however be other issues, because the game should've never done this in the first place.

-[Unknown]

@sodomon2
Copy link
Author

@unknownbrackets I have patched it and recompiled it but it still crashes.

@unknownbrackets
Copy link
Collaborator

Sorry for the latency - been very busy on some days.

If this still crashes in memcpy, maybe there's something wrong with my patch or assumptions. If it now has a slightly different crash stack trace, it likely means just more is going wrong. At that point, I'd start to wonder more why this is happening to you but not others.

Did you double check the CRC? I know when I ripped one of my UMDs, I somehow got a bad rip with some errors. I redid it and got a valid one.

-[Unknown]

@sodomon2
Copy link
Author

@unknownbrackets CRC?

@LunaMoo
Copy link
Collaborator

LunaMoo commented Jul 17, 2021

CRC(cyclic redundancy check) is just checksum of the file ~ uncompressed iso, not cso or pbp althrough if you do it from PPSSPP it'll calculate iso crc from any format.

Files can get damaged or corrupted, without confirming it's a 100% proper copy the most likely problem is that you're just using broken iso. You can just pause the game in PPSSPP and if you didn't used any hacks nor cheats you should have an option to "Report Feedback" if it's grayed out, restore safe(default) settings, disable cheats and restart emulation. Once in the report screen you can calculate disc CRC. If you do have reporting option grayed out, chances are some dangerous settings are cause of the problem in the first place.

This game like many others have broken warez copies flying around the net due to imperfect ways of dumping UMD's in the early days, if you downloaded a pirated copy or used PSP with really outdated firmware to make your backup chances are high it's just broken.

@anr2me
Copy link
Collaborator

anr2me commented Jul 18, 2021

Hmm.. where is this "Report Feedback" supposed to exist? i never saw this before >.< not even a grayed out one

Was it supposed to be on this screen?
image

PS: I was just curious with how to get CRC from PPSSPP so i use Fat Princess for the screenshot

@unknownbrackets
Copy link
Collaborator

Yeah, that's where it shows. But it hides it if you're using dangerous settings:

if (Reporting::IsSupported() && g_paramSFO.GetValueString("DISC_ID").size()) {

// Disabled when using certain hacks, because they make for poor reports.

-[Unknown]

@anr2me
Copy link
Collaborator

anr2me commented Jul 18, 2021

Hmm.. i have cheat disabled, but i have some files in plugin folder, is plugins included as dangerous?
I'm not sure about hacks... is that PPSSPP settings or was it a patched ISO?
if it's PPSSPP settings is there any list of settings that affects it?

@LunaMoo
Copy link
Collaborator

LunaMoo commented Jul 18, 2021

I think I saw it grayed out at some point, but yeah it's just hidden. The list of stuff that hides it is under the second code [Unknown] posted, basically:

  • Cheats,
  • Plugins,
  • Locked PSP CPU speed,
  • Disabled JIT Flags,
  • Build without git version info,
  • Lack of proper GameID,
  • Missing fonts.

are what causing that option to hide, and it will continue to be hidden until you fix all of that and restart emulation, it will also forever be hidden in already affected savestates.

If you enable compatibility server reports under system settings, that feature will allow to fill a short compat survey and send the data with optional screenshot which you can later see in https://report.ppsspp.org/
But even without enabling compatibility reports, you can use it to calculate game's CRC.

@unknownbrackets
Copy link
Collaborator

Is this still an issue in the latest git builds? Were you able to confirm your disc's CRC?

-[Unknown]

@unknownbrackets
Copy link
Collaborator

This issue is being closed because it hasn't been updated with feedback.

It's hard to tell when fixes in PPSSPP might fix other games, and sometimes certain settings or cheats may cause bugs that can't be fixed.

If you have more information or can confirm it still happens in the latest git builds, please reply to this issue and it'll be reopened. If you have a new issue with the same game, just create a new issue instead.

-[Unknown]

@unknownbrackets unknownbrackets closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2022
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

5 participants