Skip to content

Commit

Permalink
Replace constants in imgdrv by searching instead of hardcoded offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Jun 20, 2021
1 parent 770dd62 commit 6f673c2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern int _iop_reboot_count;

static void ResetIopSpecial(const char *args, unsigned int arglen)
{
int i;
void *pIOP_buffer, *IOPRP_img, *imgdrv_irx;
unsigned int length_rounded, CommandLen, size_IOPRP_img, size_imgdrv_irx;
char command[RESET_ARG_MAX + 1];
Expand All @@ -44,8 +45,14 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)

CopyToIop(IOPRP_img, length_rounded, pIOP_buffer);

*(void **)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[0x180])) = pIOP_buffer;
*(u32 *)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[0x184])) = size_IOPRP_img;
for (i = 0; i < size_imgdrv_irx; i += 4) {
if (*(u32 *)((&((unsigned char *)imgdrv_irx)[i])) == 0xDEC1DEC1) {
*(void **)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[i])) = pIOP_buffer;
}
if (*(u32 *)((&((unsigned char *)imgdrv_irx)[i])) == 0xDEC2DEC2) {
*(u32 *)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[i])) = size_IOPRP_img;
}
}

LoadMemModule(0, imgdrv_irx, size_imgdrv_irx, 0, NULL);

Expand Down

0 comments on commit 6f673c2

Please sign in to comment.