Ignore ROM reads into null pointer destinations (#122) Fixes #121

DMA ROM reads ignore null pointer destinations, but if they are coerced to CPU reads they will data abort. With this commit, if the destination address is under 0x01000000 it will be considered invalid.
This commit is contained in:
Mow
2026-01-29 05:20:19 -05:00
committed by GitHub
parent edf18f25e2
commit 9eb2ec8fa2
2 changed files with 10 additions and 0 deletions

View File

@@ -57,8 +57,13 @@ patch_cardireadcard_mov_r3_to_dst:
str r3, [r6, #0x24]
do_read:
lsrs r3, r1, #24 // if dst address is invalid (close to zero), ignore the read
beq ignore_read // this is intended to fix reads to null pointers that would be ignored if done with DMA
ldr r3, __patch_cardireadcard_sdread_asm_address
blx r3
ignore_read:
pop {r1,r2,r3,r4,r6,pc}
.balign 4

View File

@@ -43,6 +43,9 @@ patch_cardireadromwithcpu_mov_left_to_read_to_r2:
lsls r7, r2, #9
do_read:
lsrs r3, r1, #24 // if dst address is invalid (close to zero), ignore the read
beq ignore_read // this is intended to fix reads to null pointers that would be ignored if done with DMA
ldr r3, __patch_cardireadromwithcpu_sdread_asm_address
blx r3
// arm
@@ -53,6 +56,8 @@ do_read:
// r7 = number of bytes read
// r5 = number of bytes left to read
// [sp + 0 + 4] = actual dst
ignore_read:
pop {pc}
.balign 4