hos: Move warmboot patching into pkg1 object

This commit is contained in:
CTCaer 2020-07-04 21:44:39 +03:00
parent a862b85a46
commit 708863358e
2 changed files with 14 additions and 5 deletions

View file

@ -880,11 +880,8 @@ int hos_launch(ini_sec_t *cfg)
_hos_crit_error("No warmboot provided!"); _hos_crit_error("No warmboot provided!");
goto error; goto error;
} }
// Else we patch it to allow downgrading.
patch_t *warmboot_patchset = ctxt.pkg1_id->warmboot_patchset; pkg1_warmboot_patch((void *)&ctxt);
gfx_printf("%kPatching Warmboot%k\n", 0xFFFFBA00, 0xFFCCCCCC);
for (u32 i = 0; warmboot_patchset[i].off != 0xFFFFFFFF; i++)
*(vu32 *)(ctxt.pkg1_id->warmboot_base + warmboot_patchset[i].off) = warmboot_patchset[i].val;
} }
// Replace 'SecureMonitor' if requested or patch Pkg2 checks if needed. // Replace 'SecureMonitor' if requested or patch Pkg2 checks if needed.

View file

@ -220,6 +220,18 @@ const u8 *pkg1_unpack(void *wm_dst, u32 *wb_sz, void *sm_dst, void *ldr_dst, con
return sec_map; return sec_map;
} }
void pkg1_warmboot_patch(void *hos_ctxt)
{
launch_ctxt_t *ctxt = (launch_ctxt_t *)hos_ctxt;
// Patch warmboot on T210 to allow downgrading.
patch_t *warmboot_patchset = ctxt->pkg1_id->warmboot_patchset;
gfx_printf("%kPatching Warmboot%k\n", 0xFFFFBA00, 0xFFCCCCCC);
for (u32 i = 0; warmboot_patchset[i].off != 0xFFFFFFFF; i++)
*(vu32 *)(ctxt->pkg1_id->warmboot_base + warmboot_patchset[i].off) = warmboot_patchset[i].val;
}
static void _warmboot_filename(char *out, u32 fuses) static void _warmboot_filename(char *out, u32 fuses)
{ {
if (fuses < 16) if (fuses < 16)