Skip to content
Snippets Groups Projects
Commit 7aa50718 authored by Oleg Hahm's avatar Oleg Hahm
Browse files

Merge pull request #30 from benpicco/15d6070a

set proper start of the stack in thread_stack_init for arm_common
parents f31f7702 15d6070a
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ void thread_yield() { ...@@ -36,7 +36,7 @@ void thread_yield() {
char * thread_stack_init(void * task_func, void * stack_start, int stack_size) char * thread_stack_init(void * task_func, void * stack_start, int stack_size)
{ {
unsigned int * stk; unsigned int * stk;
stk = (unsigned int *) stack_start + stack_size; stk = (unsigned int *) (stack_start + stack_size);
stk--; stk--;
*stk = 0x77777777; *stk = 0x77777777;
...@@ -45,7 +45,7 @@ char * thread_stack_init(void * task_func, void * stack_start, int stack_size) ...@@ -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 = (unsigned int)sched_task_exit; // LR
stk--; 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 for (int i = 12; i>= 0 ; i--) { // build base stack
stk--; stk--;
......
...@@ -100,7 +100,7 @@ void cpu_switch_context_exit(void){ ...@@ -100,7 +100,7 @@ void cpu_switch_context_exit(void){
char *thread_stack_init(void *task_func, void *stack_start, int stack_size) char *thread_stack_init(void *task_func, void *stack_start, int stack_size)
{ {
unsigned short * stk; unsigned short * stk;
stk = (unsigned short *) stack_start + stack_size; stk = (unsigned short *) (stack_start + stack_size);
*stk = (unsigned short) sched_task_exit; *stk = (unsigned short) sched_task_exit;
--stk; --stk;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment