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

[Bug] Unaligned GblTestFixture/GblPrivateData #13

Open
suicvne opened this issue Jun 1, 2024 · 1 comment
Open

[Bug] Unaligned GblTestFixture/GblPrivateData #13

suicvne opened this issue Jun 1, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@suicvne
Copy link
Contributor

suicvne commented Jun 1, 2024

Found an issue with unaligned memory access on Dreamcast for the unit tests.

When creating a test fixture with:

GBL_TEST_FIXTURE {
    char dummy;
};

The Dreamcast will shit itself upon creation of the GblTestFixture instance spewing out event code 0x100 which Falco tracked down to represent an "unaligned memory write".

The output from dc-tool-ip:

KallistiOS Git revision 34f7e943-dirty:
  Fri May 31 23:59:48 EDT 2024
  [email protected]:/opt/toolchains/dc/kos
  sh-elf-gcc (GCC) 14.1.0
thd: pre-emption enabled, HZ=100
maple: active drivers:
    Dreameye (Camera): Camera
    Sound Input Peripheral: Microphone
    PuruPuru (Vibration) Pack: JumpPack
    VMU Driver: Clock, LCD, MemoryCard
    Mouse Driver: Mouse
    Keyboard Driver: Keyboard
    Controller Driver: Controller
    Lightgun: LightGun
  DMA Buffer at ac4509e0
vid_set_mode: 640x480 VGA with 1 framebuffers.
dc-load console support enabled
maple: attached devices:
  A0: Dreamcast Controller          (01000000: Controller)

* =========== Cascade Information ===========
*   Version:      0.3.0
*   Git Hash:     
* =========== Cascade Information ===========
* pScenario: 0x8c469144
* Enqueue Central Dispatch Test
* Enqueue Logging Test
Unhandled exception: PC 8c2296b0, code 1, evt 0100
 R0-R7: 00000001 00000000 8cfff8dc 0000003f 00000000 00000000 00000001 00000000
 R8-R15: 8cfff860 8c471398 8c471300 8c47141d 8cfff91c 00000000 8cfff954 8cfff854
 SR 40000000 PR 8c22980c
-------- Stack Trace (innermost first) ---------
   8cfff95c
   (invalid frame pointer)
-------------- End Stack Trace -----------------
kernel panic: unhandled IRQ/Exception
arch: aborting the system

Fix on my code was to do this:

GBL_TEST_FIXTURE {
    char dummy[4];
};

We tracked down where in the code the problem was happening and found code was able to proceed further once this was fixed.

@gyrovorbis gyrovorbis added the bug Something isn't working label Jun 1, 2024
@gyrovorbis
Copy link
Owner

aaaaaand this is why it's great to target things like the Dreamcast and PSP which do not support unaligned accesses... Major fuck-up here... but I'm on it!

@gyrovorbis gyrovorbis self-assigned this Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants