Skip to content

Commit aad16f3

Browse files
Barry Songvapier
authored andcommitted
Blackfin: fix initial stack pointer setup
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>
1 parent 8916a14 commit aad16f3

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

  • arch/blackfin/mach-common

‎arch/blackfin/mach-common/head.S‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ ENTRY(__start)
144144
#endif
145145

146146
/* Initialize stack pointer */
147-
sp.l = _init_thread_union;
148-
sp.h = _init_thread_union;
147+
sp.l = _init_thread_union + THREAD_SIZE;
148+
sp.h = _init_thread_union + THREAD_SIZE;
149149
fp = sp;
150150
usp = sp;
151151

@@ -257,12 +257,7 @@ ENTRY(_real_start)
257257
R0 = R7;
258258
call _cmdline_init;
259259

260-
/* Load the current thread pointer and stack */
261-
p1 = THREAD_SIZE + 4 (z); /* +4 is for reti loading */
262-
sp = sp + p1;
263-
usp = sp;
264-
fp = sp;
265-
sp += -12;
260+
sp += -12 + 4; /* +4 is for reti loading above */
266261
call _init_pda
267262
sp += 12;
268263
jump.l _start_kernel;

0 commit comments

Comments
 (0)