Skip to content

RetroArch snes9x: lxhu v0,s0,v0,0 SIGILL, Illegal instruction #148

@ValdikSS

Description

@ValdikSS

RetroArch v1.20.0 (or 2025-01-30_RetroArch.7z nightly) mips32-odbeta snes9x core is crashing in ingenic lxhu instruction.

They use opendingux-gcw0-toolchain.2022-09-22.tar.xz to build odbeta build, which includes commit b7b803b.
Non-odbeta (non-ingenic instructions enabled toolchain) works fine.

Files

snes9x2005_libretro.zip from the nightly build + core.709.zip corefile.

Text

gcw0:~ $ gdb --args /usr/local/bin/retroarch_rg350_odbeta -L /media/data/local/home/.retroarch/cores/snes9x2005_libretro.so /media/data/roms/SFC/Aladdin\ \(USA\).sfc
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "mipsel-gcw0-linux-uclibc".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/retroarch_rg350_odbeta...
(No debugging symbols found in /usr/local/bin/retroarch_rg350_odbeta)
(gdb) r
Starting program: /media/data/local/bin/retroarch_rg350_odbeta -L /media/data/local/home/.retroarch/cores/snes9x2005_libretro.so /media/data/roms/SFC/Aladdin\ \(USA\).sfc
[INFO] === Build =======================================
[INFO] Capabilities: Т�w�F�wТ�w�K� �w���w�K�ȁ�w���w��������`t�III�
[INFO] Version: 1.20.0
[INFO] Built: Jan 30 2025
[INFO] =================================================
[New LWP 712]
[INFO] [Input]: Found input driver: "sdl_dingux".
[INFO] [Core]: Loading dynamic libretro core from: "/media/data/local/home/.retroarch/cores/snes9x2005_libretro.so"
[INFO] [Overrides]: Core-specific overrides found at "/media/data/local/home/.retroarch/config/Snes9x 2005/Snes9x 2005.cfg".
[INFO] [Config]: Loading config: "/media/data/local/home/.retroarch/retroarch.cfg".
[INFO] [Config]: Appending override config: "/media/data/local/home/.retroarch/config/Snes9x 2005/Snes9x 2005.cfg".
[INFO] [Overrides]: Redirecting save file to "/media/data/local/home/.retroarch/saves/Snes9x 2005/Aladdin (USA).srm".
[INFO] [Overrides]: Redirecting save state to "/media/data/local/home/.retroarch/states/Snes9x 2005/Aladdin (USA).state".
[INFO] [Environ]: GET_LOG_INTERFACE.
[INFO] [Environ]: GET_CORE_OPTIONS_VERSION.
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL.
[INFO] [Environ]: GET_PERF_INTERFACE.
[INFO] [Environ]: GET_LOG_INTERFACE.
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[libretro INFO] Frontend supports RGB565 - will use that instead of XRGB1555.
[INFO] [Content]: Loading content file: "/media/data/roms/SFC/Aladdin (USA).sfc".
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[INFO] [Environ]: SET_AUDIO_BUFFER_STATUS_CALLBACK.
[INFO] [SRAM]: Skipping SRAM load.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 256x224, Aspect: 1.333, FPS: 59.92, Sample rate: 32040.00 Hz.
[INFO] [Video]: Set video size to: 320x240.
[INFO] [Audio]: Set audio input rate to: 32081.31 Hz.
[New LWP 713]
[INFO] [Joypad]: Found joypad driver: "sdl_dingux".
[INFO] [Video]: Found display server: "null".
[INFO] [Audio]: Set audio input rate to: 32081.31 Hz.
[INFO] [ALSA]: Using ALSA version 1.2.5.1
[INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "default"
[INFO] [ALSA]: Period: 4 periods per buffer (768 frames, 6144 bytes)
[INFO] [ALSA]: Buffer size: 3072 frames (24576 bytes)
[INFO] [ALSA]: Can pause: no.
[INFO] [ALSA]: Initialized PLAYBACK device "default"
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [Playlist]: Loading history file: "/media/data/local/home/.retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/media/data/local/home/.retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/media/data/local/home/.retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/media/data/local/home/.retroarch/content_favorites.lpl".
[INFO] [Playlist]: Written to playlist file: "/media/data/local/home/.retroarch/content_history.lpl".
[INFO] [Environ]: RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY.
[INFO] [Environ]: Setting audio latency to 128 ms.
[INFO] [Audio]: Set audio input rate to: 32081.31 Hz.
[INFO] [ALSA]: Using ALSA version 1.2.5.1
[INFO] [ALSA]: Using FLOAT_LE sample format for PLAYBACK device "default"
[INFO] [ALSA]: Period: 4 periods per buffer (1536 frames, 12288 bytes)
[INFO] [ALSA]: Buffer size: 6144 frames (49152 bytes)
[INFO] [ALSA]: Can pause: no.
[INFO] [ALSA]: Initialized PLAYBACK device "default"
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [Input]: Game Focus => OFF
[LWP 713 exited]
[New LWP 714]

Thread 1 "retroarch_rg350" received signal SIGILL, Illegal instruction.
0x775d8ca8 in ?? () from /media/data/local/home/.retroarch/cores/snes9x2005_libretro.so
(gdb) bt
#0  0x775d8ca8 in ?? () from /media/data/local/home/.retroarch/cores/snes9x2005_libretro.so
warning: GDB can't find the start of the function at 0x775d8ca8.

    GDB is unable to find the start of the function at 0x775d8ca8
and thus can't determine the size of that function's stack frame.
This means that GDB may be unable to access that stack frame, or
the frames below it.
    This problem is most likely caused by an invalid program counter or
stack pointer.
    However, if you think GDB should simply search farther back
from 0x775d8ca8 for code which looks like the beginning of a
function, you can increase the range of the search using the `set
heuristic-fence-post' command.
(gdb) info proc mappings
process 709
Mapped address spaces:

        Start Addr   End Addr       Size     Offset objfile
          0x400000   0x5f1000   0x1f1000        0x0 /media/data/local/bin/retroarch_rg350_odbeta
          0x601000   0x607000     0x6000   0x1f1000 /media/data/local/bin/retroarch_rg350_odbeta
          0x607000   0x8d9000   0x2d2000        0x0 [heap]
        0x76634000 0x76672000    0x3e000        0x0
        0x76681000 0x767a3000   0x122000        0x0
        0x767a3000 0x767a4000     0x1000        0x0
        0x767a4000 0x769a3000   0x1ff000        0x0
        0x769c1000 0x769dd000    0x1c000        0x0 /dev/dri/card1
        0x769dd000 0x769f9000    0x1c000        0x0 /dev/dri/card1
        0x769f9000 0x76a15000    0x1c000        0x0 /dev/dri/card1
        0x76a15000 0x77592000   0xb7d000        0x0
        0x77592000 0x77626000    0x94000        0x0 /media/data/local/home/.retroarch/cores/snes9x2005_libretro.so
        0x77626000 0x77635000     0xf000        0x0
        0x77635000 0x7763d000     0x8000    0x93000 /media/data/local/home/.retroarch/cores/snes9x2005_libretro.so
        0x7763d000 0x776f6000    0xb9000        0x0
        0x776f6000 0x776f7000     0x1000        0x0
        0x776f7000 0x778f6000   0x1ff000        0x0
        0x778f6000 0x778f9000     0x3000        0x0 /usr/lib/libts.so.0.10.4
        0x778f9000 0x77909000    0x10000        0x0
        0x77909000 0x7790a000     0x1000     0x3000 /usr/lib/libts.so.0.10.4
        0x7790a000 0x7791b000    0x11000        0x0 /usr/lib/libdrm.so.2.4.0
        0x7791b000 0x7792a000     0xf000        0x0
        0x7792a000 0x7792b000     0x1000    0x10000 /usr/lib/libdrm.so.2.4.0
        0x7792b000 0x77a0b000    0xe0000        0x0 /usr/lib/libiconv.so.2.6.0
        0x77a0b000 0x77a0c000     0x1000    0xe0000 /usr/lib/libiconv.so.2.6.0
        0x77a0c000 0x77a96000    0x8a000        0x0 /usr/lib/libuClibc-1.0.38.so
        0x77a96000 0x77aa5000     0xf000        0x0
