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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [tahoe-tdep.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* OBSOLETE /* Print instructions for Tahoe target machines, for GDB. */
2
/* OBSOLETE    Copyright 1986, 1989, 1991, 1992, 2000 Free Software Foundation, Inc. */
3
/* OBSOLETE    Contributed by the State University of New York at Buffalo, by the */
4
/* OBSOLETE    Distributed Computer Systems Lab, Department of Computer Science, 1991. */
5
/* OBSOLETE  */
6
/* OBSOLETE    This file is part of GDB. */
7
/* OBSOLETE  */
8
/* OBSOLETE    This program is free software; you can redistribute it and/or modify */
9
/* OBSOLETE    it under the terms of the GNU General Public License as published by */
10
/* OBSOLETE    the Free Software Foundation; either version 2 of the License, or */
11
/* OBSOLETE    (at your option) any later version. */
12
/* OBSOLETE  */
13
/* OBSOLETE    This program is distributed in the hope that it will be useful, */
14
/* OBSOLETE    but WITHOUT ANY WARRANTY; without even the implied warranty of */
15
/* OBSOLETE    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the */
16
/* OBSOLETE    GNU General Public License for more details. */
17
/* OBSOLETE  */
18
/* OBSOLETE    You should have received a copy of the GNU General Public License */
19
/* OBSOLETE    along with this program; if not, write to the Free Software */
20
/* OBSOLETE    Foundation, Inc., 59 Temple Place - Suite 330, */
21
/* OBSOLETE    Boston, MA 02111-1307, USA.  *x/ */
22
/* OBSOLETE  */
23
/* OBSOLETE #include "defs.h" */
24
/* OBSOLETE #include "symtab.h" */
25
/* OBSOLETE #include "opcode/tahoe.h" */
26
/* OBSOLETE  */
27
/* OBSOLETE /* Tahoe instructions are never longer than this.  *x/ */
28
/* OBSOLETE #define MAXLEN 62 */
29
/* OBSOLETE  */
30
/* OBSOLETE /* Number of elements in the opcode table.  *x/ */
31
/* OBSOLETE #define NOPCODES (sizeof votstrs / sizeof votstrs[0]) */
32
/* OBSOLETE  */
33
/* OBSOLETE static unsigned char *print_insn_arg (); */
34
/* OBSOLETE  */
35
/* OBSOLETE /* Advance PC across any function entry prologue instructions */
36
/* OBSOLETE    to reach some "real" code.  *x/ */
37
/* OBSOLETE  */
38
/* OBSOLETE CORE_ADDR */
39
/* OBSOLETE tahoe_skip_prologue (pc) */
40
/* OBSOLETE      CORE_ADDR pc; */
41
/* OBSOLETE { */
42
/* OBSOLETE   register int op = (unsigned char) read_memory_integer (pc, 1); */
43
/* OBSOLETE   if (op == 0x11) */
44
/* OBSOLETE     pc += 2;                        /* skip brb *x/ */
45
/* OBSOLETE   if (op == 0x13) */
46
/* OBSOLETE     pc += 3;                        /* skip brw *x/ */
47
/* OBSOLETE   if (op == 0x2c */
48
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 2, 1)) == 0x5e) */
49
/* OBSOLETE     pc += 3;                        /* skip subl2 *x/ */
50
/* OBSOLETE   if (op == 0xe9 */
51
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xae */
52
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 3, 1)) == 0x5e) */
53
/* OBSOLETE     pc += 4;                        /* skip movab *x/ */
54
/* OBSOLETE   if (op == 0xe9 */
55
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xce */
56
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 4, 1)) == 0x5e) */
57
/* OBSOLETE     pc += 5;                        /* skip movab *x/ */
58
/* OBSOLETE   if (op == 0xe9 */
59
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 1, 1)) == 0xee */
60
/* OBSOLETE       && ((unsigned char) read_memory_integer (pc + 6, 1)) == 0x5e) */
61
/* OBSOLETE     pc += 7;                        /* skip movab *x/ */
62
/* OBSOLETE   return pc; */
63
/* OBSOLETE } */
64
/* OBSOLETE  */
65
/* OBSOLETE /* Return number of args passed to a frame. */
66
/* OBSOLETE    Can return -1, meaning no way to tell.  *x/ */
67
/* OBSOLETE  */
68
/* OBSOLETE int */
69
/* OBSOLETE tahoe_frame_num_args (fi) */
70
/* OBSOLETE      struct frame_info *fi; */
71
/* OBSOLETE { */
72
/* OBSOLETE   return (((0xffff & read_memory_integer (((fi)->frame - 4), 4)) - 4) >> 2); */
73
/* OBSOLETE } */
74
/* OBSOLETE  */
75
/* OBSOLETE /* Print the Tahoe instruction at address MEMADDR in debugged memory, */
76
/* OBSOLETE    on STREAM.  Returns length of the instruction, in bytes.  *x/ */
77
/* OBSOLETE  */
78
/* OBSOLETE int */
79
/* OBSOLETE tahoe_print_insn (memaddr, stream) */
80
/* OBSOLETE      CORE_ADDR memaddr; */
81
/* OBSOLETE      struct ui_file *stream; */
82
/* OBSOLETE { */
83
/* OBSOLETE   unsigned char buffer[MAXLEN]; */
84
/* OBSOLETE   register int i; */
85
/* OBSOLETE   register unsigned char *p; */
86
/* OBSOLETE   register char *d; */
87
/* OBSOLETE  */
88
/* OBSOLETE   read_memory (memaddr, buffer, MAXLEN); */
89
/* OBSOLETE  */
90
/* OBSOLETE   for (i = 0; i < NOPCODES; i++) */
91
/* OBSOLETE     if (votstrs[i].detail.code == buffer[0] */
92
/* OBSOLETE     || votstrs[i].detail.code == *(unsigned short *) buffer) */
93
/* OBSOLETE       break; */
94
/* OBSOLETE  */
95
/* OBSOLETE   /* Handle undefined instructions.  *x/ */
96
/* OBSOLETE   if (i == NOPCODES) */
97
/* OBSOLETE     { */
98
/* OBSOLETE       fprintf_unfiltered (stream, "0%o", buffer[0]); */
99
/* OBSOLETE       return 1; */
100
/* OBSOLETE     } */
101
/* OBSOLETE  */
102
/* OBSOLETE   fprintf_unfiltered (stream, "%s", votstrs[i].name); */
103
/* OBSOLETE  */
104
/* OBSOLETE   /* Point at first byte of argument data, */
105
/* OBSOLETE      and at descriptor for first argument.  *x/ */
106
/* OBSOLETE   p = buffer + 1 + (votstrs[i].detail.code >= 0x100); */
107
/* OBSOLETE   d = votstrs[i].detail.args; */
108
/* OBSOLETE  */
109
/* OBSOLETE   if (*d) */
110
/* OBSOLETE     fputc_unfiltered ('\t', stream); */
111
/* OBSOLETE  */
112
/* OBSOLETE   while (*d) */
113
/* OBSOLETE     { */
114
/* OBSOLETE       p = print_insn_arg (d, p, memaddr + (p - buffer), stream); */
115
/* OBSOLETE       d += 2; */
116
/* OBSOLETE       if (*d) */
117
/* OBSOLETE     fprintf_unfiltered (stream, ","); */
118
/* OBSOLETE     } */
119
/* OBSOLETE   return p - buffer; */
120
/* OBSOLETE } */
121
/* OBSOLETE /*******************************************************************x/ */
122
/* OBSOLETE static unsigned char * */
123
/* OBSOLETE print_insn_arg (d, p, addr, stream) */
124
/* OBSOLETE      char *d; */
125
/* OBSOLETE      register char *p; */
126
/* OBSOLETE      CORE_ADDR addr; */
127
/* OBSOLETE      struct ui_file *stream; */
128
/* OBSOLETE { */
129
/* OBSOLETE   int temp1 = 0; */
130
/* OBSOLETE   register int regnum = *p & 0xf; */
131
/* OBSOLETE   float floatlitbuf; */
132
/* OBSOLETE  */
133
/* OBSOLETE   if (*d == 'b') */
134
/* OBSOLETE     { */
135
/* OBSOLETE       if (d[1] == 'b') */
136
/* OBSOLETE     fprintf_unfiltered (stream, "0x%x", addr + *p++ + 1); */
137
/* OBSOLETE       else */
138
/* OBSOLETE     { */
139
/* OBSOLETE  */
140
/* OBSOLETE       temp1 = *p; */
141
/* OBSOLETE       temp1 <<= 8; */
142
/* OBSOLETE       temp1 |= *(p + 1); */
143
/* OBSOLETE       fprintf_unfiltered (stream, "0x%x", addr + temp1 + 2); */
144
/* OBSOLETE       p += 2; */
145
/* OBSOLETE     } */
146
/* OBSOLETE     } */
147
/* OBSOLETE   else */
148
/* OBSOLETE     switch ((*p++ >> 4) & 0xf) */
149
/* OBSOLETE       { */
150
/* OBSOLETE       case 0: */
151
/* OBSOLETE       case 1: */
152
/* OBSOLETE       case 2: */
153
/* OBSOLETE       case 3:                       /* Literal (short immediate byte) mode *x/ */
154
/* OBSOLETE     if (d[1] == 'd' || d[1] == 'f' || d[1] == 'g' || d[1] == 'h') */
155
/* OBSOLETE       { */
156
/* OBSOLETE         *(int *) &floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4); */
157
/* OBSOLETE         fprintf_unfiltered (stream, "$%f", floatlitbuf); */
158
/* OBSOLETE       } */
159
/* OBSOLETE     else */
160
/* OBSOLETE       fprintf_unfiltered (stream, "$%d", p[-1] & 0x3f); */
161
/* OBSOLETE     break; */
162
/* OBSOLETE  */
163
/* OBSOLETE       case 4:                       /* Indexed *x/ */
164
/* OBSOLETE     p = (char *) print_insn_arg (d, p, addr + 1, stream); */
165
/* OBSOLETE     fprintf_unfiltered (stream, "[%s]", REGISTER_NAME (regnum)); */
166
/* OBSOLETE     break; */
167
/* OBSOLETE  */
168
/* OBSOLETE       case 5:                       /* Register *x/ */
169
/* OBSOLETE     fprintf_unfiltered (stream, REGISTER_NAME (regnum)); */
170
/* OBSOLETE     break; */
171
/* OBSOLETE  */
172
/* OBSOLETE       case 7:                       /* Autodecrement *x/ */
173
/* OBSOLETE     fputc_unfiltered ('-', stream); */
174
/* OBSOLETE       case 6:                       /* Register deferred *x/ */
175
/* OBSOLETE     fprintf_unfiltered (stream, "(%s)", REGISTER_NAME (regnum)); */
176
/* OBSOLETE     break; */
177
/* OBSOLETE  */
178
/* OBSOLETE       case 9:                       /* Absolute Address & Autoincrement deferred *x/ */
179
/* OBSOLETE     fputc_unfiltered ('*', stream); */
180
/* OBSOLETE     if (regnum == PC_REGNUM) */
181
/* OBSOLETE       { */
182
/* OBSOLETE         temp1 = *p; */
183
/* OBSOLETE         temp1 <<= 8; */
184
/* OBSOLETE         temp1 |= *(p + 1); */
185
/* OBSOLETE  */
186
/* OBSOLETE         fputc_unfiltered ('$', stream); */
187
/* OBSOLETE         print_address (temp1, stream); */
188
/* OBSOLETE         p += 4; */
189
/* OBSOLETE         break; */
190
/* OBSOLETE       } */
191
/* OBSOLETE       case 8:                       /*Immediate & Autoincrement SP *x/ */
192
/* OBSOLETE     if (regnum == 8)        /*88 is Immediate Byte Mode *x/ */
193
/* OBSOLETE       fprintf_unfiltered (stream, "$%d", *p++); */
194
/* OBSOLETE  */
195
/* OBSOLETE     else if (regnum == 9)   /*89 is Immediate Word Mode *x/ */
196
/* OBSOLETE       { */
197
/* OBSOLETE         temp1 = *p; */
198
/* OBSOLETE         temp1 <<= 8; */
199
/* OBSOLETE         temp1 |= *(p + 1); */
200
/* OBSOLETE         fprintf_unfiltered (stream, "$%d", temp1); */
201
/* OBSOLETE         p += 2; */
202
/* OBSOLETE       } */
203
/* OBSOLETE  */
204
/* OBSOLETE     else if (regnum == PC_REGNUM)   /*8F is Immediate Long Mode *x/ */
205
/* OBSOLETE       { */
206
/* OBSOLETE         temp1 = *p; */
207
/* OBSOLETE         temp1 <<= 8; */
208
/* OBSOLETE         temp1 |= *(p + 1); */
209
/* OBSOLETE         temp1 <<= 8; */
210
/* OBSOLETE         temp1 |= *(p + 2); */
211
/* OBSOLETE         temp1 <<= 8; */
212
/* OBSOLETE         temp1 |= *(p + 3); */
213
/* OBSOLETE         fprintf_unfiltered (stream, "$%d", temp1); */
214
/* OBSOLETE         p += 4; */
215
/* OBSOLETE       } */
216
/* OBSOLETE  */
217
/* OBSOLETE     else                    /*8E is Autoincrement SP Mode *x/ */
218
/* OBSOLETE       fprintf_unfiltered (stream, "(%s)+", REGISTER_NAME (regnum)); */
219
/* OBSOLETE     break; */
220
/* OBSOLETE  */
221
/* OBSOLETE       case 11:                      /* Register + Byte Displacement Deferred Mode *x/ */
222
/* OBSOLETE     fputc_unfiltered ('*', stream); */
223
/* OBSOLETE       case 10:                      /* Register + Byte Displacement Mode *x/ */
224
/* OBSOLETE     if (regnum == PC_REGNUM) */
225
/* OBSOLETE       print_address (addr + *p + 2, stream); */
226
/* OBSOLETE     else */
227
/* OBSOLETE       fprintf_unfiltered (stream, "%d(%s)", *p, REGISTER_NAME (regnum)); */
228
/* OBSOLETE     p += 1; */
229
/* OBSOLETE     break; */
230
/* OBSOLETE  */
231
/* OBSOLETE       case 13:                      /* Register + Word Displacement Deferred Mode *x/ */
232
/* OBSOLETE     fputc_unfiltered ('*', stream); */
233
/* OBSOLETE       case 12:                      /* Register + Word Displacement Mode *x/ */
234
/* OBSOLETE     temp1 = *p; */
235
/* OBSOLETE     temp1 <<= 8; */
236
/* OBSOLETE     temp1 |= *(p + 1); */
237
/* OBSOLETE     if (regnum == PC_REGNUM) */
238
/* OBSOLETE       print_address (addr + temp1 + 3, stream); */
239
/* OBSOLETE     else */
240
/* OBSOLETE       fprintf_unfiltered (stream, "%d(%s)", temp1, REGISTER_NAME (regnum)); */
241
/* OBSOLETE     p += 2; */
242
/* OBSOLETE     break; */
243
/* OBSOLETE  */
244
/* OBSOLETE       case 15:                      /* Register + Long Displacement Deferred Mode *x/ */
245
/* OBSOLETE     fputc_unfiltered ('*', stream); */
246
/* OBSOLETE       case 14:                      /* Register + Long Displacement Mode *x/ */
247
/* OBSOLETE     temp1 = *p; */
248
/* OBSOLETE     temp1 <<= 8; */
249
/* OBSOLETE     temp1 |= *(p + 1); */
250
/* OBSOLETE     temp1 <<= 8; */
251
/* OBSOLETE     temp1 |= *(p + 2); */
252
/* OBSOLETE     temp1 <<= 8; */
253
/* OBSOLETE     temp1 |= *(p + 3); */
254
/* OBSOLETE     if (regnum == PC_REGNUM) */
255
/* OBSOLETE       print_address (addr + temp1 + 5, stream); */
256
/* OBSOLETE     else */
257
/* OBSOLETE       fprintf_unfiltered (stream, "%d(%s)", temp1, REGISTER_NAME (regnum)); */
258
/* OBSOLETE     p += 4; */
259
/* OBSOLETE       } */
260
/* OBSOLETE  */
261
/* OBSOLETE   return (unsigned char *) p; */
262
/* OBSOLETE } */

powered by: WebSVN 2.1.0

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