Re: [PATCH 5/8] kgdb, x86: Add arch specfic kgdb support

From: Jan Kiszka
Date: Sat Feb 09 2008 - 09:34:39 EST


jason.wessel@xxxxxxxxxxxxx wrote:
> --- /dev/null
> +++ b/include/asm-x86/kgdb.h
> @@ -0,0 +1,79 @@
> +#ifdef __KERNEL__
> +#ifndef _ASM_KGDB_H_
> +#define _ASM_KGDB_H_
> +
> +/*
> + * Copyright (C) 2001-2004 Amit S. Kale
> + * Copyright (C) 2008 Wind River Systems, Inc.
> + */
> +
> +#include <asm-generic/kgdb.h>
> +
> +/*
> + * BUFMAX defines the maximum number of characters in inbound/outbound
> + * buffers at least NUMREGBYTES*2 are needed for register packets
> + * Longer buffer is needed to list all threads
> + */
> +#define BUFMAX 1024
> +
> +/*
> + * Note that this register image is in a different order than
> + * the register image that Linux produces at interrupt time.
> + *
> + * Linux's register image is defined by struct pt_regs in ptrace.h.
> + * Just why GDB uses a different order is a historical mystery.
> + */
> +#ifdef CONFIG_X86_32
> +enum regnames { _AX, /* 0 */
> + _CX, /* 1 */
> + _DX, /* 2 */
> + _BX, /* 3 */
> + _SP, /* 4 */
> + _BP, /* 5 */
> + _SI, /* 6 */
> + _DI, /* 7 */
> + _PC, /* 8 also known as eip */
> + _PS, /* 9 also known as eflags */
> + _CS, /* 10 */
> + _SS, /* 11 */
> + _DS, /* 12 */
> + _ES, /* 13 */
> + _FS, /* 14 */
> + _GS /* 15 */
> +};
> +#else /* ! CONFIG_X86_32 */
> +enum regnames { _AX, /* 0 */
> + _DX, /* 1 */
> + _CX, /* 2 */
> + _BX, /* 3 */
> + _SI, /* 4 */
> + _DI, /* 5 */
> + _BP, /* 6 */
> + _SP, /* 7 */
> + _R8, /* 8 */
> + _R9, /* 9 */
> + _R10, /* 10 */
> + _R11, /* 11 */
> + _R12, /* 12 */
> + _R13, /* 13 */
> + _R14, /* 14 */
> + _R15, /* 15 */
> + _PC, /* 16 */
> + _PS /* 17 */
> +};
> +#endif /* CONFIG_X86_32 */
> +
> +/* Number of bytes for gdb registers */
> +#ifdef CONFIG_X86_32
> +#define NUMREGBYTES 64
> +#else /* ! CONFIG_X86_32 */
> +#define NUMREGBYTES ((_PS+1)*8)
> +#endif /* CONFIG_X86_32 */
> +
> +#ifndef __ASSEMBLY__
> +#define BREAKPOINT() asm(" int $3");
> +#define BREAK_INSTR_SIZE 1
> +#define CACHE_FLUSH_IS_SAFE 1
> +#endif /* !__ASSEMBLY__ */
> +#endif /* _ASM_KGDB_H_ */
> +#endif /* __KERNEL__ */

Please fold into the next version:

diff --git a/include/asm-x86/kgdb.h b/include/asm-x86/kgdb.h
index c2803a8..0ba150b 100644
--- a/include/asm-x86/kgdb.h
+++ b/include/asm-x86/kgdb.h
@@ -1,4 +1,3 @@
-#ifdef __KERNEL__
#ifndef _ASM_KGDB_H_
#define _ASM_KGDB_H_

@@ -70,10 +69,7 @@ enum regnames { _AX, /* 0 */
#define NUMREGBYTES ((_PS+1)*8)
#endif /* CONFIG_X86_32 */

-#ifndef __ASSEMBLY__
#define BREAKPOINT() asm(" int $3");
#define BREAK_INSTR_SIZE 1
#define CACHE_FLUSH_IS_SAFE 1
-#endif /* !__ASSEMBLY__ */
-#endif /* _ASM_KGDB_H_ */
-#endif /* __KERNEL__ */
+#endif /* _ASM_KGDB_H_ */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/