From ee3720f0b706692cbe128cb213d5dc96abb4ac15 Mon Sep 17 00:00:00 2001 From: Aurora Date: Tue, 16 Aug 2016 18:47:27 +0200 Subject: [PATCH] Make loader more readable, use an array instead of a fixed location for the emuNAND test sector --- loader/source/main.c | 4 +++- loader/source/start.s | 2 ++ source/emunand.c | 2 +- source/pin.c | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/loader/source/main.c b/loader/source/main.c index d7886ac..4605d25 100644 --- a/loader/source/main.c +++ b/loader/source/main.c @@ -23,11 +23,13 @@ #include "memory.h" #include "cache.h" +extern u32 payloadSize; //defined in start.s + void main(void) { void *payloadAddress = (void *)0x23F00000; - memcpy(payloadAddress, (void*)0x24F00000, *(u32 *)0x24FFFF04); + memcpy(payloadAddress, (void*)0x24F00000, payloadSize); flushCaches(); diff --git a/loader/source/start.s b/loader/source/start.s index a9a443f..8dd5747 100644 --- a/loader/source/start.s +++ b/loader/source/start.s @@ -24,4 +24,6 @@ _start: b main +.global payloadSize +payloadSize: .word 0 diff --git a/source/emunand.c b/source/emunand.c index 66468a9..2b6f02c 100644 --- a/source/emunand.c +++ b/source/emunand.c @@ -27,7 +27,7 @@ void locateEmuNAND(u32 *off, u32 *head, FirmwareSource *emuNAND) { - static u8 *const temp = (u8 *)0x24300000; + static u8 temp[0x200]; const u32 nandSize = getMMCDevice(0)->total_size; u32 nandOffset = *emuNAND == FIRMWARE_EMUNAND ? 0 : diff --git a/source/pin.c b/source/pin.c index 26f17c3..83963d0 100644 --- a/source/pin.c +++ b/source/pin.c @@ -170,4 +170,4 @@ void verifyPin(PINData *in, bool allowQuit) else break; } } -} +} \ No newline at end of file