OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [nlm/] [i386.c] - Blame information for rev 107

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
#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
 
14
extern char *mem2hex (void *mem, char *buf, int count, int may_fault);
15
extern char *hex2mem (char *buf, void *mem, int count, int may_fault);
16
extern int computeSignal (int exceptionVector);
17
 
18
void
19
flush_i_cache()
20
{
21
}
22
 
23
/* Get the registers out of the frame information.  */
24
 
25
void
26
frame_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
 
48
void
49
registers_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
 
69
void
70
set_step_traps (frame)
71
     struct StackFrame *frame;
72
{
73
  frame->ExceptionSystemFlags |= 0x100;
74
}
75
 
76
void
77
clear_step_traps (frame)
78
     struct StackFrame *frame;
79
{
80
  frame->ExceptionSystemFlags &= ~0x100;
81
}
82
 
83
void
84
do_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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.