From d80f56e15ecd489fbe45fe149b903f160ecd393f Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sun, 10 Mar 2013 02:40:50 +0000 Subject: [PATCH] Update how we read the stack pointer to work on both GCC and clang. --- sys/arm/arm/db_trace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/db_trace.c b/sys/arm/arm/db_trace.c index 89ec507a6fe0..1d03ab4c6d41 100644 --- a/sys/arm/arm/db_trace.c +++ b/sys/arm/arm/db_trace.c @@ -612,10 +612,13 @@ db_trace_self(void) { #ifdef __ARM_EABI__ struct unwind_state state; - register uint32_t sp __asm__ ("sp"); + uint32_t sp; + + /* Read the stack pointer */ + __asm __volatile("mov %0, sp" : "=&r" (sp)); state.registers[FP] = (uint32_t)__builtin_frame_address(0); - state.registers[SP] = (uint32_t)sp; + state.registers[SP] = sp; state.registers[LR] = (uint32_t)__builtin_return_address(0); state.registers[PC] = (uint32_t)db_trace_self;