(GX) Cleanups

This commit is contained in:
twinaphex 2014-10-22 05:50:34 +02:00
parent 95876158b4
commit 4c893afdcc
3 changed files with 26 additions and 33 deletions

View File

@ -5,7 +5,8 @@
#define ARENA1_HI_LIMIT 0x81800000
typedef struct _dolheader {
typedef struct _dolheade
{
u32 text_pos[7];
u32 data_pos[11];
u32 text_start[7];
@ -19,20 +20,12 @@ typedef struct _dolheader {
u32 load_dol_image(const void *dolstart)
{
u32 i;
dolheader *dolfile = NULL;
if(!dolstart)
return 0;
u32 i;
dolheader *dolfile = (dolheader *) dolstart;
/* if (dolfile->bss_start > 0 && dolfile->bss_start < ARENA1_HI_LIMIT) {
u32 bss_size = dolfile->bss_size;
if (dolfile->bss_start + bss_size > ARENA1_HI_LIMIT) {
bss_size = ARENA1_HI_LIMIT - dolfile->bss_start;
}
memset((void *) dolfile->bss_start, 0, bss_size);
sync_before_exec((void *) dolfile->bss_start, bss_size);
} */
dolfile = (dolheader *) dolstart;
for (i = 0; i < 7; i++)
{

View File

@ -27,9 +27,7 @@
* ====================================================================== */
s32 valid_elf_image (void *addr)
{
Elf32_Ehdr *ehdr; /* Elf header structure pointer */
ehdr = (Elf32_Ehdr *) addr;
Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
if (!IS_ELF (*ehdr))
return 0;
@ -49,13 +47,12 @@ s32 valid_elf_image (void *addr)
* entry point address.
* ====================================================================== */
u32 load_elf_image (void *elfstart) {
Elf32_Ehdr *ehdr;
Elf32_Phdr *phdrs;
u32 load_elf_image (void *elfstart)
{
u8 *image;
int i;
ehdr = (Elf32_Ehdr *) elfstart;
Elf32_Phdr *phdrs = NULL;
Elf32_Ehdr *ehdr = (Elf32_Ehdr *) elfstart;
if(ehdr->e_phoff == 0 || ehdr->e_phnum == 0)
return 0;
@ -65,8 +62,8 @@ u32 load_elf_image (void *elfstart) {
phdrs = (Elf32_Phdr*)(elfstart + ehdr->e_phoff);
for(i=0;i<ehdr->e_phnum;i++) {
for(i=0;i<ehdr->e_phnum;i++)
{
if(phdrs[i].p_type != PT_LOAD)
continue;

View File

@ -13,8 +13,10 @@
#define EXECUTABLE_MEM_ADDR 0x91800000
#define SYSTEM_ARGV ((struct __argv *) 0x93200000)
// if we name this main, GCC inserts the __eabi symbol, even when we specify -mno-eabi
// what a lovely "feature"
/* if we name this main, GCC inserts the __eabi symbol,
* even when we specify -mno-eabi.
*/
void app_booter_main(void)
{
void *exeBuffer = (void *) EXECUTABLE_MEM_ADDR;
@ -27,6 +29,7 @@ void app_booter_main(void)
exeEntryPointAddress = load_dol_image(exeBuffer);
exeEntryPoint = (entrypoint) exeEntryPointAddress;
if (!exeEntryPoint)
return;