summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-05-28 13:59:24 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-05-28 13:59:24 +0000
commit6cbe2a73019921978dae6a3c5cf98ed38268db9c (patch)
treee31ed093de32ccdb17cb4d2e45c3adce3ed64d0a
parent2dd18d381fc4027d000dbebce5f0d213daaa9efb (diff)
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
-rw-r--r--firmware/thread.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/firmware/thread.c b/firmware/thread.c
index e358079aba..77fdb06ec9 100644
--- a/firmware/thread.c
+++ b/firmware/thread.c
@@ -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;