Commit 1cde8881 authored by Jason Wessel's avatar Jason Wessel

kgdb,i386: Fix corner case access to sp with NMI watch dog exception

It is possible for the user_mode_vm(regs) check to return true for a
non master kgdb cpu or when the master kgdb cpu handles the NMI watch
dog exception.

The solution is simply to select the correct stack pointer location
based on the check to user_mode_vm(regs).
Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
parent b460e199
...@@ -85,10 +85,15 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) ...@@ -85,10 +85,15 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
gdb_regs[GDB_DS] = regs->ds; gdb_regs[GDB_DS] = regs->ds;
gdb_regs[GDB_ES] = regs->es; gdb_regs[GDB_ES] = regs->es;
gdb_regs[GDB_CS] = regs->cs; gdb_regs[GDB_CS] = regs->cs;
gdb_regs[GDB_SS] = __KERNEL_DS;
gdb_regs[GDB_FS] = 0xFFFF; gdb_regs[GDB_FS] = 0xFFFF;
gdb_regs[GDB_GS] = 0xFFFF; gdb_regs[GDB_GS] = 0xFFFF;
gdb_regs[GDB_SP] = (int)&regs->sp; if (user_mode_vm(regs)) {
gdb_regs[GDB_SS] = regs->ss;
gdb_regs[GDB_SP] = regs->sp;
} else {
gdb_regs[GDB_SS] = __KERNEL_DS;
gdb_regs[GDB_SP] = (unsigned long)&regs->sp;
}
#else #else
gdb_regs[GDB_R8] = regs->r8; gdb_regs[GDB_R8] = regs->r8;
gdb_regs[GDB_R9] = regs->r9; gdb_regs[GDB_R9] = regs->r9;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment