Skip to content

Commit

Permalink
arm32: unwind: print_stack() should create a more complete state
Browse files Browse the repository at this point in the history
Save general purpose registers and the frame pointer before starting
the unwind operation. Also, set PC to the begining of the print_stack
function since there's no point in going further.

Fixes: OP-TEE#1069
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
jforissier committed Oct 10, 2016
1 parent f641b53 commit 091faf8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/arch/arm/kernel/unwind_arm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,11 @@ void print_stack(int level)
{
struct unwind_state state;

memset(&state, 0, sizeof(state));
asm volatile("stmia %0, {r0-r12}" :: "r" (state.registers) : "memory");
state.registers[FP] = (uint32_t)__builtin_frame_address(0);
state.registers[SP] = read_sp();
state.registers[LR] = read_lr();
state.registers[PC] = read_pc();
state.registers[PC] = (uint32_t)print_stack;

do {
switch (level) {
Expand Down

0 comments on commit 091faf8

Please sign in to comment.