4 * Author: Deepak Saxena <dsaxena@mvista.com>
6 * Copyright (C) 2002 MontaVista Software Inc.
10 #ifndef __ARM_KGDB_H__
11 #define __ARM_KGDB_H__
13 #include <linux/ptrace.h>
16 * GDB assumes that we're a user process being debugged, so
17 * it will send us an SWI command to write into memory as the
18 * debug trap. When an SWI occurs, the next instruction addr is
19 * placed into R14_svc before jumping to the vector trap.
20 * This doesn't work for kernel debugging as we are already in SVC
21 * we would loose the kernel's LR, which is a bad thing. This
24 * By doing this as an undefined instruction trap, we force a mode
25 * switch from SVC to UND mode, allowing us to save full kernel state.
27 * We also define a KGDB_COMPILED_BREAK which can be used to compile
28 * in breakpoints. This is important for things like sysrq-G and for
29 * the initial breakpoint from trap_init().
31 * Note to ARM HW designers: Add real trap support like SH && PPC to
32 * make our lives much much simpler. :)
34 #define BREAK_INSTR_SIZE 4
35 #define GDB_BREAKINST 0xef9f0001
36 #define KGDB_BREAKINST 0xe7ffdefe
37 #define KGDB_COMPILED_BREAK 0xe7ffdeff
38 #define CACHE_FLUSH_IS_SAFE 1
42 static inline void arch_kgdb_breakpoint(void)
44 asm(".word 0xe7ffdeff");
47 extern void kgdb_handle_bus_error(void);
48 extern int kgdb_fault_expected;
50 #endif /* !__ASSEMBLY__ */
55 * gdb is expecting the following registers layout.
57 * r0-r15: 1 long word each
58 * f0-f7: unused, 3 long words each !!
59 * fps: unused, 1 long word
62 * Even though f0-f7 and fps are not used, they need to be
63 * present in the registers sent for correct processing in
66 * In particular, it is crucial that CPSR is in the right place,
67 * otherwise gdb will not be able to correctly interpret stepping over
68 * conditional branches.
73 #define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS)
74 #define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS)
76 #define KGDB_MAX_NO_CPUS 1
78 #define NUMREGBYTES (DBG_MAX_REG_NUM << 2)
79 #define NUMCRITREGBYTES (32 << 2)
97 #define _CPSR (GDB_MAX_REGS - 1)
100 * So that we can denote the end of a frame for tracing,
101 * in the simple case:
103 #define CFI_END_FRAME(func) __CFI_END_FRAME(_PC, _SPT, func)
105 #endif /* __ASM_KGDB_H__ */