From e698a9abe7299f37b5a1e565c602093a9887ee39 Mon Sep 17 00:00:00 2001
From: Andreas Faerber <andreas.faerber@web.de>
Date: Sat, 12 Jun 2010 01:19:44 +0200
Subject: [PATCH] ppc: Save debug register state and shorten stack trace
---
headers/private/kernel/arch/ppc/arch_debug.h | 1 +
src/system/kernel/arch/ppc/arch_debug.cpp | 6 +++++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/headers/private/kernel/arch/ppc/arch_debug.h b/headers/private/kernel/arch/ppc/arch_debug.h
index 745874d..f4ff5ee 100644
a
|
b
|
|
10 | 10 | |
11 | 11 | |
12 | 12 | struct arch_debug_registers { |
| 13 | addr_t r1; |
13 | 14 | }; |
14 | 15 | |
15 | 16 | |
diff --git a/src/system/kernel/arch/ppc/arch_debug.cpp b/src/system/kernel/arch/ppc/arch_debug.cpp
index dc7179a..d0a2b52 100644
a
|
b
|
stack_trace(int argc, char **argv)
|
124 | 124 | |
125 | 125 | if (argc < 2) { |
126 | 126 | thread = thread_get_current_thread(); |
127 | | framePointer = (addr_t)get_current_stack_frame()->previous; |
| 127 | int32 cpu = smp_get_current_cpu(); |
| 128 | framePointer = debug_get_debug_registers(cpu)->r1; |
128 | 129 | } else { |
129 | 130 | // TODO: Add support for stack traces of other threads. |
130 | 131 | /* thread_id id = strtoul(argv[1], NULL, 0); |
… |
… |
return 0;
|
258 | 259 | void |
259 | 260 | arch_debug_save_registers(struct arch_debug_registers* registers) |
260 | 261 | { |
| 262 | // get the caller's frame pointer |
| 263 | stack_frame* frame = (stack_frame*)get_current_stack_frame()->previous; |
| 264 | registers->r1 = (uint32)frame->previous; |
261 | 265 | } |
262 | 266 | |
263 | 267 | |