Skip to content

Commit

Permalink
Blackfin: fix initial stack pointer setup
Browse files Browse the repository at this point in the history
During very early init, the stack pointer is given a slightly incorrect
value (&init_thread_union).  The value is later adjusted to the right one
during early init (&init_thread_union + THREAD_SIZE), but it is used a few
times in between.  While the few functions used don't actually put things
onto the stack (due to optimization), it's best if we simply use the right
value from the start.

Signed-off-by: Barry Song <barry.song@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
  • Loading branch information
Barry Song authored and Mike Frysinger committed Mar 9, 2010
1 parent 8916a14 commit aad16f3
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions arch/blackfin/mach-common/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ ENTRY(__start)
#endif

/* Initialize stack pointer */
sp.l = _init_thread_union;
sp.h = _init_thread_union;
sp.l = _init_thread_union + THREAD_SIZE;
sp.h = _init_thread_union + THREAD_SIZE;
fp = sp;
usp = sp;

Expand Down Expand Up @@ -257,12 +257,7 @@ ENTRY(_real_start)
R0 = R7;
call _cmdline_init;

/* Load the current thread pointer and stack */
p1 = THREAD_SIZE + 4 (z); /* +4 is for reti loading */
sp = sp + p1;
usp = sp;
fp = sp;
sp += -12;
sp += -12 + 4; /* +4 is for reti loading above */
call _init_pda
sp += 12;
jump.l _start_kernel;
Expand Down

0 comments on commit aad16f3

Please sign in to comment.