direct-io.hg

view xen/include/asm-powerpc/debugger.h @ 12944:d6ec02744592

[XEN][POWERPC] New interface ATTN() to conact the HW probe
Sometimes it is useful to have your code contact the HW probe directly
rather than call BUG().
Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Tue Oct 10 09:11:32 2006 -0400 (2006-10-10)
parents 0379ac3367b2
children 38b437a708a2
line source
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 *
16 * Copyright (C) IBM Corp. 2005, 2006
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 * Jimi Xenidis <jimix@watson.ibm.com>
20 */
22 #ifndef _ASM_DEBUGGER_H_
23 #define _ASM_DEBUGGER_H_
25 #include <public/xen.h>
27 extern void show_backtrace_regs(struct cpu_user_regs *);
28 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
30 static inline void dump_execution_state(void)
31 {
32 ulong sp;
33 ulong lr;
35 sp = (ulong)__builtin_frame_address(0);
36 lr = (ulong)__builtin_return_address(0);
38 show_backtrace(sp, lr, lr);
39 }
41 static inline void __force_crash(void)
42 {
43 dump_execution_state();
44 __builtin_trap();
45 }
47 static inline void debugger_trap_immediate(void)
48 {
49 dump_execution_state();
50 #ifdef CRASH_DEBUG
51 __builtin_trap();
52 #endif
53 }
55 static inline void unimplemented(void)
56 {
57 #ifdef VERBOSE
58 dump_execution_state();
59 #endif
60 }
62 static inline void show_execution_state(struct cpu_user_regs *regs)
63 {
64 show_registers(regs);
65 }
67 extern void __warn(char *file, int line);
68 #define WARN() __warn(__FILE__, __LINE__)
69 #define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
71 extern void __attn(void);
72 #define ATTN() __attn();
74 #define FORCE_CRASH() __force_crash()
76 #ifdef CRASH_DEBUG
78 #include <xen/gdbstub.h>
80 static inline int debugger_trap_fatal(
81 unsigned int vector, struct cpu_user_regs *regs)
82 {
83 (void)__trap_to_gdb(regs, vector);
84 return vector;
85 }
87 #else /* CRASH_DEBUG */
89 static inline int debugger_trap_fatal(
90 unsigned int vector, struct cpu_user_regs *regs)
91 {
92 show_backtrace(regs->gprs[1], regs->lr, regs->pc);
93 return vector;
94 }
96 #endif /* CRASH_DEBUG */
98 #endif