* hppa-dis.c (print_insn_hppa): Change condition args to use
[deliverable/binutils-gdb.git] / gdb / nlm / i386.c
CommitLineData
c906108c
SS
1#include <dfs.h>
2#include <stdio.h>
3#include <string.h>
4#include <stdlib.h>
5#include <ctype.h>
6#include <time.h>
7#include <conio.h>
8#include <advanced.h>
9#include <debugapi.h>
10#include <process.h>
11#include <errno.h>
12#include "i386.h"
13
14extern char *mem2hex (void *mem, char *buf, int count, int may_fault);
15extern char *hex2mem (char *buf, void *mem, int count, int may_fault);
16extern int computeSignal (int exceptionVector);
17
18void
19flush_i_cache()
20{
21}
22
23/* Get the registers out of the frame information. */
24
25void
26frame_to_registers (frame, regs)
27 struct StackFrame *frame;
28 char *regs;
29{
30 /* Copy EAX -> EDI */
31 mem2hex (&frame->ExceptionEAX, &regs[0 * 4 * 2], 4 * 8, 0);
32
33 /* Copy EIP & PS */
34 mem2hex (&frame->ExceptionPC, &regs[8 * 4 * 2], 4 * 2, 0);
35
36 /* Copy CS, SS, DS */
37 mem2hex (&frame->ExceptionCS, &regs[10 * 4 * 2], 4 * 3, 0);
38
39 /* Copy ES */
40 mem2hex (&frame->ExceptionES, &regs[13 * 4 * 2], 4 * 1, 0);
41
42 /* Copy FS & GS */
43 mem2hex (&frame->ExceptionFS, &regs[14 * 4 * 2], 4 * 2, 0);
44}
45
46/* Put the registers back into the frame information. */
47
48void
49registers_to_frame (regs, frame)
50 char *regs;
51 struct StackFrame *frame;
52{
53 /* Copy EAX -> EDI */
54 hex2mem (&regs[0 * 4 * 2], &frame->ExceptionEAX, 4 * 8, 0);
55
56 /* Copy EIP & PS */
57 hex2mem (&regs[8 * 4 * 2], &frame->ExceptionPC, 4 * 2, 0);
58
59 /* Copy CS, SS, DS */
60 hex2mem (&regs[10 * 4 * 2], &frame->ExceptionCS, 4 * 3, 0);
61
62 /* Copy ES */
63 hex2mem (&regs[13 * 4 * 2], &frame->ExceptionES, 4 * 1, 0);
64
65 /* Copy FS & GS */
66 hex2mem (&regs[14 * 4 * 2], &frame->ExceptionFS, 4 * 2, 0);
67}
68
69void
70set_step_traps (frame)
71 struct StackFrame *frame;
72{
73 frame->ExceptionSystemFlags |= 0x100;
74}
75
76void
77clear_step_traps (frame)
78 struct StackFrame *frame;
79{
80 frame->ExceptionSystemFlags &= ~0x100;
81}
82
83void
84do_status (ptr, frame)
85 char *ptr;
86 struct StackFrame *frame;
87{
88 int sigval;
89
90 sigval = computeSignal (frame->ExceptionNumber);
91
92 sprintf (ptr, "T%02x", sigval);
93 ptr += 3;
94
95 sprintf (ptr, "%02x:", PC_REGNUM);
96 ptr = mem2hex (&frame->ExceptionPC, ptr + 3, 4, 0);
97 *ptr++ = ';';
98
99 sprintf (ptr, "%02x:", SP_REGNUM);
100 ptr = mem2hex (&frame->ExceptionESP, ptr + 3, 4, 0);
101 *ptr++ = ';';
102
103 sprintf (ptr, "%02x:", FP_REGNUM);
104 ptr = mem2hex (&frame->ExceptionEBP, ptr + 3, 4, 0);
105 *ptr++ = ';';
106
107 *ptr = '\000';
108}
This page took 0.039846 seconds and 4 git commands to generate.