mirror of
https://github.com/LNH-team/pico-loader.git
synced 2026-06-02 09:16:49 +02:00
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:
@@ -57,8 +57,13 @@ patch_cardireadcard_mov_r3_to_dst:
|
|||||||
str r3, [r6, #0x24]
|
str r3, [r6, #0x24]
|
||||||
|
|
||||||
do_read:
|
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
|
ldr r3, __patch_cardireadcard_sdread_asm_address
|
||||||
blx r3
|
blx r3
|
||||||
|
|
||||||
|
ignore_read:
|
||||||
pop {r1,r2,r3,r4,r6,pc}
|
pop {r1,r2,r3,r4,r6,pc}
|
||||||
|
|
||||||
.balign 4
|
.balign 4
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ patch_cardireadromwithcpu_mov_left_to_read_to_r2:
|
|||||||
lsls r7, r2, #9
|
lsls r7, r2, #9
|
||||||
|
|
||||||
do_read:
|
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
|
ldr r3, __patch_cardireadromwithcpu_sdread_asm_address
|
||||||
blx r3
|
blx r3
|
||||||
// arm
|
// arm
|
||||||
@@ -53,6 +56,8 @@ do_read:
|
|||||||
// r7 = number of bytes read
|
// r7 = number of bytes read
|
||||||
// r5 = number of bytes left to read
|
// r5 = number of bytes left to read
|
||||||
// [sp + 0 + 4] = actual dst
|
// [sp + 0 + 4] = actual dst
|
||||||
|
|
||||||
|
ignore_read:
|
||||||
pop {pc}
|
pop {pc}
|
||||||
|
|
||||||
.balign 4
|
.balign 4
|
||||||
|
|||||||
Reference in New Issue
Block a user