From db6e56b6bfb5bcdacc86150061861a74365331e0 Mon Sep 17 00:00:00 2001 From: Paul Cercueil Date: Tue, 24 Oct 2023 19:08:40 +0200 Subject: [PATCH] psxdma: Fix endian issue in gpuInterrupt() 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 --- libpcsxcore/psxdma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpcsxcore/psxdma.c b/libpcsxcore/psxdma.c index 4db99ab1e..fa8f33940 100644 --- a/libpcsxcore/psxdma.c +++ b/libpcsxcore/psxdma.c @@ -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);