mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
Merge pull request #30 from benpicco/15d6070ad639b695b0abeef7474bc59a316017ac
set proper start of the stack in thread_stack_init for arm_common
This commit is contained in:
commit
7aa50718ed
@ -36,7 +36,7 @@ void thread_yield() {
|
||||
char * thread_stack_init(void * task_func, void * stack_start, int stack_size)
|
||||
{
|
||||
unsigned int * stk;
|
||||
stk = (unsigned int *) stack_start + stack_size;
|
||||
stk = (unsigned int *) (stack_start + stack_size);
|
||||
stk--;
|
||||
|
||||
*stk = 0x77777777;
|
||||
@ -45,7 +45,7 @@ char * thread_stack_init(void * task_func, void * stack_start, int stack_size)
|
||||
*stk = (unsigned int)sched_task_exit; // LR
|
||||
|
||||
stk--;
|
||||
*stk = (unsigned int) stack_start - 4; // SP
|
||||
*stk = (unsigned int) (stack_start + stack_size) - 4; // SP
|
||||
|
||||
for (int i = 12; i>= 0 ; i--) { // build base stack
|
||||
stk--;
|
||||
|
||||
@ -100,7 +100,7 @@ void cpu_switch_context_exit(void){
|
||||
char *thread_stack_init(void *task_func, void *stack_start, int stack_size)
|
||||
{
|
||||
unsigned short * stk;
|
||||
stk = (unsigned short *) stack_start + stack_size;
|
||||
stk = (unsigned short *) (stack_start + stack_size);
|
||||
|
||||
*stk = (unsigned short) sched_task_exit;
|
||||
--stk;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user