kgdb: x86: Return all segment registers also in 64-bit mode
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 19 Mar 2012 20:16:48 +0000 (15:16 -0500)
committerJason Wessel <jason.wessel@windriver.com>
Thu, 22 Mar 2012 20:07:15 +0000 (15:07 -0500)
Even if the content is always 0, gdb expects us to return also ds,
es, fs, and gs while in x86-64 mode. Do this to avoid ugly errors on
"info registers".

[jason.wessel@windriver.com: adjust NUMREGBYTES for two new regs]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
arch/x86/include/asm/kgdb.h
arch/x86/kernel/kgdb.c

index 77e95f5..332f98c 100644 (file)
@@ -64,11 +64,15 @@ enum regnames {
        GDB_PS,                 /* 17 */
        GDB_CS,                 /* 18 */
        GDB_SS,                 /* 19 */
+       GDB_DS,                 /* 20 */
+       GDB_ES,                 /* 21 */
+       GDB_FS,                 /* 22 */
+       GDB_GS,                 /* 23 */
 };
 #define GDB_ORIG_AX            57
-#define DBG_MAX_REG_NUM                20
-/* 17 64 bit regs and 3 32 bit regs */
-#define NUMREGBYTES            ((17 * 8) + (3 * 4))
+#define DBG_MAX_REG_NUM                24
+/* 17 64 bit regs and 5 32 bit regs */
+#define NUMREGBYTES            ((17 * 8) + (5 * 4))
 #endif /* ! CONFIG_X86_32 */
 
 static inline void arch_kgdb_breakpoint(void)
index faba577..fdc37b3 100644 (file)
@@ -67,8 +67,6 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
        { "ss", 4, offsetof(struct pt_regs, ss) },
        { "ds", 4, offsetof(struct pt_regs, ds) },
        { "es", 4, offsetof(struct pt_regs, es) },
-       { "fs", 4, -1 },
-       { "gs", 4, -1 },
 #else
        { "ax", 8, offsetof(struct pt_regs, ax) },
        { "bx", 8, offsetof(struct pt_regs, bx) },
@@ -90,7 +88,11 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
        { "flags", 4, offsetof(struct pt_regs, flags) },
        { "cs", 4, offsetof(struct pt_regs, cs) },
        { "ss", 4, offsetof(struct pt_regs, ss) },
+       { "ds", 4, -1 },
+       { "es", 4, -1 },
 #endif
+       { "fs", 4, -1 },
+       { "gs", 4, -1 },
 };
 
 int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)