2 * Copyright 2013 Tilera Corporation. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
14 * TILE-Gx KGDB support.
17 #ifndef __TILE_KGDB_H__
18 #define __TILE_KGDB_H__
20 #include <linux/kdebug.h>
21 #include <arch/opcode.h>
23 #define GDB_SIZEOF_REG sizeof(unsigned long)
26 * TILE-Gx gdb is expecting the following register layout:
27 * 56 GPRs(R0 - R52, TP, SP, LR), 8 special GPRs(networks and ZERO),
28 * plus the PC and the faultnum.
30 * Even though kernel not use the 8 special GPRs, they need to be present
31 * in the registers sent for correct processing in the host-side gdb.
34 #define DBG_MAX_REG_NUM (56+8+2)
35 #define NUMREGBYTES (DBG_MAX_REG_NUM * GDB_SIZEOF_REG)
38 * BUFMAX defines the maximum number of characters in inbound/outbound
39 * buffers at least NUMREGBYTES*2 are needed for register packets,
40 * Longer buffer is needed to list all threads.
44 #define BREAK_INSTR_SIZE TILEGX_BUNDLE_SIZE_IN_BYTES
47 * Require cache flush for set/clear a software breakpoint or write memory.
49 #define CACHE_FLUSH_IS_SAFE 1
52 * The compiled-in breakpoint instruction can be used to "break" into
53 * the debugger via magic system request key (sysrq-G).
55 static tile_bundle_bits compiled_bpt
= TILEGX_BPT_BUNDLE
| DIE_COMPILED_BPT
;
58 TILEGX_PC_REGNUM
= TREG_LAST_GPR
+ 9,
59 TILEGX_FAULTNUM_REGNUM
,
63 * Generate a breakpoint exception to "break" into the debugger.
65 static inline void arch_kgdb_breakpoint(void)
67 asm volatile (".quad %0\n\t"
71 #endif /* __TILE_KGDB_H__ */