#include <string.h>
#include <sifrpc.h>
#include <kernel.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <malloc.h>
#include "elf.h"
Go to the source code of this file.
◆ ELF_MAGIC
#define ELF_MAGIC 0x464c457f |
Definition at line 25 of file elf.c.
◆ ELF_PT_LOAD
Definition at line 26 of file elf.c.
◆ file_exists()
static bool file_exists |
( |
const char * |
filename | ) |
|
|
static |
◆ LoadELFFromFile()
int LoadELFFromFile |
( |
const char * |
filename, |
|
|
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 33 of file elf.c.
40 int new_argc = argc + 1;
47 char *new_argv[new_argc];
49 new_argv[0] = (
char *)filename;
50 for (i = 0; i < argc; i++) {
51 new_argv[i + 1] = argv[i];
58 asm volatile(
"break\n");
63 for (i = 0; i < eh->
phnum; i++) {
67 pdata = (
void *)(boot_elf + eph[i].offset);
68 memcpy(eph[i].vaddr, pdata, eph[i].filesz);
70 if (eph[i].memsz > eph[i].filesz)
71 memset(eph[i].vaddr + eph[i].filesz, 0, eph[i].memsz - eph[i].filesz);
static bool file_exists(const char *filename)
void FlushCache(s32 operation)
s32 ExecPS2(void *entry, void *gp, int num_args, char *args[])
References _lw(), ELF_MAGIC, ELF_PT_LOAD, elf_header_t::entry, ExecPS2(), file_exists(), FlushCache(), elf_header_t::ident, loader_elf, NULL, elf_header_t::phnum, elf_header_t::phoff, and SifExitRpc().
◆ loader_elf
◆ size_loader_elf