162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef __ASM_KGDB_H_ 362306a36Sopenharmony_ci#define __ASM_KGDB_H_ 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#ifdef __KERNEL__ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#include <asm/sgidefs.h> 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \ 1062306a36Sopenharmony_ci (_MIPS_ISA == _MIPS_ISA_MIPS32) 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#define KGDB_GDB_REG_SIZE 32 1362306a36Sopenharmony_ci#define GDB_SIZEOF_REG sizeof(u32) 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \ 1662306a36Sopenharmony_ci (_MIPS_ISA == _MIPS_ISA_MIPS64) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#ifdef CONFIG_32BIT 1962306a36Sopenharmony_ci#define KGDB_GDB_REG_SIZE 32 2062306a36Sopenharmony_ci#define GDB_SIZEOF_REG sizeof(u32) 2162306a36Sopenharmony_ci#else /* CONFIG_32BIT */ 2262306a36Sopenharmony_ci#define KGDB_GDB_REG_SIZE 64 2362306a36Sopenharmony_ci#define GDB_SIZEOF_REG sizeof(u64) 2462306a36Sopenharmony_ci#endif 2562306a36Sopenharmony_ci#else 2662306a36Sopenharmony_ci#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA" 2762306a36Sopenharmony_ci#endif /* _MIPS_ISA */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ci#define BUFMAX 2048 3062306a36Sopenharmony_ci#define DBG_MAX_REG_NUM 72 3162306a36Sopenharmony_ci#define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG)) 3262306a36Sopenharmony_ci#define NUMCRITREGBYTES (12 * sizeof(GDB_SIZEOF_REG)) 3362306a36Sopenharmony_ci#define BREAK_INSTR_SIZE 4 3462306a36Sopenharmony_ci#define CACHE_FLUSH_IS_SAFE 0 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciextern void arch_kgdb_breakpoint(void); 3762306a36Sopenharmony_ciextern void *saved_vectors[32]; 3862306a36Sopenharmony_ciextern void handle_exception(struct pt_regs *regs); 3962306a36Sopenharmony_ciextern void breakinst(void); 4062306a36Sopenharmony_ciextern int kgdb_ll_trap(int cmd, const char *str, 4162306a36Sopenharmony_ci struct pt_regs *regs, long err, int trap, int sig); 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#endif /* __KERNEL__ */ 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#endif /* __ASM_KGDB_H_ */ 46