-set back homebrew boot size to 16mb and reverted all the lower

mem2 experiments
This commit is contained in:
fix94.1 2013-01-21 17:12:18 +00:00
parent a95fe25030
commit 2bb24b2575
6 changed files with 47 additions and 39 deletions

Binary file not shown.

View File

@ -8,7 +8,7 @@ OUTPUT_ARCH(powerpc:common)
ENTRY(_start) ENTRY(_start)
SECTIONS { SECTIONS {
. = 0x93000000; . = 0x93100000;
.start : { crt0.o(*) } .start : { crt0.o(*) }
.text : { *(.text) } .text : { *(.text) }

View File

@ -10,8 +10,8 @@
#include "elfloader.h" #include "elfloader.h"
#include "sync.h" #include "sync.h"
#define EXECUTABLE_MEM_ADDR 0x91000000 #define EXECUTABLE_MEM_ADDR 0x92000000
#define SYSTEM_ARGV ((struct __argv *) 0x93200000) #define SYSTEM_ARGV ((struct __argv *)0x93200000)
void main(void) void main(void)
{ {

View File

@ -10,8 +10,8 @@
#include "banner/AnimatedBanner.h" #include "banner/AnimatedBanner.h"
#include "gecko/gecko.hpp" #include "gecko/gecko.hpp"
#define EXECUTE_ADDR ((u8 *)0x91000000) #define EXECUTE_ADDR ((u8 *)0x92000000)
#define BOOTER_ADDR ((u8 *)0x93000000) #define BOOTER_ADDR ((u8 *)0x93100000)
#define ARGS_ADDR ((u8 *)0x93200000) #define ARGS_ADDR ((u8 *)0x93200000)
#define BOOTER_ENTRY ((entry)BOOTER_ADDR) #define BOOTER_ENTRY ((entry)BOOTER_ADDR)
@ -23,7 +23,7 @@ extern const u32 app_booter_bin_size;
extern const u8 stub_bin[]; extern const u8 stub_bin[];
extern const u32 stub_bin_size; extern const u32 stub_bin_size;
u32 buffer_size = 0; u8 valid = 0;
static vector<string> Arguments; static vector<string> Arguments;
@ -48,23 +48,24 @@ void AddBootArgument(const char * argv)
int LoadHomebrew(const char *filepath) int LoadHomebrew(const char *filepath)
{ {
if(!filepath) if(filepath == NULL)
return -1; return -1;
FILE *file = fopen(filepath ,"rb"); FILE *file = fopen(filepath, "rb");
if(!file) if(file == NULL)
return -2; return -2;
fseek(file, 0, SEEK_END); fseek(file, 0, SEEK_END);
u32 filesize = ftell(file); u32 filesize = ftell(file);
rewind(file); if(filesize <= ((u32)BOOTER_ADDR - (u32)EXECUTE_ADDR))
{
buffer_size = filesize; rewind(file);
fread(EXECUTE_ADDR, 1, buffer_size, file); valid = (fread(EXECUTE_ADDR, 1, filesize, file) == filesize);
DCFlushRange(EXECUTE_ADDR, buffer_size); DCFlushRange(EXECUTE_ADDR, filesize);
}
fclose(file); fclose(file);
return 1; return valid;
} }
int SetupARGV(struct __argv * args) int SetupARGV(struct __argv * args)

View File

@ -16,14 +16,14 @@ u32 MALLOC_MEM2 = 0;
void *MEM1_lo_start = (void*)0x80004000; void *MEM1_lo_start = (void*)0x80004000;
void *MEM1_lo_end = (void*)0x80620000; void *MEM1_lo_end = (void*)0x80620000;
void *MEM2_lo_start = (void*)0x90000000; /*void *MEM2_lo_start = (void*)0x90000000;
void *MEM2_lo_end = (void*)0x90600000; void *MEM2_lo_end = (void*)0x90600000;*/
void *MEM2_start = (void*)0x90600000; void *MEM2_start = (void*)0x90200000;
void *MEM2_end = (void*)0x93100000; void *MEM2_end = (void*)0x93100000;
static CMEM2Alloc g_mem1lo; static CMEM2Alloc g_mem1lo;
static CMEM2Alloc g_mem2lo_gp; /*static CMEM2Alloc g_mem2lo_gp;*/
static CMEM2Alloc g_mem2gp; static CMEM2Alloc g_mem2gp;
extern "C" extern "C"
@ -41,10 +41,10 @@ void MEM_init()
g_mem1lo.init(MEM1_lo_start, MEM1_lo_end); //about 6mb g_mem1lo.init(MEM1_lo_start, MEM1_lo_end); //about 6mb
g_mem1lo.clear(); g_mem1lo.clear();
g_mem2lo_gp.init(MEM2_lo_start, MEM2_lo_end); //about 6mb /*g_mem2lo_gp.init(MEM2_lo_start, MEM2_lo_end); //about 6mb
g_mem2lo_gp.clear(); g_mem2lo_gp.clear();*/
g_mem2gp.init(MEM2_start, MEM2_end); //about 43mb g_mem2gp.init(MEM2_start, MEM2_end); //about 47mb
g_mem2gp.clear(); g_mem2gp.clear();
} }
@ -96,24 +96,27 @@ unsigned int MEM1_freesize()
void *MEM2_lo_alloc(unsigned int s) void *MEM2_lo_alloc(unsigned int s)
{ {
return g_mem2lo_gp.allocate(s); return MEM2_alloc(s);
/*return g_mem2lo_gp.allocate(s);*/
} }
void *MEM2_lo_realloc(void *p, unsigned int s) void *MEM2_lo_realloc(void *p, unsigned int s)
{ {
return g_mem2lo_gp.reallocate(p, s); return MEM2_realloc(p, s);
/*return g_mem2lo_gp.reallocate(p, s);*/
} }
void MEM2_lo_free(void *p) void MEM2_lo_free(void *p)
{ {
if(!p) MEM2_free(p);
/*if(!p)
return; return;
g_mem2lo_gp.release(p); g_mem2lo_gp.release(p);*/
} }
unsigned int MEM2_lo_freesize() unsigned int MEM2_lo_freesize()
{ {
return g_mem2lo_gp.FreeSize(); return 0;//g_mem2lo_gp.FreeSize();
} }
@ -216,10 +219,10 @@ void __wrap_free(void *p)
if(((u32)p & 0x10000000) != 0) if(((u32)p & 0x10000000) != 0)
{ {
if(p > MEM2_start) //if(p > MEM2_start)
g_mem2gp.release(p); g_mem2gp.release(p);
else //else
g_mem2lo_gp.release(p); //g_mem2lo_gp.release(p);
} }
else else
MEM1_free(p); MEM1_free(p);

View File

@ -964,16 +964,20 @@ void CMenu::_launchHomebrew(const char *filepath, vector<string> arguments)
Playlog_Delete(); Playlog_Delete();
cleanup(); // wifi and sd gecko doesnt work anymore after cleanup cleanup(); // wifi and sd gecko doesnt work anymore after cleanup
LoadHomebrew(filepath); if(LoadHomebrew(filepath) == 1)
AddBootArgument(filepath);
for(u32 i = 0; i < arguments.size(); ++i)
{ {
gprintf("Argument: %s\n", arguments[i].c_str()); AddBootArgument(filepath);
AddBootArgument(arguments[i].c_str()); for(u32 i = 0; i < arguments.size(); ++i)
{
gprintf("Argument: %s\n", arguments[i].c_str());
AddBootArgument(arguments[i].c_str());
}
loadIOS(58, false);
ShutdownBeforeExit();
BootHomebrew();
} }
loadIOS(58, false); else
ShutdownBeforeExit(); Sys_Exit();
BootHomebrew();
} }
int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels) int CMenu::_loadIOS(u8 gameIOS, int userIOS, string id, bool RealNAND_Channels)