Now fills the stack with 0xdeadbeef
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1290 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6bb93847a4
commit
9f690b8cf8
1 changed files with 12 additions and 0 deletions
|
@ -99,10 +99,22 @@ void switch_thread(void)
|
||||||
*/
|
*/
|
||||||
int create_thread(void* function, void* stack, int stack_size)
|
int create_thread(void* function, void* stack, int stack_size)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
unsigned int stacklen;
|
||||||
|
unsigned int *stackptr;
|
||||||
|
|
||||||
if (num_threads >= MAXTHREADS)
|
if (num_threads >= MAXTHREADS)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* Munge the stack to make it easy to spot stack overflows */
|
||||||
|
stacklen = stack_size / 4;
|
||||||
|
stackptr = stack;
|
||||||
|
for(i = 0;i < stacklen;i++)
|
||||||
|
{
|
||||||
|
stackptr[i] = 0xdeadbeef;
|
||||||
|
}
|
||||||
|
|
||||||
struct regs* regs = &thread_contexts[num_threads++];
|
struct regs* regs = &thread_contexts[num_threads++];
|
||||||
store_context(regs);
|
store_context(regs);
|
||||||
/* Subtract 4 to leave room for the PR push in ldctx()
|
/* Subtract 4 to leave room for the PR push in ldctx()
|
||||||
|
|
Loading…
Reference in a new issue