Skip to content

Commit

Permalink
psxdma: Fix endian issue in gpuInterrupt()
Browse files Browse the repository at this point in the history
The HW_DMA2_MADR register contains little-endian data, therefore it
must always be accessed through one of the swap macros.

This fixes the slow DMA linked-list walking on big-endian systems.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei authored and notaz committed Oct 24, 2023
1 parent 6a131b0 commit db6e56b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libpcsxcore/psxdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ void psxDma2(u32 madr, u32 bcr, u32 chcr) { // GPU
void gpuInterrupt() {
if (HW_DMA2_CHCR == SWAP32(0x01000401) && !(HW_DMA2_MADR & SWAP32(0x800000)))
{
u32 size, madr_next = 0xffffff;
size = GPU_dmaChain((u32 *)psxM, HW_DMA2_MADR & 0x1fffff, &madr_next);
u32 size, madr_next = 0xffffff, madr = SWAPu32(HW_DMA2_MADR);
size = GPU_dmaChain((u32 *)psxM, madr & 0x1fffff, &madr_next);
HW_DMA2_MADR = SWAPu32(madr_next);
psxRegs.gpuIdleAfter = psxRegs.cycle + size + 64;
set_event(PSXINT_GPUDMA, size);
Expand Down

0 comments on commit db6e56b

Please sign in to comment.