1 /* 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. */
6 /* OBSOLETE This file is part of GDB. */
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. */
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. */
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/ */
23 /* OBSOLETE #include "defs.h" */
24 /* OBSOLETE #include "symtab.h" */
25 /* OBSOLETE #include "opcode/tahoe.h" */
27 /* OBSOLETE /* Tahoe instructions are never longer than this. *x/ */
28 /* OBSOLETE #define MAXLEN 62 */
30 /* OBSOLETE /* Number of elements in the opcode table. *x/ */
31 /* OBSOLETE #define NOPCODES (sizeof votstrs / sizeof votstrs[0]) */
33 /* OBSOLETE static unsigned char *print_insn_arg (); */
35 /* OBSOLETE /* Advance PC across any function entry prologue instructions */
36 /* OBSOLETE to reach some "real" code. *x/ */
38 /* OBSOLETE CORE_ADDR */
39 /* OBSOLETE tahoe_skip_prologue (pc) */
40 /* OBSOLETE CORE_ADDR pc; */
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; */
65 /* OBSOLETE /* Return number of args passed to a frame. */
66 /* OBSOLETE Can return -1, meaning no way to tell. *x/ */
69 /* OBSOLETE tahoe_frame_num_args (fi) */
70 /* OBSOLETE struct frame_info *fi; */
72 /* OBSOLETE return (((0xffff & read_memory_integer (((fi)->frame - 4), 4)) - 4) >> 2); */
75 /* OBSOLETE /* Print the Tahoe instruction at address MEMADDR in debugged memory, */
76 /* OBSOLETE on STREAM. Returns length of the instruction, in bytes. *x/ */
79 /* OBSOLETE tahoe_print_insn (memaddr, stream) */
80 /* OBSOLETE CORE_ADDR memaddr; */
81 /* OBSOLETE struct ui_file *stream; */
83 /* OBSOLETE unsigned char buffer[MAXLEN]; */
84 /* OBSOLETE register int i; */
85 /* OBSOLETE register unsigned char *p; */
86 /* OBSOLETE register char *d; */
88 /* OBSOLETE read_memory (memaddr, buffer, MAXLEN); */
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) */
95 /* OBSOLETE /* Handle undefined instructions. *x/ */
96 /* OBSOLETE if (i == NOPCODES) */
98 /* OBSOLETE fprintf_unfiltered (stream, "0%o", buffer[0]); */
99 /* OBSOLETE return 1; */
102 /* OBSOLETE fprintf_unfiltered (stream, "%s", votstrs[i].name); */
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; */
109 /* OBSOLETE if (*d) */
110 /* OBSOLETE fputc_unfiltered ('\t', stream); */
112 /* OBSOLETE while (*d) */
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, ","); */
119 /* OBSOLETE return p - buffer; */
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; */
129 /* OBSOLETE int temp1 = 0; */
130 /* OBSOLETE register int regnum = *p & 0xf; */
131 /* OBSOLETE float floatlitbuf; */
133 /* OBSOLETE if (*d == 'b') */
135 /* OBSOLETE if (d[1] == 'b') */
136 /* OBSOLETE fprintf_unfiltered (stream, "0x%x", addr + *p++ + 1); */
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; */
148 /* OBSOLETE switch ((*p++ >> 4) & 0xf) */
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') */
156 /* OBSOLETE *(int *) &floatlitbuf = 0x4000 + ((p[-1] & 0x3f) << 4); */
157 /* OBSOLETE fprintf_unfiltered (stream, "$%f", floatlitbuf); */
160 /* OBSOLETE fprintf_unfiltered (stream, "$%d", p[-1] & 0x3f); */
161 /* OBSOLETE break; */
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; */
168 /* OBSOLETE case 5: /* Register *x/ */
169 /* OBSOLETE fprintf_unfiltered (stream, REGISTER_NAME (regnum)); */
170 /* OBSOLETE break; */
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; */
178 /* OBSOLETE case 9: /* Absolute Address & Autoincrement deferred *x/ */
179 /* OBSOLETE fputc_unfiltered ('*', stream); */
180 /* OBSOLETE if (regnum == PC_REGNUM) */
182 /* OBSOLETE temp1 = *p; */
183 /* OBSOLETE temp1 <<= 8; */
184 /* OBSOLETE temp1 |= *(p + 1); */
186 /* OBSOLETE fputc_unfiltered ('$', stream); */
187 /* OBSOLETE print_address (temp1, stream); */
188 /* OBSOLETE p += 4; */
189 /* OBSOLETE break; */
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++); */
195 /* OBSOLETE else if (regnum == 9) /*89 is Immediate Word Mode *x/ */
197 /* OBSOLETE temp1 = *p; */
198 /* OBSOLETE temp1 <<= 8; */
199 /* OBSOLETE temp1 |= *(p + 1); */
200 /* OBSOLETE fprintf_unfiltered (stream, "$%d", temp1); */
201 /* OBSOLETE p += 2; */
204 /* OBSOLETE else if (regnum == PC_REGNUM) /*8F is Immediate Long Mode *x/ */
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; */
217 /* OBSOLETE else /*8E is Autoincrement SP Mode *x/ */
218 /* OBSOLETE fprintf_unfiltered (stream, "(%s)+", REGISTER_NAME (regnum)); */
219 /* OBSOLETE break; */
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); */
227 /* OBSOLETE fprintf_unfiltered (stream, "%d(%s)", *p, REGISTER_NAME (regnum)); */
228 /* OBSOLETE p += 1; */
229 /* OBSOLETE break; */
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); */
240 /* OBSOLETE fprintf_unfiltered (stream, "%d(%s)", temp1, REGISTER_NAME (regnum)); */
241 /* OBSOLETE p += 2; */
242 /* OBSOLETE break; */
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); */
257 /* OBSOLETE fprintf_unfiltered (stream, "%d(%s)", temp1, REGISTER_NAME (regnum)); */
258 /* OBSOLETE p += 4; */
261 /* OBSOLETE return (unsigned char *) p; */
This page took 0.034591 seconds and 4 git commands to generate.