~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/include/asm/kgdb.h

Version: ~ [ linux-4.19-rc7 ] ~ [ linux-4.18.12 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.74 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.131 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.159 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.123 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.59 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.31.14 ] ~ [ linux-2.6.30.10 ] ~ [ linux-2.6.29.6 ] ~ [ linux-2.6.28.10 ] ~ [ linux-2.6.27.62 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * ARM KGDB support
  4  *
  5  * Author: Deepak Saxena <dsaxena@mvista.com>
  6  *
  7  * Copyright (C) 2002 MontaVista Software Inc.
  8  *
  9  */
 10 
 11 #ifndef __ARM_KGDB_H__
 12 #define __ARM_KGDB_H__
 13 
 14 #include <linux/ptrace.h>
 15 #include <asm/opcodes.h>
 16 
 17 /*
 18  * GDB assumes that we're a user process being debugged, so
 19  * it will send us an SWI command to write into memory as the
 20  * debug trap. When an SWI occurs, the next instruction addr is
 21  * placed into R14_svc before jumping to the vector trap.
 22  * This doesn't work for kernel debugging as we are already in SVC
 23  * we would loose the kernel's LR, which is a bad thing. This
 24  * is  bad thing.
 25  *
 26  * By doing this as an undefined instruction trap, we force a mode
 27  * switch from SVC to UND mode, allowing us to save full kernel state.
 28  *
 29  * We also define a KGDB_COMPILED_BREAK which can be used to compile
 30  * in breakpoints. This is important for things like sysrq-G and for
 31  * the initial breakpoint from trap_init().
 32  *
 33  * Note to ARM HW designers: Add real trap support like SH && PPC to
 34  * make our lives much much simpler. :)
 35  */
 36 #define BREAK_INSTR_SIZE        4
 37 #define GDB_BREAKINST           0xef9f0001
 38 #define KGDB_BREAKINST          0xe7ffdefe
 39 #define KGDB_COMPILED_BREAK     0xe7ffdeff
 40 #define CACHE_FLUSH_IS_SAFE     1
 41 
 42 #ifndef __ASSEMBLY__
 43 
 44 static inline void arch_kgdb_breakpoint(void)
 45 {
 46         asm(__inst_arm(0xe7ffdeff));
 47 }
 48 
 49 extern void kgdb_handle_bus_error(void);
 50 extern int kgdb_fault_expected;
 51 
 52 #endif /* !__ASSEMBLY__ */
 53 
 54 /*
 55  * From Kevin Hilman:
 56  *
 57  * gdb is expecting the following registers layout.
 58  *
 59  * r0-r15: 1 long word each
 60  * f0-f7:  unused, 3 long words each !!
 61  * fps:    unused, 1 long word
 62  * cpsr:   1 long word
 63  *
 64  * Even though f0-f7 and fps are not used, they need to be
 65  * present in the registers sent for correct processing in
 66  * the host-side gdb.
 67  *
 68  * In particular, it is crucial that CPSR is in the right place,
 69  * otherwise gdb will not be able to correctly interpret stepping over
 70  * conditional branches.
 71  */
 72 #define _GP_REGS                16
 73 #define _FP_REGS                8
 74 #define _EXTRA_REGS             2
 75 #define GDB_MAX_REGS            (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS)
 76 #define DBG_MAX_REG_NUM         (_GP_REGS + _FP_REGS + _EXTRA_REGS)
 77 
 78 #define KGDB_MAX_NO_CPUS        1
 79 #define BUFMAX                  400
 80 #define NUMREGBYTES             (GDB_MAX_REGS << 2)
 81 #define NUMCRITREGBYTES         (32 << 2)
 82 
 83 #define _R0                     0
 84 #define _R1                     1
 85 #define _R2                     2
 86 #define _R3                     3
 87 #define _R4                     4
 88 #define _R5                     5
 89 #define _R6                     6
 90 #define _R7                     7
 91 #define _R8                     8
 92 #define _R9                     9
 93 #define _R10                    10
 94 #define _FP                     11
 95 #define _IP                     12
 96 #define _SPT                    13
 97 #define _LR                     14
 98 #define _PC                     15
 99 #define _CPSR                   (GDB_MAX_REGS - 1)
100 
101 /*
102  * So that we can denote the end of a frame for tracing,
103  * in the simple case:
104  */
105 #define CFI_END_FRAME(func)     __CFI_END_FRAME(_PC, _SPT, func)
106 
107 #endif /* __ASM_KGDB_H__ */
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp