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

[preview] RSP crash (?) with an extremely simple rom using rdpq #507

Open
Dragorn421 opened this issue Mar 16, 2024 · 0 comments
Open

[preview] RSP crash (?) with an extremely simple rom using rdpq #507

Dragorn421 opened this issue Mar 16, 2024 · 0 comments

Comments

@Dragorn421
Copy link
Contributor

Copied from discord ( https://discord.com/channels/205520502922543113/974342113850445874/1218634000978018346 )


I got a rsp crash using ares and libdragon preview that I don't understand

to reproduce: run rom, wait like 10-20 seconds

source code

main.c

#include <libdragon.h>

#include "rect.h"

int main()
{
    debug_init_isviewer();

    joypad_init();

    display_init(RESOLUTION_320x240, DEPTH_16_BPP, 2, GAMMA_NONE, FILTERS_RESAMPLE_ANTIALIAS_DEDITHER);

    rdpq_init();

    while (true)
    {
            printf("AHey\n");
        joypad_poll();
        if (joypad_get_buttons_pressed(JOYPAD_PORT_1).a)
        {
            printf("Hey\n");
        }

        surface_t *surf = display_get();
        rdpq_attach(surf, NULL);
        rdpq_clear((color_t){0});

        rect_rdpq();

        rdpq_detach_show();
    }
}

rect.c

#include <libdragon.h>

void rect_rdpq(void)
{
    rdpq_set_mode_fill((color_t){255, 0, 0, 255});
    rdpq_fill_rectangle(10, 10, 100, 100);
}
crash screen 1st page

image

crash log
RSP CRASH | rsp_queue | display_get (src/display.c:344)
Crash symptom: wait loop timed out (200 ms)
PC:018 | STATUS:7003 [halt broke sig5 sig6 sig7 ] | DP_STATUS:  80 [ready ]
-------------------------------------------------GP Registers--
zr:00000000 at:00000001 v0:00000000 v1:00000000 a0:00000000
a1:00000000 a2:00000000 a3:00000000 t0:00800000 t1:00000100
t2:00000000 t3:00000001 t4:00000010 t5:00000000 t6:00000004
t7:00000000 t8:00000000 t9:00000000 s0:000853D8 s1:000000D0
s2:00000000 s3:00000498 s4:00000490 s5:00000000 s6:00000000
s7:00000000 gp:00000020 sp:0000103C fp:00000000 ra:0000103C
-------------------------------------------------VP Registers--
$v00:0000 0000 0000 0000 0000 0000 0000 0000   $v16:0000 0000 0000 0000 0000 0000 0000 0000
$v01:0000 0000 0000 0000 ef30 0000 0000 0000   $v17:0000 0000 0000 0000 0000 0000 0000 0000
$v02:0000 0000 0000 0000 0000 0000 0000 0000   $v18:0000 0000 0000 0000 0000 0000 0000 0000
$v03:0000 0000 0000 0000 0000 0000 0000 0000   $v19:0000 0000 0000 0000 0000 0000 0000 0000
$v04:0000 0000 0000 0000 0000 0000 0000 0000   $v20:0000 0000 0000 0000 0000 0000 0000 0000
$v05:0000 0000 0000 0000 0000 0000 0000 0000   $v21:0000 0000 0000 0000 0000 0000 0000 0000
$v06:0000 0000 0000 0000 0000 0000 0000 0000   $v22:0000 0000 0000 0000 0000 0000 0000 0000
$v07:0000 0000 0000 0000 0000 0000 0000 0000   $v23:0000 0000 0000 0000 0000 0000 0000 0000
$v08:0000 0000 0000 0000 0000 0000 0000 0000   $v24:0000 0000 0000 0000 0000 0000 0000 0000
$v09:0000 0000 0000 0000 0000 0000 0000 0000   $v25:0000 0000 0000 0000 0000 0000 0000 0000
$v10:0000 0000 0000 0000 0000 0000 0000 0000   $v26:0000 0000 0000 0000 0000 0000 0000 0000
$v11:0000 0000 0000 0000 0000 0000 0000 0000   $v27:0000 0000 0000 0000 0000 0000 0000 0000
$v12:0000 0000 0000 0000 0000 0000 0000 0000   $v28:0000 0000 0000 0000 0000 0000 0000 0000
$v13:0000 0000 0000 0000 0000 0000 0000 0000   $v29:0000 0000 0000 0000 0000 0000 0000 0000
$v14:0000 0000 0000 0000 0000 0000 0000 0000   $v30:0080 0040 0020 0010 0008 0004 0002 0001
$v15:0000 0000 0000 0000 0000 0000 0000 0000   $v31:8000 4000 2000 1000 0800 0400 0200 0100
acc_hi:0000 0000 0000 0000 0000 0000 0000 0000
acc_md:0000 0000 0000 0000 0000 0000 0000 0000
acc_lo:0000 0000 0000 0000 0000 0000 0000 0000
-----------------------------------------------COP0 Registers--
$c0  DMA_SPADDR    00000498    |  $c8  DP_START      0007f260
$c1  DMA_RAMADDR   000853e0    |  $c9  DP_END        00085360
$c2  DMA_READ      0f800ff8    |  $c10 DP_CURRENT    00085360
$c3  DMA_WRITE     0f800ff8    |  $c11 DP_STATUS     00000080
$c4  SP_STATUS     00007003    |  $c12 DP_CLOCK      00d3bf00
$c5  DMA_FULL      00000000    |  $c13 DP_BUSY       00000000
$c6  DMA_BUSY      00000000    |  $c14 DP_PIPE_BUSY  00000000
$c7  SEMAPHORE     00000000    |  $c15 DP_TMEM_BUSY  00000000
-----------------------------------------------Ucode data------
RSPQ: Normal  DRAM address: 0007dde0
RSPQ: Highpri DRAM address: 0207ee44
RSPQ: Current DRAM address: 0207e600 + GP=20 = 0207e620
RSPQ: RDP     DRAM address: 0008f280
RSPQ: Current Overlay: rsp_rdpq (c)
RSPQ: Command queue:
ASSERTION FAILED: ((uint32_t*)state->dmem)[dmem_buffer/4-1] == RSPQ_DEBUG_MARKER
file "src/rspq/rspq.c", line 409, function: rspq_crash_handler
invalid RSPQ_DMEM_BUFFER address; please update rspq_crash_handler()

Backtrace:
    inspector_page_exception+0x93c (libdragon/src/inspector.c:287) [0x8001533c] (inline)
    inspector+0x93c (libdragon/src/inspector.c:497) [0x8001533c]
    handler+0x24 (libdragon/src/inspector.c:585) [0x80015624] (inline)
    handler+0x24 (libdragon/src/inspector.c:583) [0x80015624]
    __onSyscallException+0xa4 (libdragon/src/exception.c:518) [0x80017104]
    <EXCEPTION HANDLER>+0x0 (inthandler.o:0) [0x80000554]
    __inspector_assertion+0xc (libdragon/src/inspector.c:0) [0x8001566c]
    debug_assert_func_f+0xb0 (libdragon/src/debug.c:593) [0x8000f970]
    rspq_crash_handler+0x31c (libdragon/src/rspq/rspq.c:409) [0x8001c81c]
    __rsp_crash+0x910 (libdragon/src/rsp.c:440) [0x800138b0]
    display_get+0xe8 (libdragon/src/display.c:344) [0x800109c8]
    main+0x88 (main.c:24) [0x8000f628]
    ???+0x0 (???:0) [0x80000470]

rom and elf:
gfx_compare.zip


here's the whole project with build artifacts, and more version details, because it seems very finnicky to reproduce
e.g. removing printf("AHey\n"); in main.c "fixes" the crash

libdragon preview 596490a

$ $N64_GCCPREFIX/bin/mips64-elf-gcc --version
mips64-elf-gcc (GCC) 13.2.0

ares v135 (git tag v135 aka 91658b989a0f76f1857a1d8344841be587b0d6d6)

rspcrashproj.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant