Closed ksco closed 1 year ago
First thing is to know if it works without dynarec.
Just tried, and it works without Dynarec.
Actually, it doesn't work either but goes much further than Dynarec. It segfaulted when first screen appears.
5113|SIGSEGV @(nil) (???((nil))) (x64pc=0x3f8b6d5899/lib/libsfml-audio.so.2.5:"lib/libsfml-audio.so.2.5/_ZN12_GLOBAL__N_19streamEofEPK19FLAC__StreamDecoderPv + 9", rsp=0x101ffe9a0), for accessing (nil) (code=1)
RAX:0x0000000000000000 RCX:0x0000003f8b6d5850 RDX:0x0000003f8b6d5830 RBX:0x0000000000000000
RSP:0x0000000101ffe9a0 RBP:0x0000000101ffe9c0 RSI:0x0000000000000000 RDI:0x00000000366ba820
R8:0x0000003f8b6d5870 R9:0x0000003f8b6d5890 R10:0x0000000101ffe7c0 R11:0xfffffffffffffff7
R12:0x0000003f8b9ccdd0 R13:0x000000000043e9a1 R14:0x0000000101ffea50 R15:0x00000000006360e0
NativeBT: NecroDancer.x64() [0x349ad020]
NativeBT: linux-vdso.so.1(__vdso_rt_sigreturn+0) [0x3f8c610800]
NativeBT: /lib/riscv64-linux-gnu/libc.so.6(+0x6bbf8) [0x3f8c536bf8]
NativeBT: /lib/riscv64-linux-gnu/libc.so.6(gsignal+0x12) [0x3f8c5013fe]
NativeBT: NecroDancer.x64() [0x34a0a234]
NativeBT: NecroDancer.x64() [0x34ad6b1a]
NativeBT: NecroDancer.x64() [0x34998474]
NativeBT: NecroDancer.x64() [0x349ac42c]
NativeBT: NecroDancer.x64() [0x349ac92c]
NativeBT: NecroDancer.x64() [0x349ad08a]
NativeBT: linux-vdso.so.1(__vdso_rt_sigreturn+0) [0x3f8c610800]
NativeBT: NecroDancer.x64() [0x34ad781a]
NativeBT: NecroDancer.x64() [0x34998474]
NativeBT: NecroDancer.x64() [0x3498d2fa]
NativeBT: NecroDancer.x64() [0x349b219a]
NativeBT: NecroDancer.x64() [0x34a2f71e]
NativeBT: /usr/lib/riscv64-linux-gnu/libFLAC.so.8(+0x27d1e) [0x3f887a3d1e]
EmulatedBT: ??? [0x1f01c0]
EmulatedBT: /root/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64(_ZN12_GLOBAL__N_117handleCrashSignalEi+119) [0x723669]
EmulatedBT: ??? [0x300c0]
EmulatedBT: lib/libsfml-audio.so.2.5(_ZN2sf4priv19SoundFileReaderFlac5checkERNS_11InputStreamE+9c) [0x3f8b6d613c]
EmulatedBT: lib/libsfml-audio.so.2.5(_ZN2sf16SoundFileFactory22createReaderFromMemoryEPKvm+7a) [0x3f8b6d4eca]
EmulatedBT: ??? [0x3f3fbc1010]
5113|SIGABRT @(nil) (???((nil))) (x64pc=0x1f01d3/???:"???", rsp=0x101ffe260), for accessing 0x13f9 (code=-6)
RAX:0x0000000000000000 RCX:0x0000000000000000 RDX:0x000000000000000f RBX:0x0000000000000000
RSP:0x0000000101ffe260 RBP:0x0000000101ffe298 RSI:0x0000000000000000 RDI:0x0000000000000006
R8:0x0000003f88f96720 R9:0x0000000000f3e720 R10:0x0000003f88f96780 R11:0xfffffffffffffff7
R12:0x0000000000000000 R13:0x0000000101ffe2a8 R14:0x0000000101ffea50 R15:0x00000000006360e0
5113|Double SIGABRT (code=-6, pc=(nil), addr=0x13f9)!
Sigfault/Segbus while quitting, exiting silently
LIBGL: Shuting down
Sigfault/Segbus while quitting, exiting silently
So, you need to use BOX64_LOAD_ADDR=0x10000000
to fix address of loaded libs and a few other stuff, and
BOX64_DYNAREC_DUMP=2
dumpBOX64_NODYNAREC=0xAAAA-0xBBBBB
to find the block of dynarec that is causing the issue.For the dump, it's much better to have a TRACE enable build, with libZydis.so availbale so x64 opcode are completly decoded. I can send you a build of that lib if you want (or build it yourself, but you need v2.3 iirc, as the current 3.x will not work anymore as the ABI changed, and of course 2.3 doen't build on rv64, you need to hack a .h file, to use arm64 path for example)
Ok, I'll try to debug it tomorrow, at least get to the point where the interpreter fails also. The BOX64_NODYNAREC
option looks fancy, didn't know we have this one available!
I can send you a build of that lib if you want
Please send me a copy (via email?), that looks nontrivial to get one on my own. ;)
Probably this is not a dynarec issue? I tried to replace the vendor version of libluajit-5.1.so.2 with Arch Linux one (luajit 2.1.0.beta3.r471.g505e2c03-1), and the game successfully ran to the first screen and segfaulted while dynarec is on, and got similar result like @ksco when dynarec is off.
316796|SIGSEGV @0x3d7f88f0 (???(0x3d7f88f0)) (x64pc=0x400150f899/lib/libsfml-audio.so.2.5:"lib/libsfml-audio.so.2.5/_ZN12_GLOBAL__N_19streamEofEPK19FLAC__StreamDecoderPv", rsp=0x101ffe510, stack=0x101800000:0x102000000 own=(nil) fp=0x101ffe530), for accessing 0x246 (code=1/prot=0), db=0x411c53c018(0x3d7f88d8:0x3d7f89a0/0x400150f890:0x400150f8a2/lib/libsfml-audio.so.2.5/_ZN12_GLOBAL__N_19streamEofEPK19FLAC__StreamDecoderPv:clean, hash:af2d0f5b/af2d0f5b) handler=0x723550
RAX:0x0000000000000000 RCX:0x000000400150f850 RDX:0x000000400150f830 RBX:0x0000000000000246
RSP:0x0000000101ffe510 RBP:0x0000000101ffe530 RSI:0x0000000000000246 RDI:0x0000000037aaa2a0
R8:0x000000400150f870 R9:0x000000400150f890 R10:0x0000000101ffe330 R11:0xfffffffffffffff7
R12:0x0000004001806dd0 R13:0x000000000043e9a1 R14:0x0000000101ffe5c0 R15:0x00000000006360e0
RSP-0x20:0x0000004001f62250 RSP-0x18:0x0000000101ffe5a0 RSP-0x10:0x0000000101ffe560 RSP-0x08:0x00000000369fc290
RSP+0x00:0x000000000000017e RSP+0x08:0x0000000037aaa2a0 RSP+0x10:0x0000000101ffe530 RSP+0x18:0x00000000000300c0
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x349b09a2]
NativeBT: [0x4000823000]
NativeBT: /usr/lib/libc.so.6(+0x6abee) [0x400089bbee]
NativeBT: /usr/lib/libc.so.6(gsignal+0x12) [0x4000866d66]
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x34a0e766]
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x34adb46a]
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x3499b7c8]
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x349af81c]
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x349afec6]
NativeBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64() [0x349b076e]
NativeBT: [0x4000823000]
NativeBT: [0x3d7f88f0]
EmulatedBT: ??? [0x1f0ae0]
EmulatedBT: /home/xctan/GOG Games/Crypt of the NecroDancer/game/NecroDancer64/NecroDancer.x64(_ZN12_GLOBAL__N_117handleCrashSignalEi+119) [0x723669]
EmulatedBT: ??? [0x300c0]
EmulatedBT: lib/libsfml-audio.so.2.5(_ZN2sf4priv19SoundFileReaderFlac5checkERNS_11InputStreamE+9c) [0x400151013c]
EmulatedBT: lib/libsfml-audio.so.2.5(_ZN2sf16SoundFileFactory22createReaderFromMemoryEPKvm+7a) [0x400150eeca]
EmulatedBT: ??? [0x411c727010]
316796|SIGABRT @0x400089bbee (???(/usr/lib/libc.so.6+0x400089bbee)) (x64pc=0x1f0af3/???:"???", rsp=0x101ffddd0, stack=0x101800000:0x102000000 own=(nil) fp=0x101ffde08), for accessing 0x3e80004d57c (code=-6/prot=0), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0) handler=0x723550
RSP-0x20:0x0000000036fdcb50 RSP-0x18:0x0000000101ffde18 RSP-0x10:0x000000003652a540 RSP-0x08:0x0000000000000112
RSP+0x00:0x0000000000723669 RSP+0x08:0x0000000000000000 RSP+0x10:0x0000000000000000 RSP+0x18:0x0000000000000000
RAX:0x0000000000000000 RCX:0x0000000000000000 RDX:0x000000000000000f RBX:0x0000000000000000
RSP:0x0000000101ffddd0 RBP:0x0000000101ffde08 RSI:0x0000000000000000 RDI:0x0000000000000006
R8:0x00000040037b4720 R9:0x0000000000f3e720 R10:0x00000040037b4780 R11:0xfffffffffffffff7
R12:0x0000000000000000 R13:0x0000000101ffde18 R14:0x0000000101ffe5c0 R15:0x00000000006360e0
316796|Double SIGABRT (code=-6, pc=0x400089bbee, addr=0x3e80004d57c)!
Sigfault/Segbus while quitting, exiting silently
Sigfault/Segbus while quitting, exiting silently
I have successfully run the game with BOX64_EMULATED_LIBS=libFLAC.so.8
, where libFLAC.so.8
is a symbol link to x86_64 libFLAC.so.12
. This trick doesn't work with wrapped riscv64 libFLAC.
Yay!
Mmm, that means there is a badly wrapped function in libFLAC. If you can reproduce the crash with BOX64_ROLLING_LOG=1
that should gives the last 16 functions call at the crash, it might help isolate the bad wrapper.
The stock libluajit-5.1.so.2 still crashes while dynarec is on. I'll investigate this problem first.
libFLAC issue is fixed in above PR.
Crypt of the NecroDancer runs pretty slow on VF2, about 0.3 FPS. I'll try to add missing opcodes for it to see if it helps.
I'm able to run the game and see an empty window (also using gl4es), but it then segfaulted in
luajit-5.1.so.2
. How should I debug this? Cosim will not work as there're multi processes running.