MIPS: fix setup of initial stack frame
To get correct stack walking and backtrace functionality in gdb, registers fp and ra should be initialized before calling board_init_f or board_init_r. Thus allocating stack space and zeroing it as it is currently done in board.c becomes obsolete. Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
This commit is contained in:
parent
85bafb6da4
commit
6d08e22aca
|
@ -136,10 +136,11 @@ reset:
|
||||||
|
|
||||||
/* Set up temporary stack */
|
/* Set up temporary stack */
|
||||||
li sp, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET
|
li sp, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET
|
||||||
|
move fp, sp
|
||||||
|
|
||||||
la t9, board_init_f
|
la t9, board_init_f
|
||||||
jr t9
|
jr t9
|
||||||
nop
|
move ra, zero
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void relocate_code (addr_sp, gd, addr_moni)
|
* void relocate_code (addr_sp, gd, addr_moni)
|
||||||
|
@ -155,6 +156,7 @@ reset:
|
||||||
.ent relocate_code
|
.ent relocate_code
|
||||||
relocate_code:
|
relocate_code:
|
||||||
move sp, a0 # set new stack pointer
|
move sp, a0 # set new stack pointer
|
||||||
|
move fp, sp
|
||||||
|
|
||||||
move s0, a1 # save gd in s0
|
move s0, a1 # save gd in s0
|
||||||
move s2, a2 # save destination address in s2
|
move s2, a2 # save destination address in s2
|
||||||
|
@ -260,8 +262,9 @@ in_ram:
|
||||||
addi t1, 4
|
addi t1, 4
|
||||||
|
|
||||||
move a0, s0 # a0 <-- gd
|
move a0, s0 # a0 <-- gd
|
||||||
|
move a1, s2
|
||||||
la t9, board_init_r
|
la t9, board_init_r
|
||||||
jr t9
|
jr t9
|
||||||
move a1, s2
|
move ra, zero
|
||||||
|
|
||||||
.end relocate_code
|
.end relocate_code
|
||||||
|
|
|
@ -130,10 +130,11 @@ reset:
|
||||||
|
|
||||||
/* Set up temporary stack */
|
/* Set up temporary stack */
|
||||||
dli sp, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET
|
dli sp, CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET
|
||||||
|
move fp, sp
|
||||||
|
|
||||||
dla t9, board_init_f
|
dla t9, board_init_f
|
||||||
jr t9
|
jr t9
|
||||||
nop
|
move ra, zero
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void relocate_code (addr_sp, gd, addr_moni)
|
* void relocate_code (addr_sp, gd, addr_moni)
|
||||||
|
@ -149,6 +150,7 @@ reset:
|
||||||
.ent relocate_code
|
.ent relocate_code
|
||||||
relocate_code:
|
relocate_code:
|
||||||
move sp, a0 # set new stack pointer
|
move sp, a0 # set new stack pointer
|
||||||
|
move fp, sp
|
||||||
|
|
||||||
move s0, a1 # save gd in s0
|
move s0, a1 # save gd in s0
|
||||||
move s2, a2 # save destination address in s2
|
move s2, a2 # save destination address in s2
|
||||||
|
@ -254,8 +256,9 @@ in_ram:
|
||||||
daddi t1, 8
|
daddi t1, 8
|
||||||
|
|
||||||
move a0, s0 # a0 <-- gd
|
move a0, s0 # a0 <-- gd
|
||||||
|
move a1, s2
|
||||||
dla t9, board_init_r
|
dla t9, board_init_r
|
||||||
jr t9
|
jr t9
|
||||||
move a1, s2
|
move ra, zero
|
||||||
|
|
||||||
.end relocate_code
|
.end relocate_code
|
||||||
|
|
Loading…
Reference in New Issue