[PATCH 2.6.27-rc3 7/28] mdb: add ia32 specific debugger commands

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: jmerkey
Date: Friday, August 15, 2008 - 8:41 pm

Need to add TSS gates to all exceptions in ia32 since current GDT only
uses trap gates.  TSS gates allow the processor to switch to a known
good stack rather than expect the double fault handler to do so.

Signed-off-by: Jeffrey Vernon Merkey (jmerkey@wolfmountaingroup.com)

--- a/debug/mdb/mdb-ia32.c	1969-12-31 17:00:00.000000000 -0700
+++ b/debug/mdb/mdb-ia32.c	2008-08-15 15:41:57.000000000 -0600
@@ -0,0 +1,5651 @@
+
+/***************************************************************************
+*
+*   Copyright (c) 2008 Jeff V. Merkey  All Rights Reserved.
+*   1058 East 50 South
+*   Lindon, Utah 84042
+*   jmerkey@wolfmountaingroup.com
+*
+*   This program is free software; you can redistribute it and/or modify it
+*   under the terms of the GNU General Public License as published by the
+*   Free Software Foundation, version 2.
+*
+*   This program is distributed in the hope that it will be useful, but
+*   WITHOUT ANY WARRANTY; without even the implied warranty of
+*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+*   General Public License for more details.
+*
+*   You are free to modify and re-distribute this program in accordance
+*   with the terms specified in the GNU Public License.  The copyright
+*   contained in this code is required to be present in any derivative
+*   works and you are required to provide the source code for this
+*   program as part of any commercial or non-commercial distribution.
+*   You are required to respect the rights of the Copyright holders
+*   named within this code.
+*
+*   jmerkey@wolfmountaingroup.com is the official maintainer of
+*   this code.  You are encouraged to report any bugs, problems, fixes,
+*   suggestions, and comments about this software.
+*
+*   AUTHOR   :  Jeff V. Merkey
+*   DESCRIP  :  Merkey's Linux Debugger
+*
+***************************************************************************/
+
+#include <linux/version.h>
+#include <linux/types.h>
+#include <linux/sched.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/string.h>
+#include <linux/stat.h>
+#include <linux/errno.h>
+#include <linux/fcntl.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
+#include <linux/genhd.h>
+#include <linux/hdreg.h>
+#include <linux/fs.h>
+#include <linux/major.h>
+#include <linux/mm.h>
+#include <linux/cdrom.h>
+#include <linux/pagemap.h>
+#include <linux/swap.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/ctype.h>
+#include <linux/keyboard.h>
+#include <linux/console.h>
+#include <linux/serial_reg.h>
+#include <linux/uaccess.h>
+#include <asm/system.h>
+#include <asm/segment.h>
+#include <asm/atomic.h>
+#include <asm/msr.h>
+#include <linux/io.h>
+#include <linux/clocksource.h>
+
+#ifdef CONFIG_SMP
+#include <mach_apic.h>
+#include <mach_ipi.h>
+#endif
+
+#define __KERNEL_SYSCALLS__
+#include <linux/unistd.h>
+#include <linux/kallsyms.h>
+
+#include "mdb.h"
+#include "mdb-ia32.h"
+#include "mdb-list.h"
+#include "mdb-ia32-proc.h"
+#include "mdb-base.h"
+#include "mdb-proc.h"
+#include "mdb-os.h"
+#include "mdb-keyboard.h"
+
+unsigned long MajorVersion = 8;
+unsigned long MinorVersion = 8;
+unsigned long BuildVersion = 8;
+
+unsigned char *IA32Flags[]=
+{
+   "CF", 0, "PF", 0, "AF",    0, "ZF", "SF", "TF", "IF", "DF", "OF",
+   0,    0, "NT", 0, "RF", "VM", "AC", "VIF","VIP","ID",    0,    0,
+   0,
+};
+
+unsigned char *BreakDescription[]=
+{
+   "EXECUTE",  "WRITE",  "IOPORT",  "READ/WRITE",
+};
+
+unsigned char *BreakLengthDescription[]={
+   ": 1 BYTE",  ": 2 BYTE",  ": ??????",  ": 4 BYTE",
+};
+
+unsigned char *ExceptionDescription[]={
+   "Divide By Zero",                 /*  0 */
+   "Debugger Exception (INT1)",      /*  1 */
+   "Non-Maskable Interrupt",         /*  2 */
+   "Debugger Breakpoint (INT3)",     /*  3 */
+   "Overflow Exception",             /*  4 */
+   "Bounds Check",                   /*  5 */
+   "Invalid Opcode",                 /*  6 */
+   "No Coprocessor",                 /*  7 */
+   "Double Fault",                   /*  8 */
+   "Cops Error",                     /*  9 */
+   "Invalid Task State Segment",     /*  10 */
+   "Segment Not Present",            /*  11 */
+   "Stack Exception",                /*  12 */
+   "General Protection",             /*  13 */
+   "Page Fault",                     /*  14 */
+   "InvalidInterrupt",               /*  15 */
+   "Coprocessor Error",              /*  16 */
+   "AlignmentCheck",                 /*  17 */
+   "Machine Check",                  /*  18 */
+   "Enter Debugger Request",         /*  19 */
+   "Unvectored Exception",           /*  20 */
+   "Directed NMI Breakpoint",        /*  21 */
+   "Panic"                           /*  22 */
+};
+unsigned long exceptions = (sizeof(ExceptionDescription) / sizeof(unsigned char *));
+
+unsigned char char32spc[] = { "xxx
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2.6.27-rc3 7/28] mdb: add ia32 specific debugger co ..., jmerkey, (Fri Aug 15, 8:41 pm)