create_thread now reserves room for PR on the stack

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@762 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-05-28 13:59:24 +00:00
parent 2dd18d381f
commit 6cbe2a7301

View file

@ -36,7 +36,7 @@ typedef struct
{
int created;
int current;
ctx_t ctx[MAXTHREADS] __attribute__ ((aligned (32)));
ctx_t ctx[MAXTHREADS];
} thread_t;
static thread_t threads = {1, 0};
@ -118,7 +118,9 @@ int create_thread(void* fp, void* sp, int stk_size)
{
ctx_t* ctxp = &t->ctx[t->created++];
stctx(ctxp);
ctxp->regs.sp = (void*)(((unsigned int)sp + stk_size) & ~31);
/* Subtract 4 to leave room for the PR push in ldctx()
Align it on an even 32 bit boundary */
ctxp->regs.sp = (void*)(((unsigned int)sp + stk_size - 4) & ~3;
ctxp->regs.pr = fp;
}
return 0;