1 |
578 |
markom |
/* OBSOLETE /* Target-machine dependent code for WDC-65816, for GDB. */
|
2 |
|
|
/* OBSOLETE Copyright 1995, 1996, 2000, 2001 Free Software Foundation, Inc. */
|
3 |
|
|
/* OBSOLETE */
|
4 |
|
|
/* OBSOLETE This file is part of GDB. */
|
5 |
|
|
/* OBSOLETE */
|
6 |
|
|
/* OBSOLETE This program is free software; you can redistribute it and/or modify */
|
7 |
|
|
/* OBSOLETE it under the terms of the GNU General Public License as published by */
|
8 |
|
|
/* OBSOLETE the Free Software Foundation; either version 2 of the License, or */
|
9 |
|
|
/* OBSOLETE (at your option) any later version. */
|
10 |
|
|
/* OBSOLETE */
|
11 |
|
|
/* OBSOLETE This program is distributed in the hope that it will be useful, */
|
12 |
|
|
/* OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
13 |
|
|
/* OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
14 |
|
|
/* OBSOLETE GNU General Public License for more details. */
|
15 |
|
|
/* OBSOLETE */
|
16 |
|
|
/* OBSOLETE You should have received a copy of the GNU General Public License */
|
17 |
|
|
/* OBSOLETE along with this program; if not, write to the Free Software */
|
18 |
|
|
/* OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, */
|
19 |
|
|
/* OBSOLETE Boston, MA 02111-1307, USA. */ */
|
20 |
|
|
/* OBSOLETE */
|
21 |
|
|
/* OBSOLETE /* */
|
22 |
|
|
/* OBSOLETE Contributed by Steve Chamberlain */
|
23 |
|
|
/* OBSOLETE sac@cygnus.com */
|
24 |
|
|
/* OBSOLETE */ */
|
25 |
|
|
/* OBSOLETE */
|
26 |
|
|
/* OBSOLETE #include "defs.h" */
|
27 |
|
|
/* OBSOLETE #include "frame.h" */
|
28 |
|
|
/* OBSOLETE #include "obstack.h" */
|
29 |
|
|
/* OBSOLETE #include "symtab.h" */
|
30 |
|
|
/* OBSOLETE #include "gdbcmd.h" */
|
31 |
|
|
/* OBSOLETE #include "gdbtypes.h" */
|
32 |
|
|
/* OBSOLETE #include "dis-asm.h" */
|
33 |
|
|
/* OBSOLETE #include "gdbcore.h" */
|
34 |
|
|
/* OBSOLETE #include "regcache.h" */
|
35 |
|
|
/* OBSOLETE */
|
36 |
|
|
/* OBSOLETE /* Return the saved PC from this frame. */ */
|
37 |
|
|
/* OBSOLETE */
|
38 |
|
|
/* OBSOLETE */
|
39 |
|
|
/* OBSOLETE CORE_ADDR */
|
40 |
|
|
/* OBSOLETE w65_frame_saved_pc (struct frame_info *frame) */
|
41 |
|
|
/* OBSOLETE { */
|
42 |
|
|
/* OBSOLETE return (read_memory_integer (frame->frame + 2, 4) & 0xffffff); */
|
43 |
|
|
/* OBSOLETE } */
|
44 |
|
|
/* OBSOLETE */
|
45 |
|
|
/* OBSOLETE CORE_ADDR */
|
46 |
|
|
/* OBSOLETE w65_addr_bits_remove (CORE_ADDR addr) */
|
47 |
|
|
/* OBSOLETE { */
|
48 |
|
|
/* OBSOLETE return ((addr) & 0xffffff); */
|
49 |
|
|
/* OBSOLETE } */
|
50 |
|
|
/* OBSOLETE */
|
51 |
|
|
/* OBSOLETE read_memory_pointer (CORE_ADDR x) */
|
52 |
|
|
/* OBSOLETE { */
|
53 |
|
|
/* OBSOLETE return read_memory_integer (ADDR_BITS_REMOVE (x), 4); */
|
54 |
|
|
/* OBSOLETE } */
|
55 |
|
|
/* OBSOLETE */
|
56 |
|
|
/* OBSOLETE init_frame_pc (void) */
|
57 |
|
|
/* OBSOLETE { */
|
58 |
|
|
/* OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); */
|
59 |
|
|
/* OBSOLETE } */
|
60 |
|
|
/* OBSOLETE */
|
61 |
|
|
/* OBSOLETE void */
|
62 |
|
|
/* OBSOLETE w65_push_dummy_frame (void) */
|
63 |
|
|
/* OBSOLETE { */
|
64 |
|
|
/* OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); */
|
65 |
|
|
/* OBSOLETE } */
|
66 |
|
|
/* OBSOLETE */
|
67 |
|
|
/* OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, */
|
68 |
|
|
/* OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. */
|
69 |
|
|
/* OBSOLETE This includes special registers such as pc and fp saved in special */
|
70 |
|
|
/* OBSOLETE ways in the stack frame. sp is even more special: */
|
71 |
|
|
/* OBSOLETE the address we return for it IS the sp for the next frame. */
|
72 |
|
|
/* OBSOLETE */
|
73 |
|
|
/* OBSOLETE We cache the result of doing this in the frame_cache_obstack, since */
|
74 |
|
|
/* OBSOLETE it is fairly expensive. */ */
|
75 |
|
|
/* OBSOLETE */
|
76 |
|
|
/* OBSOLETE void */
|
77 |
|
|
/* OBSOLETE frame_find_saved_regs (struct frame_info *fip, struct frame_saved_regs *fsrp) */
|
78 |
|
|
/* OBSOLETE { */
|
79 |
|
|
/* OBSOLETE int locals; */
|
80 |
|
|
/* OBSOLETE CORE_ADDR pc; */
|
81 |
|
|
/* OBSOLETE CORE_ADDR adr; */
|
82 |
|
|
/* OBSOLETE int i; */
|
83 |
|
|
/* OBSOLETE */
|
84 |
|
|
/* OBSOLETE memset (fsrp, 0, sizeof *fsrp); */
|
85 |
|
|
/* OBSOLETE } */
|
86 |
|
|
/* OBSOLETE */
|
87 |
|
|
/* OBSOLETE int */
|
88 |
|
|
/* OBSOLETE saved_pc_after_call (void) */
|
89 |
|
|
/* OBSOLETE { */
|
90 |
|
|
/* OBSOLETE int sp = read_register (SP_REGNUM); */
|
91 |
|
|
/* OBSOLETE int val = read_memory_integer (sp + 1, 4); */
|
92 |
|
|
/* OBSOLETE return ADDR_BITS_REMOVE (val); */
|
93 |
|
|
/* OBSOLETE } */
|
94 |
|
|
/* OBSOLETE */
|
95 |
|
|
/* OBSOLETE */
|
96 |
|
|
/* OBSOLETE extract_return_value (struct type *type, char *regbuf, char *valbuf) */
|
97 |
|
|
/* OBSOLETE { */
|
98 |
|
|
/* OBSOLETE int b; */
|
99 |
|
|
/* OBSOLETE int len = TYPE_LENGTH (type); */
|
100 |
|
|
/* OBSOLETE */
|
101 |
|
|
/* OBSOLETE for (b = 0; b < len; b += 2) */
|
102 |
|
|
/* OBSOLETE { */
|
103 |
|
|
/* OBSOLETE int todo = len - b; */
|
104 |
|
|
/* OBSOLETE if (todo > 2) */
|
105 |
|
|
/* OBSOLETE todo = 2; */
|
106 |
|
|
/* OBSOLETE memcpy (valbuf + b, regbuf + b, todo); */
|
107 |
|
|
/* OBSOLETE } */
|
108 |
|
|
/* OBSOLETE } */
|
109 |
|
|
/* OBSOLETE */
|
110 |
|
|
/* OBSOLETE void */
|
111 |
|
|
/* OBSOLETE write_return_value (struct type *type, char *valbuf) */
|
112 |
|
|
/* OBSOLETE { */
|
113 |
|
|
/* OBSOLETE int reg; */
|
114 |
|
|
/* OBSOLETE int len; */
|
115 |
|
|
/* OBSOLETE for (len = 0; len < TYPE_LENGTH (type); len += 2) */
|
116 |
|
|
/* OBSOLETE { */
|
117 |
|
|
/* OBSOLETE write_register_bytes (REGISTER_BYTE (len / 2 + 2), valbuf + len, 2); */
|
118 |
|
|
/* OBSOLETE } */
|
119 |
|
|
/* OBSOLETE } */
|
120 |
|
|
/* OBSOLETE */
|
121 |
|
|
/* OBSOLETE void */
|
122 |
|
|
/* OBSOLETE store_struct_return (CORE_ADDR addr, CORE_ADDR sp) */
|
123 |
|
|
/* OBSOLETE { */
|
124 |
|
|
/* OBSOLETE write_register (2, addr); */
|
125 |
|
|
/* OBSOLETE } */
|
126 |
|
|
/* OBSOLETE */
|
127 |
|
|
/* OBSOLETE void */
|
128 |
|
|
/* OBSOLETE w65_pop_frame (void) */
|
129 |
|
|
/* OBSOLETE { */
|
130 |
|
|
/* OBSOLETE } */
|
131 |
|
|
/* OBSOLETE */
|
132 |
|
|
/* OBSOLETE init_extra_frame_info (void) */
|
133 |
|
|
/* OBSOLETE { */
|
134 |
|
|
/* OBSOLETE } */
|
135 |
|
|
/* OBSOLETE */
|
136 |
|
|
/* OBSOLETE pop_frame (void) */
|
137 |
|
|
/* OBSOLETE { */
|
138 |
|
|
/* OBSOLETE } */
|
139 |
|
|
/* OBSOLETE */
|
140 |
|
|
/* OBSOLETE w65_frame_chain (struct frame_info *thisframe) */
|
141 |
|
|
/* OBSOLETE { */
|
142 |
|
|
/* OBSOLETE return 0xffff & read_memory_integer ((thisframe)->frame, 2); */
|
143 |
|
|
/* OBSOLETE } */
|
144 |
|
|
/* OBSOLETE */
|
145 |
|
|
/* OBSOLETE static int */
|
146 |
|
|
/* OBSOLETE gb (int x) */
|
147 |
|
|
/* OBSOLETE { */
|
148 |
|
|
/* OBSOLETE return read_memory_integer (x, 1) & 0xff; */
|
149 |
|
|
/* OBSOLETE } */
|
150 |
|
|
/* OBSOLETE */
|
151 |
|
|
/* OBSOLETE extern CORE_ADDR */
|
152 |
|
|
/* OBSOLETE w65_skip_prologue (CORE_ADDR pc) */
|
153 |
|
|
/* OBSOLETE { */
|
154 |
|
|
/* OBSOLETE CORE_ADDR too_far = pc + 20; */
|
155 |
|
|
/* OBSOLETE */
|
156 |
|
|
/* OBSOLETE /* looking for bits of the prologue, we can expect to */
|
157 |
|
|
/* OBSOLETE see this in a frameful function: */
|
158 |
|
|
/* OBSOLETE */
|
159 |
|
|
/* OBSOLETE stack adjust: */
|
160 |
|
|
/* OBSOLETE */
|
161 |
|
|
/* OBSOLETE 3B tsc */
|
162 |
|
|
/* OBSOLETE 1A inc a */
|
163 |
|
|
/* OBSOLETE 18 clc */
|
164 |
|
|
/* OBSOLETE 69E2FF adc #0xffe2 */
|
165 |
|
|
/* OBSOLETE 3A dec a */
|
166 |
|
|
/* OBSOLETE 1B tcs */
|
167 |
|
|
/* OBSOLETE 1A inc a */
|
168 |
|
|
/* OBSOLETE */
|
169 |
|
|
/* OBSOLETE link: */
|
170 |
|
|
/* OBSOLETE */
|
171 |
|
|
/* OBSOLETE A500 lda <r15 */
|
172 |
|
|
/* OBSOLETE 48 pha */
|
173 |
|
|
/* OBSOLETE 3B tsc */
|
174 |
|
|
/* OBSOLETE 1a inc a */
|
175 |
|
|
/* OBSOLETE 8500 sta <r15 */
|
176 |
|
|
/* OBSOLETE */
|
177 |
|
|
/* OBSOLETE */ */
|
178 |
|
|
/* OBSOLETE */
|
179 |
|
|
/* OBSOLETE #define TSC 0x3b */
|
180 |
|
|
/* OBSOLETE #define TCS 0x1b */
|
181 |
|
|
/* OBSOLETE #define INCA 0x1a */
|
182 |
|
|
/* OBSOLETE #define PHA 0x48 */
|
183 |
|
|
/* OBSOLETE #define LDADIR 0xa5 */
|
184 |
|
|
/* OBSOLETE #define STADIR 0x85 */
|
185 |
|
|
/* OBSOLETE */
|
186 |
|
|
/* OBSOLETE /* Skip a stack adjust - any area between a tsc and tcs */ */
|
187 |
|
|
/* OBSOLETE if (gb (pc) == TSC) */
|
188 |
|
|
/* OBSOLETE { */
|
189 |
|
|
/* OBSOLETE while (pc < too_far && gb (pc) != TCS) */
|
190 |
|
|
/* OBSOLETE { */
|
191 |
|
|
/* OBSOLETE pc++; */
|
192 |
|
|
/* OBSOLETE } */
|
193 |
|
|
/* OBSOLETE pc++; */
|
194 |
|
|
/* OBSOLETE /* Skip a stupid inc a */ */
|
195 |
|
|
/* OBSOLETE if (gb (pc) == INCA) */
|
196 |
|
|
/* OBSOLETE pc++; */
|
197 |
|
|
/* OBSOLETE */
|
198 |
|
|
/* OBSOLETE } */
|
199 |
|
|
/* OBSOLETE /* Stack adjust can also be done with n pha's */ */
|
200 |
|
|
/* OBSOLETE while (gb (pc) == PHA) */
|
201 |
|
|
/* OBSOLETE pc++; */
|
202 |
|
|
/* OBSOLETE */
|
203 |
|
|
/* OBSOLETE /* Skip a link - that's a ld/ph/tsc/inc/sta */ */
|
204 |
|
|
/* OBSOLETE */
|
205 |
|
|
/* OBSOLETE if (gb (pc) == LDADIR */
|
206 |
|
|
/* OBSOLETE && gb (pc + 5) == STADIR */
|
207 |
|
|
/* OBSOLETE && gb (pc + 1) == gb (pc + 6) */
|
208 |
|
|
/* OBSOLETE && gb (pc + 2) == PHA */
|
209 |
|
|
/* OBSOLETE && gb (pc + 3) == TSC */
|
210 |
|
|
/* OBSOLETE && gb (pc + 4) == INCA) */
|
211 |
|
|
/* OBSOLETE { */
|
212 |
|
|
/* OBSOLETE pc += 7; */
|
213 |
|
|
/* OBSOLETE } */
|
214 |
|
|
/* OBSOLETE */
|
215 |
|
|
/* OBSOLETE return pc; */
|
216 |
|
|
/* OBSOLETE } */
|
217 |
|
|
/* OBSOLETE */
|
218 |
|
|
/* OBSOLETE */
|
219 |
|
|
/* OBSOLETE register_raw_size (int n) */
|
220 |
|
|
/* OBSOLETE { */
|
221 |
|
|
/* OBSOLETE return sim_reg_size (n); */
|
222 |
|
|
/* OBSOLETE } */
|
223 |
|
|
/* OBSOLETE */
|
224 |
|
|
/* OBSOLETE */
|
225 |
|
|
/* OBSOLETE void */
|
226 |
|
|
/* OBSOLETE print_register_hook (int regno) */
|
227 |
|
|
/* OBSOLETE { */
|
228 |
|
|
/* OBSOLETE if (regno == P_REGNUM) */
|
229 |
|
|
/* OBSOLETE { */
|
230 |
|
|
/* OBSOLETE /* CCR register */ */
|
231 |
|
|
/* OBSOLETE */
|
232 |
|
|
/* OBSOLETE int C, Z, N, V, I, D, X, M; */
|
233 |
|
|
/* OBSOLETE unsigned char b[1]; */
|
234 |
|
|
/* OBSOLETE unsigned char l; */
|
235 |
|
|
/* OBSOLETE */
|
236 |
|
|
/* OBSOLETE read_relative_register_raw_bytes (regno, b); */
|
237 |
|
|
/* OBSOLETE l = b[0]; */
|
238 |
|
|
/* OBSOLETE printf_unfiltered ("\t"); */
|
239 |
|
|
/* OBSOLETE C = (l & 0x1) != 0; */
|
240 |
|
|
/* OBSOLETE Z = (l & 0x2) != 0; */
|
241 |
|
|
/* OBSOLETE I = (l & 0x4) != 0; */
|
242 |
|
|
/* OBSOLETE D = (l & 0x8) != 0; */
|
243 |
|
|
/* OBSOLETE X = (l & 0x10) != 0; */
|
244 |
|
|
/* OBSOLETE M = (l & 0x20) != 0; */
|
245 |
|
|
/* OBSOLETE V = (l & 0x40) != 0; */
|
246 |
|
|
/* OBSOLETE N = (l & 0x80) != 0; */
|
247 |
|
|
/* OBSOLETE */
|
248 |
|
|
/* OBSOLETE printf_unfiltered ("N-%d ", N); */
|
249 |
|
|
/* OBSOLETE printf_unfiltered ("V-%d ", V); */
|
250 |
|
|
/* OBSOLETE printf_unfiltered ("M-%d ", M); */
|
251 |
|
|
/* OBSOLETE printf_unfiltered ("X-%d ", X); */
|
252 |
|
|
/* OBSOLETE printf_unfiltered ("D-%d ", D); */
|
253 |
|
|
/* OBSOLETE printf_unfiltered ("I-%d ", I); */
|
254 |
|
|
/* OBSOLETE printf_unfiltered ("Z-%d ", Z); */
|
255 |
|
|
/* OBSOLETE printf_unfiltered ("C-%d ", C); */
|
256 |
|
|
/* OBSOLETE if ((C | Z) == 0) */
|
257 |
|
|
/* OBSOLETE printf_unfiltered ("u> "); */
|
258 |
|
|
/* OBSOLETE if ((C | Z) == 1) */
|
259 |
|
|
/* OBSOLETE printf_unfiltered ("u<= "); */
|
260 |
|
|
/* OBSOLETE if ((C == 0)) */
|
261 |
|
|
/* OBSOLETE printf_unfiltered ("u>= "); */
|
262 |
|
|
/* OBSOLETE if (C == 1) */
|
263 |
|
|
/* OBSOLETE printf_unfiltered ("u< "); */
|
264 |
|
|
/* OBSOLETE if (Z == 0) */
|
265 |
|
|
/* OBSOLETE printf_unfiltered ("!= "); */
|
266 |
|
|
/* OBSOLETE if (Z == 1) */
|
267 |
|
|
/* OBSOLETE printf_unfiltered ("== "); */
|
268 |
|
|
/* OBSOLETE if ((N ^ V) == 0) */
|
269 |
|
|
/* OBSOLETE printf_unfiltered (">= "); */
|
270 |
|
|
/* OBSOLETE if ((N ^ V) == 1) */
|
271 |
|
|
/* OBSOLETE printf_unfiltered ("< "); */
|
272 |
|
|
/* OBSOLETE if ((Z | (N ^ V)) == 0) */
|
273 |
|
|
/* OBSOLETE printf_unfiltered ("> "); */
|
274 |
|
|
/* OBSOLETE if ((Z | (N ^ V)) == 1) */
|
275 |
|
|
/* OBSOLETE printf_unfiltered ("<= "); */
|
276 |
|
|
/* OBSOLETE } */
|
277 |
|
|
/* OBSOLETE } */
|
278 |
|
|
/* OBSOLETE */
|
279 |
|
|
/* OBSOLETE void */
|
280 |
|
|
/* OBSOLETE _initialize_w65_tdep (void) */
|
281 |
|
|
/* OBSOLETE { */
|
282 |
|
|
/* OBSOLETE tm_print_insn = print_insn_w65; */
|
283 |
|
|
/* OBSOLETE } */
|