Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_KGDB_H
0003 #define _ASM_X86_KGDB_H
0004 
0005 /*
0006  * Copyright (C) 2001-2004 Amit S. Kale
0007  * Copyright (C) 2008 Wind River Systems, Inc.
0008  */
0009 
0010 #include <asm/ptrace.h>
0011 
0012 /*
0013  * BUFMAX defines the maximum number of characters in inbound/outbound
0014  * buffers at least NUMREGBYTES*2 are needed for register packets
0015  * Longer buffer is needed to list all threads
0016  */
0017 #define BUFMAX          1024
0018 
0019 /*
0020  *  Note that this register image is in a different order than
0021  *  the register image that Linux produces at interrupt time.
0022  *
0023  *  Linux's register image is defined by struct pt_regs in ptrace.h.
0024  *  Just why GDB uses a different order is a historical mystery.
0025  */
0026 #ifdef CONFIG_X86_32
0027 enum regnames {
0028     GDB_AX,         /* 0 */
0029     GDB_CX,         /* 1 */
0030     GDB_DX,         /* 2 */
0031     GDB_BX,         /* 3 */
0032     GDB_SP,         /* 4 */
0033     GDB_BP,         /* 5 */
0034     GDB_SI,         /* 6 */
0035     GDB_DI,         /* 7 */
0036     GDB_PC,         /* 8 also known as eip */
0037     GDB_PS,         /* 9 also known as eflags */
0038     GDB_CS,         /* 10 */
0039     GDB_SS,         /* 11 */
0040     GDB_DS,         /* 12 */
0041     GDB_ES,         /* 13 */
0042     GDB_FS,         /* 14 */
0043     GDB_GS,         /* 15 */
0044 };
0045 #define GDB_ORIG_AX     41
0046 #define DBG_MAX_REG_NUM     16
0047 #define NUMREGBYTES     ((GDB_GS+1)*4)
0048 #else /* ! CONFIG_X86_32 */
0049 enum regnames {
0050     GDB_AX,         /* 0 */
0051     GDB_BX,         /* 1 */
0052     GDB_CX,         /* 2 */
0053     GDB_DX,         /* 3 */
0054     GDB_SI,         /* 4 */
0055     GDB_DI,         /* 5 */
0056     GDB_BP,         /* 6 */
0057     GDB_SP,         /* 7 */
0058     GDB_R8,         /* 8 */
0059     GDB_R9,         /* 9 */
0060     GDB_R10,        /* 10 */
0061     GDB_R11,        /* 11 */
0062     GDB_R12,        /* 12 */
0063     GDB_R13,        /* 13 */
0064     GDB_R14,        /* 14 */
0065     GDB_R15,        /* 15 */
0066     GDB_PC,         /* 16 */
0067     GDB_PS,         /* 17 */
0068     GDB_CS,         /* 18 */
0069     GDB_SS,         /* 19 */
0070     GDB_DS,         /* 20 */
0071     GDB_ES,         /* 21 */
0072     GDB_FS,         /* 22 */
0073     GDB_GS,         /* 23 */
0074 };
0075 #define GDB_ORIG_AX     57
0076 #define DBG_MAX_REG_NUM     24
0077 /* 17 64 bit regs and 5 32 bit regs */
0078 #define NUMREGBYTES     ((17 * 8) + (5 * 4))
0079 #endif /* ! CONFIG_X86_32 */
0080 
0081 static inline void arch_kgdb_breakpoint(void)
0082 {
0083     asm("   int $3");
0084 }
0085 #define BREAK_INSTR_SIZE    1
0086 #define CACHE_FLUSH_IS_SAFE 1
0087 #define GDB_ADJUSTS_BREAK_OFFSET
0088 
0089 extern int kgdb_ll_trap(int cmd, const char *str,
0090             struct pt_regs *regs, long err, int trap, int sig);
0091 
0092 #endif /* _ASM_X86_KGDB_H */