1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef __ASM_KGDB_H_ 4 #define __ASM_KGDB_H_ 5 6 #ifdef __KERNEL__ 7 8 #define GDB_SIZEOF_REG sizeof(unsigned long) 9 10 #define DBG_MAX_REG_NUM (36) 11 #define NUMREGBYTES ((DBG_MAX_REG_NUM) * GDB_SIZEOF_REG) 12 #define CACHE_FLUSH_IS_SAFE 1 13 #define BUFMAX 2048 14 #ifdef CONFIG_RISCV_ISA_C 15 #define BREAK_INSTR_SIZE 2 16 #else 17 #define BREAK_INSTR_SIZE 4 18 #endif 19 20 #ifndef __ASSEMBLY__ 21 22 extern int kgdb_has_hit_break(unsigned long addr); 23 extern unsigned long kgdb_compiled_break; 24 25 static inline void arch_kgdb_breakpoint(void) 26 { 27 asm(".global kgdb_compiled_break\n" 28 ".option norvc\n" 29 "kgdb_compiled_break: ebreak\n" 30 ".option rvc\n"); 31 } 32 33 #endif /* !__ASSEMBLY__ */ 34 35 #define DBG_REG_ZERO "zero" 36 #define DBG_REG_RA "ra" 37 #define DBG_REG_SP "sp" 38 #define DBG_REG_GP "gp" 39 #define DBG_REG_TP "tp" 40 #define DBG_REG_T0 "t0" 41 #define DBG_REG_T1 "t1" 42 #define DBG_REG_T2 "t2" 43 #define DBG_REG_FP "fp" 44 #define DBG_REG_S1 "s1" 45 #define DBG_REG_A0 "a0" 46 #define DBG_REG_A1 "a1" 47 #define DBG_REG_A2 "a2" 48 #define DBG_REG_A3 "a3" 49 #define DBG_REG_A4 "a4" 50 #define DBG_REG_A5 "a5" 51 #define DBG_REG_A6 "a6" 52 #define DBG_REG_A7 "a7" 53 #define DBG_REG_S2 "s2" 54 #define DBG_REG_S3 "s3" 55 #define DBG_REG_S4 "s4" 56 #define DBG_REG_S5 "s5" 57 #define DBG_REG_S6 "s6" 58 #define DBG_REG_S7 "s7" 59 #define DBG_REG_S8 "s8" 60 #define DBG_REG_S9 "s9" 61 #define DBG_REG_S10 "s10" 62 #define DBG_REG_S11 "s11" 63 #define DBG_REG_T3 "t3" 64 #define DBG_REG_T4 "t4" 65 #define DBG_REG_T5 "t5" 66 #define DBG_REG_T6 "t6" 67 #define DBG_REG_EPC "pc" 68 #define DBG_REG_STATUS "sstatus" 69 #define DBG_REG_BADADDR "stval" 70 #define DBG_REG_CAUSE "scause" 71 72 #define DBG_REG_ZERO_OFF 0 73 #define DBG_REG_RA_OFF 1 74 #define DBG_REG_SP_OFF 2 75 #define DBG_REG_GP_OFF 3 76 #define DBG_REG_TP_OFF 4 77 #define DBG_REG_T0_OFF 5 78 #define DBG_REG_T1_OFF 6 79 #define DBG_REG_T2_OFF 7 80 #define DBG_REG_FP_OFF 8 81 #define DBG_REG_S1_OFF 9 82 #define DBG_REG_A0_OFF 10 83 #define DBG_REG_A1_OFF 11 84 #define DBG_REG_A2_OFF 12 85 #define DBG_REG_A3_OFF 13 86 #define DBG_REG_A4_OFF 14 87 #define DBG_REG_A5_OFF 15 88 #define DBG_REG_A6_OFF 16 89 #define DBG_REG_A7_OFF 17 90 #define DBG_REG_S2_OFF 18 91 #define DBG_REG_S3_OFF 19 92 #define DBG_REG_S4_OFF 20 93 #define DBG_REG_S5_OFF 21 94 #define DBG_REG_S6_OFF 22 95 #define DBG_REG_S7_OFF 23 96 #define DBG_REG_S8_OFF 24 97 #define DBG_REG_S9_OFF 25 98 #define DBG_REG_S10_OFF 26 99 #define DBG_REG_S11_OFF 27 100 #define DBG_REG_T3_OFF 28 101 #define DBG_REG_T4_OFF 29 102 #define DBG_REG_T5_OFF 30 103 #define DBG_REG_T6_OFF 31 104 #define DBG_REG_EPC_OFF 32 105 #define DBG_REG_STATUS_OFF 33 106 #define DBG_REG_BADADDR_OFF 34 107 #define DBG_REG_CAUSE_OFF 35 108 109 #include <asm/gdb_xml.h> 110 111 #endif 112 #endif 113