This can be here

This commit is contained in:
Aurora 2016-10-10 03:39:23 +02:00
parent e9692a438b
commit d270d5b9ca
4 changed files with 10 additions and 9 deletions

View File

@ -171,13 +171,13 @@ static inline u32 patchMpu(u8 *pos, u32 size)
return ret; return ret;
} }
u32 patchEmuNand(u8 *arm9Section, u8 *process9Offset, u32 process9Size, u32 emuHeader) u32 patchEmuNand(u8 *arm9Section, u32 arm9SectionSize, u8 *process9Offset, u32 process9Size, u32 emuHeader, u8 *kernel9Address)
{ {
u32 ret = 0; u32 ret = 0;
//Copy EmuNAND code //Copy EmuNAND code
u8 *freeK9Space; u8 *freeK9Space;
ret += getFreeK9Space(arm9Section, firm->section[2].size, &freeK9Space); ret += getFreeK9Space(arm9Section, arm9SectionSize, &freeK9Space);
if(!ret) if(!ret)
{ {
memcpy(freeK9Space, emunand_bin, emunand_bin_size); memcpy(freeK9Space, emunand_bin, emunand_bin_size);
@ -195,10 +195,10 @@ u32 patchEmuNand(u8 *arm9Section, u8 *process9Offset, u32 process9Size, u32 emuH
if(!ret) *posSdmmc = sdmmc; if(!ret) *posSdmmc = sdmmc;
//Add EmuNAND hooks //Add EmuNAND hooks
ret += patchNandRw(process9Offset, process9Size, (u32)(freeK9Space - arm9Section + firm->section[2].address)); ret += patchNandRw(process9Offset, process9Size, (u32)(freeK9Space - arm9Section + kernel9Address));
//Set MPU //Set MPU
ret += patchMpu(arm9Section, firm->section[2].size); ret += patchMpu(arm9Section, arm9SectionSize);
} }
return ret; return ret;

View File

@ -27,4 +27,4 @@
#define ROUND_TO_4MB(a) (((a) + 0x2000 - 1) & (~(0x2000 - 1))) #define ROUND_TO_4MB(a) (((a) + 0x2000 - 1) & (~(0x2000 - 1)))
void locateEmuNand(u32 *emuHeader, FirmwareSource *nandType); void locateEmuNand(u32 *emuHeader, FirmwareSource *nandType);
u32 patchEmuNand(u8 *arm9Section, u8 *process9Offset, u32 process9Size, u32 emuHeader); u32 patchEmuNand(u8 *arm9Section, u32 arm9SectionSize, u8 *process9Offset, u32 process9Size, u32 emuHeader, u8 *kernel9Address);

View File

@ -34,6 +34,8 @@
#include "screen.h" #include "screen.h"
#include "../build/bundled.h" #include "../build/bundled.h"
static Firm *firm = (Firm *)0x24000000;
u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSdMode) u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSdMode)
{ {
const char *firmwareFiles[] = { const char *firmwareFiles[] = {
@ -140,7 +142,7 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, u32 emuHeader, u32
ret += patchSignatureChecks(process9Offset, process9Size); ret += patchSignatureChecks(process9Offset, process9Size);
//Apply EmuNAND patches //Apply EmuNAND patches
if(nandType != FIRMWARE_SYSNAND) ret += patchEmuNand(arm9Section, process9Offset, process9Size, emuHeader); if(nandType != FIRMWARE_SYSNAND) ret += patchEmuNand(arm9Section, firm->section[2].size, process9Offset, process9Size, emuHeader, firm->section[2].address);
//Apply FIRM0/1 writes patches on sysNAND to protect A9LH //Apply FIRM0/1 writes patches on sysNAND to protect A9LH
else if(ISA9LH || (ISFIRMLAUNCH && BOOTCFG_A9LH != 0)) ret += patchFirmWrites(process9Offset, process9Size); else if(ISA9LH || (ISFIRMLAUNCH && BOOTCFG_A9LH != 0)) ret += patchFirmWrites(process9Offset, process9Size);

View File

@ -101,4 +101,3 @@ typedef enum FirmwareType
} FirmwareType; } FirmwareType;
extern u16 launchedFirmTidLow[8]; //Defined in start.s extern u16 launchedFirmTidLow[8]; //Defined in start.s
static Firm *const firm = (Firm *)0x24000000;