18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_KGDB_H_ 38c2ecf20Sopenharmony_ci#define __ASM_KGDB_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <asm/sgidefs.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \ 108c2ecf20Sopenharmony_ci (_MIPS_ISA == _MIPS_ISA_MIPS32) 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#define KGDB_GDB_REG_SIZE 32 138c2ecf20Sopenharmony_ci#define GDB_SIZEOF_REG sizeof(u32) 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \ 168c2ecf20Sopenharmony_ci (_MIPS_ISA == _MIPS_ISA_MIPS64) 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#ifdef CONFIG_32BIT 198c2ecf20Sopenharmony_ci#define KGDB_GDB_REG_SIZE 32 208c2ecf20Sopenharmony_ci#define GDB_SIZEOF_REG sizeof(u32) 218c2ecf20Sopenharmony_ci#else /* CONFIG_CPU_32BIT */ 228c2ecf20Sopenharmony_ci#define KGDB_GDB_REG_SIZE 64 238c2ecf20Sopenharmony_ci#define GDB_SIZEOF_REG sizeof(u64) 248c2ecf20Sopenharmony_ci#endif 258c2ecf20Sopenharmony_ci#else 268c2ecf20Sopenharmony_ci#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA" 278c2ecf20Sopenharmony_ci#endif /* _MIPS_ISA */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define BUFMAX 2048 308c2ecf20Sopenharmony_ci#define DBG_MAX_REG_NUM 72 318c2ecf20Sopenharmony_ci#define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG)) 328c2ecf20Sopenharmony_ci#define NUMCRITREGBYTES (12 * sizeof(GDB_SIZEOF_REG)) 338c2ecf20Sopenharmony_ci#define BREAK_INSTR_SIZE 4 348c2ecf20Sopenharmony_ci#define CACHE_FLUSH_IS_SAFE 0 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciextern void arch_kgdb_breakpoint(void); 378c2ecf20Sopenharmony_ciextern void *saved_vectors[32]; 388c2ecf20Sopenharmony_ciextern void handle_exception(struct pt_regs *regs); 398c2ecf20Sopenharmony_ciextern void breakinst(void); 408c2ecf20Sopenharmony_ciextern int kgdb_ll_trap(int cmd, const char *str, 418c2ecf20Sopenharmony_ci struct pt_regs *regs, long err, int trap, int sig); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */ 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#endif /* __ASM_KGDB_H_ */ 46