Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
citronalco committed Sep 27, 2023
1 parent a5dbe23 commit 480cbd6
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions elfldr/elfldr.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ static inline void BootError(char *filename)
ExecOSD(2, argv);
}

static inline void InitializeUserMemory(unsigned int start, unsigned int end)
static inline void wipeUserMem(void)
{
unsigned int i;

for (i = start; i < end; i += 64) {
asm(
for (i = 0x100000; i < GetMemorySize(); i += 64) {
asm volatile(
"\tsq $0, 0(%0) \n"
"\tsq $0, 16(%0) \n"
"\tsq $0, 32(%0) \n"
Expand Down Expand Up @@ -142,8 +142,7 @@ void RunLoaderElf(char *filename, u8 *pElf)
boot_elf = (u8 *)pElf;
eh = (elf_header_t *)boot_elf;
if (_lw((u32)&eh->ident) != ELF_MAGIC)
while (1)
;
asm volatile("break\n");
eph = (elf_pheader_t *)(boot_elf + eh->phoff);

// calc elf size
Expand Down Expand Up @@ -213,7 +212,7 @@ void RunLoaderElf(char *filename, u8 *pElf)
}



SifExitRpc();
FlushCache(0);
FlushCache(2);

Expand Down Expand Up @@ -243,7 +242,7 @@ int main(int argc, char *argv[])
exd.epc = 0;

// clear memory.
InitializeUserMemory(0x00100000, GetMemorySize());
wipeUserMem();
FlushCache(0);

SifLoadFileInit();
Expand All @@ -257,17 +256,11 @@ int main(int argc, char *argv[])
// Final IOP reset, to fill the IOP with the default modules.
while (!SifIopReset(NULL, 0)) {
};

FlushCache(0);
FlushCache(2);

while (!SifIopSync()) {
};
//END of OPL_DB tweaks

//START of OPL_DB tweaks
//Sync with the SIF library on the IOP, or it may crash the IOP kernel during the next reset (Depending on the how the next program initializes the IOP).
//END of OPL_DB tweaks
SifInitRpc(0);
// Load modules.
SifLoadFileInit();
Expand All @@ -277,6 +270,11 @@ int main(int argc, char *argv[])
SifLoadFileExit();
SifExitRpc();

//START of OPL_DB tweaks
FlushCache(0);
FlushCache(2);
//END of OPL_DB tweaks

ExecPS2((void *)exd.epc, (void *)exd.gp, argc, argv);
} else {
SifExitRpc();
Expand Down

0 comments on commit 480cbd6

Please sign in to comment.