--Type <RET> for more, q to quit, c to continue without paging--c
        0x77aa5000 0x77aa6000     0x1000    0x89000 /usr/lib/libuClibc-1.0.38.so
        0x77aa6000 0x77aa8000     0x2000    0x8a000 /usr/lib/libuClibc-1.0.38.so
        0x77aa8000 0x77abe000    0x16000        0x0
        0x77abe000 0x77ae5000    0x27000        0x0 /usr/lib/libgcc_s.so.1
        0x77ae5000 0x77af5000    0x10000        0x0
        0x77af5000 0x77af6000     0x1000    0x27000 /usr/lib/libgcc_s.so.1
        0x77af6000 0x77cf1000   0x1fb000        0x0 /usr/lib/libstdc++.so.6.0.29
        0x77cf1000 0x77d00000     0xf000        0x0
        0x77d00000 0x77d0d000     0xd000   0x1fa000 /usr/lib/libstdc++.so.6.0.29
        0x77d0d000 0x77d10000     0x3000   0x207000 /usr/lib/libstdc++.so.6.0.29
        0x77d10000 0x77d13000     0x3000        0x0
        0x77d13000 0x77e00000    0xed000        0x0 /usr/lib/libasound.so.2.0.0
        0x77e00000 0x77e0f000     0xf000        0x0
        0x77e0f000 0x77e14000     0x5000    0xec000 /usr/lib/libasound.so.2.0.0
        0x77e14000 0x77e56000    0x42000        0x0 /usr/lib/libSDL-1.2.so.0.11.5
        0x77e56000 0x77e66000    0x10000        0x0
        0x77e66000 0x77e67000     0x1000    0x42000 /usr/lib/libSDL-1.2.so.0.11.5
        0x77e67000 0x77e69000     0x2000        0x0
        0x77e69000 0x77e8c000    0x23000        0x0 /usr/lib/libudev.so.1.6.3
        0x77e8c000 0x77e9b000     0xf000        0x0
        0x77e9b000 0x77e9d000     0x2000    0x22000 /usr/lib/libudev.so.1.6.3
        0x77e9d000 0x77eb3000    0x16000        0x0 /usr/lib/libz.so.1.2.11
        0x77eb3000 0x77ec2000     0xf000        0x0
        0x77ec2000 0x77ec3000     0x1000    0x15000 /usr/lib/libz.so.1.2.11
        0x77ec3000 0x77eca000     0x7000        0x0 /usr/lib/ld-uClibc-1.0.38.so
        0x77ed0000 0x77ed6000     0x6000        0x0 /dev/snd/pcmC0D0p
        0x77ed6000 0x77ed9000     0x3000        0x0
        0x77ed9000 0x77eda000     0x1000     0x6000 /usr/lib/ld-uClibc-1.0.38.so
        0x77eda000 0x77edb000     0x1000     0x7000 /usr/lib/ld-uClibc-1.0.38.so
        0x7fe95000 0x7feb6000    0x21000        0x0 [stack]
        0x7fefd000 0x7fefe000     0x1000        0x0
        0x7ff32000 0x7ff33000     0x1000        0x0 [vvar]
        0x7ff33000 0x7ff34000     0x1000        0x0 [vdso]

    
