![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 /* 0003 * ARM KGDB support 0004 * 0005 * Author: Deepak Saxena <dsaxena@mvista.com> 0006 * 0007 * Copyright (C) 2002 MontaVista Software Inc. 0008 * 0009 */ 0010 0011 #ifndef __ARM_KGDB_H__ 0012 #define __ARM_KGDB_H__ 0013 0014 #include <linux/ptrace.h> 0015 #include <asm/opcodes.h> 0016 0017 /* 0018 * GDB assumes that we're a user process being debugged, so 0019 * it will send us an SWI command to write into memory as the 0020 * debug trap. When an SWI occurs, the next instruction addr is 0021 * placed into R14_svc before jumping to the vector trap. 0022 * This doesn't work for kernel debugging as we are already in SVC 0023 * we would loose the kernel's LR, which is a bad thing. This 0024 * is bad thing. 0025 * 0026 * By doing this as an undefined instruction trap, we force a mode 0027 * switch from SVC to UND mode, allowing us to save full kernel state. 0028 * 0029 * We also define a KGDB_COMPILED_BREAK which can be used to compile 0030 * in breakpoints. This is important for things like sysrq-G and for 0031 * the initial breakpoint from trap_init(). 0032 * 0033 * Note to ARM HW designers: Add real trap support like SH && PPC to 0034 * make our lives much much simpler. :) 0035 */ 0036 #define BREAK_INSTR_SIZE 4 0037 #define GDB_BREAKINST 0xef9f0001 0038 #define KGDB_BREAKINST 0xe7ffdefe 0039 #define KGDB_COMPILED_BREAK 0xe7ffdeff 0040 #define CACHE_FLUSH_IS_SAFE 1 0041 0042 #ifndef __ASSEMBLY__ 0043 0044 static inline void arch_kgdb_breakpoint(void) 0045 { 0046 asm(__inst_arm(0xe7ffdeff)); 0047 } 0048 0049 extern void kgdb_handle_bus_error(void); 0050 extern int kgdb_fault_expected; 0051 0052 #endif /* !__ASSEMBLY__ */ 0053 0054 /* 0055 * From Kevin Hilman: 0056 * 0057 * gdb is expecting the following registers layout. 0058 * 0059 * r0-r15: 1 long word each 0060 * f0-f7: unused, 3 long words each !! 0061 * fps: unused, 1 long word 0062 * cpsr: 1 long word 0063 * 0064 * Even though f0-f7 and fps are not used, they need to be 0065 * present in the registers sent for correct processing in 0066 * the host-side gdb. 0067 * 0068 * In particular, it is crucial that CPSR is in the right place, 0069 * otherwise gdb will not be able to correctly interpret stepping over 0070 * conditional branches. 0071 */ 0072 #define _GP_REGS 16 0073 #define _FP_REGS 8 0074 #define _EXTRA_REGS 2 0075 #define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) 0076 #define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS) 0077 0078 #define KGDB_MAX_NO_CPUS 1 0079 #define BUFMAX 400 0080 #define NUMREGBYTES (GDB_MAX_REGS << 2) 0081 #define NUMCRITREGBYTES (32 << 2) 0082 0083 #define _R0 0 0084 #define _R1 1 0085 #define _R2 2 0086 #define _R3 3 0087 #define _R4 4 0088 #define _R5 5 0089 #define _R6 6 0090 #define _R7 7 0091 #define _R8 8 0092 #define _R9 9 0093 #define _R10 10 0094 #define _FP 11 0095 #define _IP 12 0096 #define _SPT 13 0097 #define _LR 14 0098 #define _PC 15 0099 #define _CPSR (GDB_MAX_REGS - 1) 0100 0101 /* 0102 * So that we can denote the end of a frame for tracing, 0103 * in the simple case: 0104 */ 0105 #define CFI_END_FRAME(func) __CFI_END_FRAME(_PC, _SPT, func) 0106 0107 #endif /* __ASM_KGDB_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |