From 858efa604e82afb88e73290c3dca7ed35a48c5c6 Mon Sep 17 00:00:00 2001 From: Aurora Date: Mon, 17 Oct 2016 23:39:13 +0200 Subject: [PATCH] Minor stuff (2) --- patches/emunand.s | 30 +++++++++++++++--------------- patches/k11modules.s | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/patches/emunand.s b/patches/emunand.s index 0836c1f..7afc43a 100644 --- a/patches/emunand.s +++ b/patches/emunand.s @@ -2,45 +2,45 @@ .create "build/emunand.bin", 0 .arm -nand_sd: - ; Original code that still needs to be executed. + ; Original code that still needs to be executed mov r4, r0 mov r5, r1 mov r7, r2 mov r6, r3 - ; End. + ; End - ; If we're already trying to access the SD, return. + ; If we're already trying to access the SD, return ldr r2, [r0, #4] ldr r1, [sdmmc] cmp r2, r1 - beq nand_sd_ret + beq out - str r1, [r0, #4] ; Set object to be SD - ldr r2, [r0, #8] ; Get sector to read - cmp r2, #0 ; For GW compatibility, see if we're trying to read the ncsd header (sector 0) + str r1, [r0, #4] ; Set object to be SD + ldr r2, [r0, #8] ; Get sector to read + cmp r2, #0 ; For GW compatibility, see if we're trying to read the ncsd header (sector 0) ldr r3, [nand_offset] - add r2, r3 ; Add the offset to the NAND in the SD. + add r2, r3 ; Add the offset to the NAND in the SD ldreq r3, [ncsd_header_offset] - addeq r2, r3 ; If we're reading the ncsd header, add the offset of that sector. + addeq r2, r3 ; If we're reading the ncsd header, add the offset of that sector - str r2, [r0, #8] ; Store sector to read + str r2, [r0, #8] ; Store sector to read - nand_sd_ret: + out: ; Restore registers. mov r1, r5 mov r2, r7 mov r3, r6 ; Return 4 bytes behind where we got called, - ; due to the offset of this function being stored there. + ; due to the offset of this function being stored there mov r0, lr add r0, #4 bx r0 + .pool sdmmc: .ascii "SDMC" -nand_offset: .ascii "NAND" ; for rednand this should be 1 -ncsd_header_offset: .ascii "NCSD" ; depends on nand manufacturer + emunand type (GW/RED) +nand_offset: .ascii "NAND" ; For rednand this should be 1 +ncsd_header_offset: .ascii "NCSD" ; Depends on nand manufacturer + emunand type (GW/RED) .close \ No newline at end of file diff --git a/patches/k11modules.s b/patches/k11modules.s index 70c2e35..7d05979 100644 --- a/patches/k11modules.s +++ b/patches/k11modules.s @@ -73,6 +73,7 @@ ldr r3, =0x1102 ; Low title id of the fs module cmp r2, r3 ; Compare the low title id to the id of the sm module bne out ; Skip if they're not the same + ldr r2, =0x7401 ; strb r1, [r0, #16] ldr r3, =0x2000 ; movs r0, #0