59 int new_argc = argc + 2;
62 if (!file_exists(filename)) {
69 char *new_argv[argc + 2];
71 new_argv[1] = (
char *)filename;
72 for (i = 0; i < argc; i++) {
73 new_argv[i + 2] = argv[i];
77 boot_elf = (u8 *)loader_elf;
79 if (_lw((u32)&eh->ident) != ELF_MAGIC)
85 for (i = 0; i < eh->phnum; i++) {
86 if (eph[i].type != ELF_PT_LOAD)
89 pdata = (
void *)(boot_elf + eph[i].offset);
90 memcpy(eph[i].vaddr, pdata, eph[i].filesz);
92 if (eph[i].memsz > eph[i].filesz)
93 memset((
void *)((u8 *)(eph[i].vaddr) + eph[i].filesz), 0, eph[i].memsz - eph[i].filesz);
101 return ExecPS2((
void *)eh->entry, NULL, new_argc, new_argv);