Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Commit

Permalink
fix boot on firmwares less than 8.0.0 and es_patch for 10.0.X (#152)
Browse files Browse the repository at this point in the history
* Fix SYSM_INCR patchs

* es_patch for 10.0.X
  • Loading branch information
D3fau4 committed May 5, 2020
1 parent 7524cd1 commit 05c4df5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Binary file modified data/es_patch.rxp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ u8 loadFirm() {
pkg2_parse_kips(&kip1_info, dec_pkg2);

// Patch firmware.
patchKernel(dec_pkg2);
patchKernel(dec_pkg2, pk11Offs->hos);
patchKernelExtensions(&kip1_info);

// Build Package2.
Expand Down
20 changes: 18 additions & 2 deletions src/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void patchFS(pkg2_kip1_info_t* ki) {
ki->kip1 = moddedKip;
}

void patchKernel(pkg2_hdr_t *pkg2){
void patchKernel(pkg2_hdr_t *pkg2, u8 fwVer){
//Patch Kernel
if(!hasCustomKern()) {
print("%kPatching Kernel...%k\n", WHITE, DEFAULT_TEXT_COL);
Expand Down Expand Up @@ -120,7 +120,23 @@ void patchKernel(pkg2_hdr_t *pkg2){
}

//SYSM_INCR patches
*(vu32*)(kern + kernelInfo[i].SYSM_INCR) = _MOVZW(19, 0x1D80, LSL16);
switch(fwVer){
case HOS_FIRMWARE_VERSION_500:
*(vu32*)(kern + kernelInfo[i].SYSM_INCR) = _MOVZW(8, 0x1E00, LSL16);
break;
case HOS_FIRMWARE_VERSION_600:
case HOS_FIRMWARE_VERSION_620:
case HOS_FIRMWARE_VERSION_700:
*(vu32*)(kern + kernelInfo[i].SYSM_INCR) = _MOVZW(8, 0x1D80, LSL16);
break;
case HOS_FIRMWARE_VERSION_800:
case HOS_FIRMWARE_VERSION_810:
case HOS_FIRMWARE_VERSION_900:
case HOS_FIRMWARE_VERSION_910:
case HOS_FIRMWARE_VERSION_1000:
*(vu32*)(kern + kernelInfo[i].SYSM_INCR) = _MOVZW(19, 0x1D80, LSL16);
break;
}

//JIT patches
*(vu32*)(kern + kernelInfo[i].GenericOff) = NOP_v8;
Expand Down
4 changes: 2 additions & 2 deletions src/patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static const KernelMeta kernelInfo[] = {
0x5FEC0,
PRC_ID_SND_700, sizeof(PRC_ID_SND_700),
PRC_ID_RCV_700, sizeof(PRC_ID_RCV_700),
0x5F9A4
0x57F98
},
{ //8 [8.0.0]
{0xF1, 0x5E, 0xC8, 0x34, 0xFD, 0x68, 0xF0, 0xF0},
Expand Down Expand Up @@ -355,6 +355,6 @@ static kippatchset_t kip_patches[] = {
};

void patchFS(pkg2_kip1_info_t* ki);
void patchKernel(pkg2_hdr_t *pkg2);
void patchKernel(pkg2_hdr_t *pkg2, u8 fwVer);
void patchKernelExtensions(link_t *kips);
pkg2_kip1_info_t* find_by_tid(link_t* kip_list, u64 tid);

0 comments on commit 05c4df5

Please sign in to comment.