Changeset 632:db3ab874e604

Show
Ignore:
Timestamp:
12/08/08 14:38:38 (4 weeks ago)
Author:
"David Anderson <dave@…
Branch:
default
Tags:
tip
Message:

Fix the stack position computation logic.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nxos/systems/marvin/scheduler.c

    r578 r632  
    1414#include "base/drivers/avr.h" 
    1515#include "base/lib/memalloc/memalloc.h" 
     16#include "base/asm_decls.h" 
    1617 
    1718#include "marvin/_task.h" 
     
    173174  t = nx_calloc(1, sizeof(*t)); 
    174175  t->stack_base = nx_calloc(1, stack_size); 
    175   t->stack_current = t->stack_base + (stack_size >> 2) - sizeof(*s); 
     176  t->stack_current = (U32*) ((U32)t->stack_base + stack_size - sizeof(*s)); 
    176177  s = (nx_task_stack_t*)t->stack_current; 
    177178  s->pc = (U32) func; 
    178179  s->lr = (U32) task_shutdown; 
    179   s->cpsr = 0x1F; /* TODO: Nice define. */ 
     180  s->cpsr = MODE_SYS; 
    180181  if (s->pc & 0x1) { 
    181182    s->pc &= 0xFFFFFFFE;