Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / arch / tile / include / asm / kgdb.h
1 /*
2  * Copyright 2013 Tilera Corporation. All Rights Reserved.
3  *
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.
7  *
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
12  *   more details.
13  *
14  * TILE-Gx KGDB support.
15  */
16
17 #ifndef __TILE_KGDB_H__
18 #define __TILE_KGDB_H__
19
20 #include <linux/kdebug.h>
21 #include <arch/opcode.h>
22
23 #define GDB_SIZEOF_REG          sizeof(unsigned long)
24
25 /*
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.
29  *
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.
32  *
33  */
34 #define DBG_MAX_REG_NUM         (56+8+2)
35 #define NUMREGBYTES             (DBG_MAX_REG_NUM * GDB_SIZEOF_REG)
36
37 /*
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.
41  */
42 #define BUFMAX                  2048
43
44 #define BREAK_INSTR_SIZE        TILEGX_BUNDLE_SIZE_IN_BYTES
45
46 /*
47  * Require cache flush for set/clear a software breakpoint or write memory.
48  */
49 #define CACHE_FLUSH_IS_SAFE     1
50
51 /*
52  * The compiled-in breakpoint instruction can be used to "break" into
53  * the debugger via magic system request key (sysrq-G).
54  */
55 static tile_bundle_bits compiled_bpt = TILEGX_BPT_BUNDLE | DIE_COMPILED_BPT;
56
57 enum tilegx_regnum {
58         TILEGX_PC_REGNUM = TREG_LAST_GPR + 9,
59         TILEGX_FAULTNUM_REGNUM,
60 };
61
62 /*
63  * Generate a breakpoint exception to "break" into the debugger.
64  */
65 static inline void arch_kgdb_breakpoint(void)
66 {
67         asm volatile (".quad %0\n\t"
68                       ::""(compiled_bpt));
69 }
70
71 #endif /* __TILE_KGDB_H__ */