Linux 3.17-rc2
[linux/fpc-iii.git] / arch / arm64 / include / asm / kgdb.h
blob3c8aafc1082f9e0b8a63870ac6739a8177ff742e
1 /*
2 * AArch64 KGDB support
4 * Based on arch/arm/include/kgdb.h
6 * Copyright (C) 2013 Cavium Inc.
7 * Author: Vijaya Kumar K <vijaya.kumar@caviumnetworks.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef __ARM_KGDB_H
23 #define __ARM_KGDB_H
25 #include <linux/ptrace.h>
26 #include <asm/debug-monitors.h>
28 #ifndef __ASSEMBLY__
30 static inline void arch_kgdb_breakpoint(void)
32 asm ("brk %0" : : "I" (KDBG_COMPILED_DBG_BRK_IMM));
35 extern void kgdb_handle_bus_error(void);
36 extern int kgdb_fault_expected;
38 #endif /* !__ASSEMBLY__ */
41 * gdb is expecting the following registers layout.
43 * General purpose regs:
44 * r0-r30: 64 bit
45 * sp,pc : 64 bit
46 * pstate : 64 bit
47 * Total: 34
48 * FPU regs:
49 * f0-f31: 128 bit
50 * Total: 32
51 * Extra regs
52 * fpsr & fpcr: 32 bit
53 * Total: 2
57 #define _GP_REGS 34
58 #define _FP_REGS 32
59 #define _EXTRA_REGS 2
61 * general purpose registers size in bytes.
62 * pstate is only 4 bytes. subtract 4 bytes
64 #define GP_REG_BYTES (_GP_REGS * 8)
65 #define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS)
68 * Size of I/O buffer for gdb packet.
69 * considering to hold all register contents, size is set
72 #define BUFMAX 2048
75 * Number of bytes required for gdb_regs buffer.
76 * _GP_REGS: 8 bytes, _FP_REGS: 16 bytes and _EXTRA_REGS: 4 bytes each
77 * GDB fails to connect for size beyond this with error
78 * "'g' packet reply is too long"
81 #define NUMREGBYTES ((_GP_REGS * 8) + (_FP_REGS * 16) + \
82 (_EXTRA_REGS * 4))
84 #endif /* __ASM_KGDB_H */