~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/include/asm/kgdb.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * Copyright (C) 2023 Loongson Technology Corporation Limited
  4  */
  5 
  6 #ifndef _ASM_LOONGARCH_KGDB_H
  7 #define _ASM_LOONGARCH_KGDB_H
  8 
  9 #define GDB_SIZEOF_REG          sizeof(u64)
 10 
 11 /* gdb remote procotol expects the following register layout. */
 12 
 13 /*
 14  * General purpose registers:
 15  *     r0-r31: 64 bit
 16  *     orig_a0: 64 bit
 17  *     pc : 64 bit
 18  *     csr_badvaddr: 64 bit
 19  */
 20 #define DBG_PT_REGS_BASE        0
 21 #define DBG_PT_REGS_NUM         35
 22 #define DBG_PT_REGS_END         (DBG_PT_REGS_BASE + DBG_PT_REGS_NUM - 1)
 23 
 24 /*
 25  * Floating point registers:
 26  *     f0-f31: 64 bit
 27  */
 28 #define DBG_FPR_BASE            (DBG_PT_REGS_END + 1)
 29 #define DBG_FPR_NUM             32
 30 #define DBG_FPR_END             (DBG_FPR_BASE + DBG_FPR_NUM - 1)
 31 
 32 /*
 33  * Condition Flag registers:
 34  *     fcc0-fcc8: 8 bit
 35  */
 36 #define DBG_FCC_BASE            (DBG_FPR_END + 1)
 37 #define DBG_FCC_NUM             8
 38 #define DBG_FCC_END             (DBG_FCC_BASE + DBG_FCC_NUM - 1)
 39 
 40 /*
 41  * Floating-point Control and Status registers:
 42  *     fcsr: 32 bit
 43  */
 44 #define DBG_FCSR_NUM            1
 45 #define DBG_FCSR                (DBG_FCC_END + 1)
 46 
 47 #define DBG_MAX_REG_NUM         (DBG_FCSR + 1)
 48 
 49 /*
 50  * Size of I/O buffer for gdb packet.
 51  * considering to hold all register contents, size is set
 52  */
 53 #define BUFMAX                  2048
 54 
 55 /*
 56  * Number of bytes required for gdb_regs buffer.
 57  * PT_REGS and FPR: 8 bytes; FCSR: 4 bytes; FCC: 1 bytes.
 58  * GDB fails to connect for size beyond this with error
 59  * "'g' packet reply is too long"
 60  */
 61 #define NUMREGBYTES             ((DBG_PT_REGS_NUM + DBG_FPR_NUM) * GDB_SIZEOF_REG + DBG_FCC_NUM * 1 + DBG_FCSR_NUM * 4)
 62 
 63 #define BREAK_INSTR_SIZE        4
 64 #define CACHE_FLUSH_IS_SAFE     0
 65 
 66 /* Register numbers of various important registers. */
 67 enum dbg_loongarch_regnum {
 68         DBG_LOONGARCH_ZERO = 0,
 69         DBG_LOONGARCH_RA,
 70         DBG_LOONGARCH_TP,
 71         DBG_LOONGARCH_SP,
 72         DBG_LOONGARCH_A0,
 73         DBG_LOONGARCH_FP = 22,
 74         DBG_LOONGARCH_S0,
 75         DBG_LOONGARCH_S1,
 76         DBG_LOONGARCH_S2,
 77         DBG_LOONGARCH_S3,
 78         DBG_LOONGARCH_S4,
 79         DBG_LOONGARCH_S5,
 80         DBG_LOONGARCH_S6,
 81         DBG_LOONGARCH_S7,
 82         DBG_LOONGARCH_S8,
 83         DBG_LOONGARCH_ORIG_A0,
 84         DBG_LOONGARCH_PC,
 85         DBG_LOONGARCH_BADV
 86 };
 87 
 88 void kgdb_breakinst(void);
 89 void arch_kgdb_breakpoint(void);
 90 
 91 #ifdef CONFIG_KGDB
 92 bool kgdb_breakpoint_handler(struct pt_regs *regs);
 93 #else /* !CONFIG_KGDB */
 94 static inline bool kgdb_breakpoint_handler(struct pt_regs *regs) { return false; }
 95 #endif /* CONFIG_KGDB */
 96 
 97 #endif /* __ASM_KGDB_H_ */
 98 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php