From ef4b379aabdb863aa520a9d66ec4d823e918ab1f Mon Sep 17 00:00:00 2001 From: "J.T. Conklin" Date: Fri, 19 Aug 1994 00:06:47 +0000 Subject: [PATCH] * nlm/i386.c, nlm/i386.h: New files that contain i386 specific code. --- gdb/ChangeLog | 4 +++ gdb/nlm/i386.c | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/nlm/i386.h | 13 +++++++++ 3 files changed, 105 insertions(+) create mode 100644 gdb/nlm/i386.c create mode 100644 gdb/nlm/i386.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9325d41..c099f95 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +Thu Aug 18 17:01:35 1994 J.T. Conklin (jtc@rtl.cygnus.com) + + * nlm/i386.c, nlm/i386.h: New files that contain i386 specific code. + Thu Aug 18 14:39:46 1994 Stan Shebs (shebs@andros.cygnus.com) * README: Grammar improvements, clarifications, updates. diff --git a/gdb/nlm/i386.c b/gdb/nlm/i386.c new file mode 100644 index 0000000..68132ce --- /dev/null +++ b/gdb/nlm/i386.c @@ -0,0 +1,88 @@ +#include "i386.h" + +/* Get the registers out of the frame information. */ + +static void +frame_to_registers (frame, regs) + struct StackFrame *frame; + char *regs; +{ + /* Copy EAX -> EDI */ + mem2hex (&frame->ExceptionEAX, ®s[0 * 4 * 2], 4 * 8, 0); + + /* Copy EIP & PS */ + mem2hex (&frame->ExceptionPC, ®s[8 * 4 * 2], 4 * 2, 0); + + /* Copy CS, SS, DS */ + mem2hex (&frame->ExceptionCS, ®s[10 * 4 * 2], 4 * 3, 0); + + /* Copy ES */ + mem2hex (&frame->ExceptionES, ®s[13 * 4 * 2], 4 * 1, 0); + + /* Copy FS & GS */ + mem2hex (&frame->ExceptionFS, ®s[14 * 4 * 2], 4 * 2, 0); +} + +/* Put the registers back into the frame information. */ + +static void +registers_to_frame (regs, frame) + char *regs; + struct StackFrame *frame; +{ + /* Copy EAX -> EDI */ + hex2mem (®s[0 * 4 * 2], &frame->ExceptionEAX, 4 * 8, 0); + + /* Copy EIP & PS */ + hex2mem (®s[8 * 4 * 2], &frame->ExceptionPC, 4 * 2, 0); + + /* Copy CS, SS, DS */ + hex2mem (®s[10 * 4 * 2], &frame->ExceptionCS, 4 * 3, 0); + + /* Copy ES */ + hex2mem (®s[13 * 4 * 2], &frame->ExceptionES, 4 * 1, 0); + + /* Copy FS & GS */ + hex2mem (®s[14 * 4 * 2], &frame->ExceptionFS, 4 * 2, 0); +} + +static void +set_step_traps (frame) + struct StackFrame *frame; +{ + frame->ExceptionSystemFlags |= 0x100; +} + +static void +clear_step_traps (frame) + struct StackFrame *frame; +{ + frame->ExceptionSystemFlags &= ~0x100; +} + +static void +do_status (ptr, frame) + char *ptr; + struct StackFrame *frame; +{ + int sigval; + + sigval = computeSignal (frame->ExceptionNumber); + + sprintf (ptr, "T%02x", sigval); + ptr += 3; + + sprintf (ptr, "%02x:", PC_REGNUM); + ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0); + *ptr++ = ';'; + + sprintf (ptr, "%02x:", SP_REGNUM); + ptr = mem2hex (&frame->ExceptionESP, ptr + 3, 4, 0); + *ptr++ = ';'; + + sprintf (ptr, "%02x:", FP_REGNUM); + ptr = mem2hex (&frame->ExceptionEBP, ptr + 3, 4, 0); + *ptr++ = ';'; + + *ptr = '\000'; +} diff --git a/gdb/nlm/i386.h b/gdb/nlm/i386.h new file mode 100644 index 0000000..155702b --- /dev/null +++ b/gdb/nlm/i386.h @@ -0,0 +1,13 @@ +/* Register values. All of these values *MUST* agree with tm.h */ +#define SP_REGNUM 4 /* Contains address of top of stack */ +#define PC_REGNUM 8 /* Contains program counter */ +#define FP_REGNUM 5 /* Virtual frame pointer */ +#define NUM_REGS 16 /* Number of machine registers */ +#define REGISTER_BYTES (NUM_REGS * 4) /* Total size of registers array */ + +#define ExceptionPC ExceptionEIP +#define DECR_PC_AFTER_BREAK 1 /* int 3 leaves PC pointing after insn */ +#define BREAKPOINT {0xcc} +#define BREAKPOINT_SIZE (sizeof breakpoint_insn) + +#define StackFrame T_TSS_StackFrame -- 2.7.4