Welcome! Log In Create A New Profile

Advanced

Specify project per stack size?

Posted by Linuz 
Specify project per stack size?
November 28, 2010 04:40PM
To cater for Quake's hefty stack requirements I've had to increase the stack from 128K to 256K. It used to be 512, but I did some optimisation in R_RecursiveWorldNode to take the usage down.

I was wondering if there is a way to do this on a per .elf basis instead of modifying the global ogc.ld linkscript?

Thanks!
Re: Specify project per stack size?
November 28, 2010 04:43PM
Quote
Linuz
To cater for Quake's hefty stack requirements I've had to increase the stack from 128K to 256K. It used to be 512, but I did some optimisation in R_RecursiveWorldNode to take the usage down.

I was wondering if there is a way to do this on a per .elf basis instead of modifying the global ogc.ld linkscript?

Thanks!

That might be a useful feature to have actually.

You can adjust the stack size per thread using LWP_CreateThread though and, for what it's worth, the main function in a libogc app is actually the first thread started by the microkernel.

So, something like this will let you manage the stack size in your code:
static lwp_t hmain_game = (lwp_t)NULL;

int main()
{

   ...
   
   setup code
   
   ...
   
   LWP_CreateThread( /* thread handle */ &hmain_game, /* code */ main_game, /* arg pointer for thread */ NULL, /* stack base */ NULL,  /* stack size */ 512*1024, /* thread priority */ 50);
   LWP_SetThreadPriority(0,0);

   while(1);
}

static void* main_game(void *arg)
{
   ...
   
   interesting stuff
   
   ...

}



Edited 1 time(s). Last edit at 11/28/2010 07:58PM by DarknessFalls.
Sorry, you can't reply to this topic. It has been closed.