(gdb) x/10i 0x775d8c90
   0x775d8c90:  jr      v0
   0x775d8c94:  nop
   0x775d8c98:  lbu     v1,-28636(a1)
   0x775d8c9c:  bnez    v1,0x775d8d30
   0x775d8ca0:  nop
   0x775d8ca4:  andi    s0,s0,0xffff
=> 0x775d8ca8:  0x72021168
   0x775d8cac:  lw      ra,28(sp)
   0x775d8cb0:  lw      s0,24(sp)
   0x775d8cb4:  jr      ra
   0x775d8cb8:  addiu   sp,sp,32

(gdb) info registers
          zero       at       v0       v1       a0       a1       a2       a3
 R0   00000000 00000001 006b3368 76d1bcd8 776c76f8 776d7ef8 00000000 776dc274 
            t0       t1       t2       t3       t4       t5       t6       t7
 R8   0000028f 00000000 00000005 00000001 00000003 00000003 00000000 776dc274 
            s0       s1       s2       s3       s4       s5       s6       s7
 R16  00000073 776dc2c4 776dc194 7763c070 77638590 77669ba4 ffffff80 776dbbe4 
            t8       t9       k0       k1       gp       sp       s8       ra
 R24  00000014 775d8c04 00000001 00000000 77644460 7feb49b8 776dc158 775ac230 
        status       lo       hi badvaddr    cause       pc
      00000413 00003210 00000000 006b33db 00800010 775d8ca8 
          fcsr      fir  restart
      13800024 00330000 00000000

Disassembling with toolchain's objdump:

   46c9c:       14600024        bnez    v1,46d30 <retro_set_environment-0x2fc38>
   46ca0:       00000000        nop
   46ca4:       3210ffff        andi    s0,s0,0xffff
   46ca8:       72021168        lxhu    v0,s0,v0,0   ← ← ← ← ← ← ← ← ← ←
   46cac:       8fbf001c        lw      ra,28(sp)
   46cb0:       8fb00018        lw      s0,24(sp)
   46cb4:       03e00008        jr      ra
   46cb8:       27bd0020        addiu   sp,sp,32

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions