]>
Commit | Line | Data |
---|---|---|
fd2299bd AC |
1 | // OBSOLETE /* Target-dependent code for Hitachi H8/500, for GDB. |
2 | // OBSOLETE | |
3 | // OBSOLETE Copyright 1993, 1994, 1995, 1998, 2000, 2001, 2002 Free Software | |
4 | // OBSOLETE Foundation, Inc. | |
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. */ | |
22 | // OBSOLETE | |
23 | // OBSOLETE /* | |
24 | // OBSOLETE Contributed by Steve Chamberlain | |
25 | // OBSOLETE [email protected] | |
26 | // OBSOLETE */ | |
27 | // OBSOLETE | |
28 | // OBSOLETE #include "defs.h" | |
29 | // OBSOLETE #include "frame.h" | |
30 | // OBSOLETE #include "symtab.h" | |
31 | // OBSOLETE #include "gdbtypes.h" | |
32 | // OBSOLETE #include "gdbcmd.h" | |
33 | // OBSOLETE #include "value.h" | |
34 | // OBSOLETE #include "dis-asm.h" | |
35 | // OBSOLETE #include "gdbcore.h" | |
36 | // OBSOLETE #include "regcache.h" | |
37 | // OBSOLETE | |
38 | // OBSOLETE #define UNSIGNED_SHORT(X) ((X) & 0xffff) | |
39 | // OBSOLETE | |
40 | // OBSOLETE static int code_size = 2; | |
41 | // OBSOLETE | |
42 | // OBSOLETE static int data_size = 2; | |
43 | // OBSOLETE | |
44 | // OBSOLETE /* Shape of an H8/500 frame : | |
45 | // OBSOLETE | |
46 | // OBSOLETE arg-n | |
47 | // OBSOLETE .. | |
48 | // OBSOLETE arg-2 | |
49 | // OBSOLETE arg-1 | |
50 | // OBSOLETE return address <2 or 4 bytes> | |
51 | // OBSOLETE old fp <2 bytes> | |
52 | // OBSOLETE auto-n | |
53 | // OBSOLETE .. | |
54 | // OBSOLETE auto-1 | |
55 | // OBSOLETE saved registers | |
56 | // OBSOLETE | |
57 | // OBSOLETE */ | |
58 | // OBSOLETE | |
59 | // OBSOLETE /* an easy to debug H8 stack frame looks like: | |
60 | // OBSOLETE 0x6df6 push r6 | |
61 | // OBSOLETE 0x0d76 mov.w r7,r6 | |
62 | // OBSOLETE 0x6dfn push reg | |
63 | // OBSOLETE 0x7905 nnnn mov.w #n,r5 or 0x1b87 subs #2,sp | |
64 | // OBSOLETE 0x1957 sub.w r5,sp | |
65 | // OBSOLETE | |
66 | // OBSOLETE */ | |
67 | // OBSOLETE | |
68 | // OBSOLETE #define IS_PUSH(x) (((x) & 0xff00)==0x6d00) | |
69 | // OBSOLETE #define IS_LINK_8(x) ((x) == 0x17) | |
70 | // OBSOLETE #define IS_LINK_16(x) ((x) == 0x1f) | |
71 | // OBSOLETE #define IS_MOVE_FP(x) ((x) == 0x0d76) | |
72 | // OBSOLETE #define IS_MOV_SP_FP(x) ((x) == 0x0d76) | |
73 | // OBSOLETE #define IS_SUB2_SP(x) ((x) == 0x1b87) | |
74 | // OBSOLETE #define IS_MOVK_R5(x) ((x) == 0x7905) | |
75 | // OBSOLETE #define IS_SUB_R5SP(x) ((x) == 0x1957) | |
76 | // OBSOLETE | |
77 | // OBSOLETE #define LINK_8 0x17 | |
78 | // OBSOLETE #define LINK_16 0x1f | |
79 | // OBSOLETE | |
80 | // OBSOLETE int minimum_mode = 1; | |
81 | // OBSOLETE | |
82 | // OBSOLETE CORE_ADDR | |
83 | // OBSOLETE h8500_skip_prologue (CORE_ADDR start_pc) | |
84 | // OBSOLETE { | |
85 | // OBSOLETE short int w; | |
86 | // OBSOLETE | |
87 | // OBSOLETE w = read_memory_integer (start_pc, 1); | |
88 | // OBSOLETE if (w == LINK_8) | |
89 | // OBSOLETE { | |
90 | // OBSOLETE start_pc += 2; | |
91 | // OBSOLETE w = read_memory_integer (start_pc, 1); | |
92 | // OBSOLETE } | |
93 | // OBSOLETE | |
94 | // OBSOLETE if (w == LINK_16) | |
95 | // OBSOLETE { | |
96 | // OBSOLETE start_pc += 3; | |
97 | // OBSOLETE w = read_memory_integer (start_pc, 2); | |
98 | // OBSOLETE } | |
99 | // OBSOLETE | |
100 | // OBSOLETE return start_pc; | |
101 | // OBSOLETE } | |
102 | // OBSOLETE | |
103 | // OBSOLETE CORE_ADDR | |
104 | // OBSOLETE h8500_addr_bits_remove (CORE_ADDR addr) | |
105 | // OBSOLETE { | |
106 | // OBSOLETE return ((addr) & 0xffffff); | |
107 | // OBSOLETE } | |
108 | // OBSOLETE | |
109 | // OBSOLETE /* Given a GDB frame, determine the address of the calling function's | |
110 | // OBSOLETE frame. This will be used to create a new GDB frame struct, and | |
111 | // OBSOLETE then INIT_EXTRA_FRAME_INFO and DEPRECATED_INIT_FRAME_PC will be | |
112 | // OBSOLETE called for the new frame. | |
113 | // OBSOLETE | |
114 | // OBSOLETE For us, the frame address is its stack pointer value, so we look up | |
115 | // OBSOLETE the function prologue to determine the caller's sp value, and return it. */ | |
116 | // OBSOLETE | |
117 | // OBSOLETE CORE_ADDR | |
118 | // OBSOLETE h8500_frame_chain (struct frame_info *thisframe) | |
119 | // OBSOLETE { | |
120 | // OBSOLETE if (!inside_entry_file (thisframe->pc)) | |
121 | // OBSOLETE return (read_memory_integer (get_frame_base (thisframe), PTR_SIZE)); | |
122 | // OBSOLETE else | |
123 | // OBSOLETE return 0; | |
124 | // OBSOLETE } | |
125 | // OBSOLETE | |
126 | // OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or | |
127 | // OBSOLETE is not the address of a valid instruction, the address of the next | |
128 | // OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word | |
129 | // OBSOLETE of the instruction. */ | |
130 | // OBSOLETE | |
131 | // OBSOLETE CORE_ADDR | |
132 | // OBSOLETE NEXT_PROLOGUE_INSN (CORE_ADDR addr, CORE_ADDR lim, char *pword1) | |
133 | // OBSOLETE { | |
134 | // OBSOLETE if (addr < lim + 8) | |
135 | // OBSOLETE { | |
136 | // OBSOLETE read_memory (addr, pword1, 1); | |
137 | // OBSOLETE read_memory (addr, pword1 + 1, 1); | |
138 | // OBSOLETE return 1; | |
139 | // OBSOLETE } | |
140 | // OBSOLETE return 0; | |
141 | // OBSOLETE } | |
142 | // OBSOLETE | |
143 | // OBSOLETE /* Examine the prologue of a function. `ip' points to the first | |
144 | // OBSOLETE instruction. `limit' is the limit of the prologue (e.g. the addr | |
145 | // OBSOLETE of the first linenumber, or perhaps the program counter if we're | |
146 | // OBSOLETE stepping through). `frame_sp' is the stack pointer value in use in | |
147 | // OBSOLETE this frame. `fsr' is a pointer to a frame_saved_regs structure | |
148 | // OBSOLETE into which we put info about the registers saved by this frame. | |
149 | // OBSOLETE `fi' is a struct frame_info pointer; we fill in various fields in | |
150 | // OBSOLETE it to reflect the offsets of the arg pointer and the locals | |
151 | // OBSOLETE pointer. */ | |
152 | // OBSOLETE | |
153 | // OBSOLETE /* Return the saved PC from this frame. */ | |
154 | // OBSOLETE | |
155 | // OBSOLETE CORE_ADDR | |
156 | // OBSOLETE frame_saved_pc (struct frame_info *frame) | |
157 | // OBSOLETE { | |
158 | // OBSOLETE return read_memory_integer (get_frame_base (frame) + 2, PTR_SIZE); | |
159 | // OBSOLETE } | |
160 | // OBSOLETE | |
161 | // OBSOLETE void | |
162 | // OBSOLETE h8500_pop_frame (void) | |
163 | // OBSOLETE { | |
164 | // OBSOLETE unsigned regnum; | |
165 | // OBSOLETE struct frame_saved_regs fsr; | |
166 | // OBSOLETE struct frame_info *frame = get_current_frame (); | |
167 | // OBSOLETE | |
168 | // OBSOLETE deprecated_get_frame_saved_regs (frame, &fsr); | |
169 | // OBSOLETE | |
170 | // OBSOLETE for (regnum = 0; regnum < 8; regnum++) | |
171 | // OBSOLETE { | |
172 | // OBSOLETE if (fsr.regs[regnum]) | |
173 | // OBSOLETE write_register (regnum, read_memory_short (fsr.regs[regnum])); | |
174 | // OBSOLETE | |
175 | // OBSOLETE flush_cached_frames (); | |
176 | // OBSOLETE } | |
177 | // OBSOLETE } | |
178 | // OBSOLETE | |
179 | // OBSOLETE static void | |
180 | // OBSOLETE h8500_print_register_hook (int regno) | |
181 | // OBSOLETE { | |
182 | // OBSOLETE if (regno == CCR_REGNUM) | |
183 | // OBSOLETE { | |
184 | // OBSOLETE /* CCR register */ | |
185 | // OBSOLETE | |
186 | // OBSOLETE int C, Z, N, V; | |
187 | // OBSOLETE unsigned char b[2]; | |
188 | // OBSOLETE unsigned char l; | |
189 | // OBSOLETE | |
190 | // OBSOLETE frame_register_read (deprecated_selected_frame, regno, b); | |
191 | // OBSOLETE l = b[1]; | |
192 | // OBSOLETE printf_unfiltered ("\t"); | |
193 | // OBSOLETE printf_unfiltered ("I-%d - ", (l & 0x80) != 0); | |
194 | // OBSOLETE N = (l & 0x8) != 0; | |
195 | // OBSOLETE Z = (l & 0x4) != 0; | |
196 | // OBSOLETE V = (l & 0x2) != 0; | |
197 | // OBSOLETE C = (l & 0x1) != 0; | |
198 | // OBSOLETE printf_unfiltered ("N-%d ", N); | |
199 | // OBSOLETE printf_unfiltered ("Z-%d ", Z); | |
200 | // OBSOLETE printf_unfiltered ("V-%d ", V); | |
201 | // OBSOLETE printf_unfiltered ("C-%d ", C); | |
202 | // OBSOLETE if ((C | Z) == 0) | |
203 | // OBSOLETE printf_unfiltered ("u> "); | |
204 | // OBSOLETE if ((C | Z) == 1) | |
205 | // OBSOLETE printf_unfiltered ("u<= "); | |
206 | // OBSOLETE if ((C == 0)) | |
207 | // OBSOLETE printf_unfiltered ("u>= "); | |
208 | // OBSOLETE if (C == 1) | |
209 | // OBSOLETE printf_unfiltered ("u< "); | |
210 | // OBSOLETE if (Z == 0) | |
211 | // OBSOLETE printf_unfiltered ("!= "); | |
212 | // OBSOLETE if (Z == 1) | |
213 | // OBSOLETE printf_unfiltered ("== "); | |
214 | // OBSOLETE if ((N ^ V) == 0) | |
215 | // OBSOLETE printf_unfiltered (">= "); | |
216 | // OBSOLETE if ((N ^ V) == 1) | |
217 | // OBSOLETE printf_unfiltered ("< "); | |
218 | // OBSOLETE if ((Z | (N ^ V)) == 0) | |
219 | // OBSOLETE printf_unfiltered ("> "); | |
220 | // OBSOLETE if ((Z | (N ^ V)) == 1) | |
221 | // OBSOLETE printf_unfiltered ("<= "); | |
222 | // OBSOLETE } | |
223 | // OBSOLETE } | |
224 | // OBSOLETE | |
225 | // OBSOLETE static void | |
226 | // OBSOLETE h8500_print_registers_info (struct gdbarch *gdbarch, | |
227 | // OBSOLETE struct ui_file *file, | |
228 | // OBSOLETE struct frame_info *frame, | |
229 | // OBSOLETE int regnum, int print_all) | |
230 | // OBSOLETE { | |
231 | // OBSOLETE int i; | |
232 | // OBSOLETE const int numregs = NUM_REGS + NUM_PSEUDO_REGS; | |
233 | // OBSOLETE char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); | |
234 | // OBSOLETE char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); | |
235 | // OBSOLETE | |
236 | // OBSOLETE for (i = 0; i < numregs; i++) | |
237 | // OBSOLETE { | |
238 | // OBSOLETE /* Decide between printing all regs, non-float / vector regs, or | |
239 | // OBSOLETE specific reg. */ | |
240 | // OBSOLETE if (regnum == -1) | |
241 | // OBSOLETE { | |
242 | // OBSOLETE if (!print_all) | |
243 | // OBSOLETE { | |
244 | // OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) | |
245 | // OBSOLETE continue; | |
246 | // OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i))) | |
247 | // OBSOLETE continue; | |
248 | // OBSOLETE } | |
249 | // OBSOLETE } | |
250 | // OBSOLETE else | |
251 | // OBSOLETE { | |
252 | // OBSOLETE if (i != regnum) | |
253 | // OBSOLETE continue; | |
254 | // OBSOLETE } | |
255 | // OBSOLETE | |
256 | // OBSOLETE /* If the register name is empty, it is undefined for this | |
257 | // OBSOLETE processor, so don't display anything. */ | |
258 | // OBSOLETE if (REGISTER_NAME (i) == NULL || *(REGISTER_NAME (i)) == '\0') | |
259 | // OBSOLETE continue; | |
260 | // OBSOLETE | |
261 | // OBSOLETE fputs_filtered (REGISTER_NAME (i), file); | |
262 | // OBSOLETE print_spaces_filtered (15 - strlen (REGISTER_NAME (i)), file); | |
263 | // OBSOLETE | |
264 | // OBSOLETE /* Get the data in raw format. */ | |
265 | // OBSOLETE if (! frame_register_read (frame, i, raw_buffer)) | |
266 | // OBSOLETE { | |
267 | // OBSOLETE fprintf_filtered (file, "*value not available*\n"); | |
268 | // OBSOLETE continue; | |
269 | // OBSOLETE } | |
270 | // OBSOLETE | |
271 | // OBSOLETE /* FIXME: cagney/2002-08-03: This code shouldn't be necessary. | |
272 | // OBSOLETE The function frame_register_read() should have returned the | |
273 | // OBSOLETE pre-cooked register so no conversion is necessary. */ | |
274 | // OBSOLETE /* Convert raw data to virtual format if necessary. */ | |
275 | // OBSOLETE if (REGISTER_CONVERTIBLE (i)) | |
276 | // OBSOLETE { | |
277 | // OBSOLETE REGISTER_CONVERT_TO_VIRTUAL (i, REGISTER_VIRTUAL_TYPE (i), | |
278 | // OBSOLETE raw_buffer, virtual_buffer); | |
279 | // OBSOLETE } | |
280 | // OBSOLETE else | |
281 | // OBSOLETE { | |
282 | // OBSOLETE memcpy (virtual_buffer, raw_buffer, | |
283 | // OBSOLETE REGISTER_VIRTUAL_SIZE (i)); | |
284 | // OBSOLETE } | |
285 | // OBSOLETE | |
286 | // OBSOLETE /* If virtual format is floating, print it that way, and in raw | |
287 | // OBSOLETE hex. */ | |
288 | // OBSOLETE if (TYPE_CODE (REGISTER_VIRTUAL_TYPE (i)) == TYPE_CODE_FLT) | |
289 | // OBSOLETE { | |
290 | // OBSOLETE int j; | |
291 | // OBSOLETE | |
292 | // OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, | |
293 | // OBSOLETE file, 0, 1, 0, Val_pretty_default); | |
294 | // OBSOLETE | |
295 | // OBSOLETE fprintf_filtered (file, "\t(raw 0x"); | |
296 | // OBSOLETE for (j = 0; j < REGISTER_RAW_SIZE (i); j++) | |
297 | // OBSOLETE { | |
298 | // OBSOLETE int idx; | |
299 | // OBSOLETE if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG) | |
300 | // OBSOLETE idx = j; | |
301 | // OBSOLETE else | |
302 | // OBSOLETE idx = REGISTER_RAW_SIZE (i) - 1 - j; | |
303 | // OBSOLETE fprintf_filtered (file, "%02x", (unsigned char) raw_buffer[idx]); | |
304 | // OBSOLETE } | |
305 | // OBSOLETE fprintf_filtered (file, ")"); | |
306 | // OBSOLETE } | |
307 | // OBSOLETE else | |
308 | // OBSOLETE { | |
309 | // OBSOLETE /* Print the register in hex. */ | |
310 | // OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, | |
311 | // OBSOLETE file, 'x', 1, 0, Val_pretty_default); | |
312 | // OBSOLETE /* If not a vector register, print it also according to its | |
313 | // OBSOLETE natural format. */ | |
314 | // OBSOLETE if (TYPE_VECTOR (REGISTER_VIRTUAL_TYPE (i)) == 0) | |
315 | // OBSOLETE { | |
316 | // OBSOLETE fprintf_filtered (file, "\t"); | |
317 | // OBSOLETE val_print (REGISTER_VIRTUAL_TYPE (i), virtual_buffer, 0, 0, | |
318 | // OBSOLETE file, 0, 1, 0, Val_pretty_default); | |
319 | // OBSOLETE } | |
320 | // OBSOLETE } | |
321 | // OBSOLETE | |
322 | // OBSOLETE /* Some h8500 specific info. */ | |
323 | // OBSOLETE h8500_print_register_hook (i); | |
324 | // OBSOLETE | |
325 | // OBSOLETE fprintf_filtered (file, "\n"); | |
326 | // OBSOLETE } | |
327 | // OBSOLETE } | |
328 | // OBSOLETE | |
329 | // OBSOLETE void | |
330 | // OBSOLETE h8500_do_registers_info (int regnum, int all) | |
331 | // OBSOLETE { | |
332 | // OBSOLETE h8500_print_registers_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, | |
333 | // OBSOLETE regnum, all); | |
334 | // OBSOLETE } | |
335 | // OBSOLETE | |
336 | // OBSOLETE int | |
337 | // OBSOLETE h8500_register_size (int regno) | |
338 | // OBSOLETE { | |
339 | // OBSOLETE switch (regno) | |
340 | // OBSOLETE { | |
341 | // OBSOLETE case SEG_C_REGNUM: | |
342 | // OBSOLETE case SEG_D_REGNUM: | |
343 | // OBSOLETE case SEG_E_REGNUM: | |
344 | // OBSOLETE case SEG_T_REGNUM: | |
345 | // OBSOLETE return 1; | |
346 | // OBSOLETE case R0_REGNUM: | |
347 | // OBSOLETE case R1_REGNUM: | |
348 | // OBSOLETE case R2_REGNUM: | |
349 | // OBSOLETE case R3_REGNUM: | |
350 | // OBSOLETE case R4_REGNUM: | |
351 | // OBSOLETE case R5_REGNUM: | |
352 | // OBSOLETE case R6_REGNUM: | |
353 | // OBSOLETE case R7_REGNUM: | |
354 | // OBSOLETE case CCR_REGNUM: | |
355 | // OBSOLETE return 2; | |
356 | // OBSOLETE | |
357 | // OBSOLETE case PR0_REGNUM: | |
358 | // OBSOLETE case PR1_REGNUM: | |
359 | // OBSOLETE case PR2_REGNUM: | |
360 | // OBSOLETE case PR3_REGNUM: | |
361 | // OBSOLETE case PR4_REGNUM: | |
362 | // OBSOLETE case PR5_REGNUM: | |
363 | // OBSOLETE case PR6_REGNUM: | |
364 | // OBSOLETE case PR7_REGNUM: | |
365 | // OBSOLETE case PC_REGNUM: | |
366 | // OBSOLETE return 4; | |
367 | // OBSOLETE default: | |
368 | // OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); | |
369 | // OBSOLETE } | |
370 | // OBSOLETE } | |
371 | // OBSOLETE | |
372 | // OBSOLETE struct type * | |
373 | // OBSOLETE h8500_register_virtual_type (int regno) | |
374 | // OBSOLETE { | |
375 | // OBSOLETE switch (regno) | |
376 | // OBSOLETE { | |
377 | // OBSOLETE case SEG_C_REGNUM: | |
378 | // OBSOLETE case SEG_E_REGNUM: | |
379 | // OBSOLETE case SEG_D_REGNUM: | |
380 | // OBSOLETE case SEG_T_REGNUM: | |
381 | // OBSOLETE return builtin_type_unsigned_char; | |
382 | // OBSOLETE case R0_REGNUM: | |
383 | // OBSOLETE case R1_REGNUM: | |
384 | // OBSOLETE case R2_REGNUM: | |
385 | // OBSOLETE case R3_REGNUM: | |
386 | // OBSOLETE case R4_REGNUM: | |
387 | // OBSOLETE case R5_REGNUM: | |
388 | // OBSOLETE case R6_REGNUM: | |
389 | // OBSOLETE case R7_REGNUM: | |
390 | // OBSOLETE case CCR_REGNUM: | |
391 | // OBSOLETE return builtin_type_unsigned_short; | |
392 | // OBSOLETE case PR0_REGNUM: | |
393 | // OBSOLETE case PR1_REGNUM: | |
394 | // OBSOLETE case PR2_REGNUM: | |
395 | // OBSOLETE case PR3_REGNUM: | |
396 | // OBSOLETE case PR4_REGNUM: | |
397 | // OBSOLETE case PR5_REGNUM: | |
398 | // OBSOLETE case PR6_REGNUM: | |
399 | // OBSOLETE case PR7_REGNUM: | |
400 | // OBSOLETE case PC_REGNUM: | |
401 | // OBSOLETE return builtin_type_unsigned_long; | |
402 | // OBSOLETE default: | |
403 | // OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); | |
404 | // OBSOLETE } | |
405 | // OBSOLETE } | |
406 | // OBSOLETE | |
407 | // OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, | |
408 | // OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. | |
409 | // OBSOLETE This includes special registers such as pc and fp saved in special | |
410 | // OBSOLETE ways in the stack frame. sp is even more special: | |
411 | // OBSOLETE the address we return for it IS the sp for the next frame. */ | |
412 | // OBSOLETE | |
413 | // OBSOLETE void | |
414 | // OBSOLETE frame_find_saved_regs (struct frame_info *frame_info, | |
415 | // OBSOLETE struct frame_saved_regs *frame_saved_regs) | |
416 | // OBSOLETE { | |
417 | // OBSOLETE register int regnum; | |
418 | // OBSOLETE register int regmask; | |
419 | // OBSOLETE register CORE_ADDR next_addr; | |
420 | // OBSOLETE register CORE_ADDR pc; | |
421 | // OBSOLETE unsigned char thebyte; | |
422 | // OBSOLETE | |
423 | // OBSOLETE memset (frame_saved_regs, '\0', sizeof *frame_saved_regs); | |
424 | // OBSOLETE | |
425 | // OBSOLETE if ((frame_info)->pc >= (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4 | |
426 | // OBSOLETE && (frame_info)->pc <= (frame_info)->frame) | |
427 | // OBSOLETE { | |
428 | // OBSOLETE next_addr = (frame_info)->frame; | |
429 | // OBSOLETE pc = (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM * 4 - 4; | |
430 | // OBSOLETE } | |
431 | // OBSOLETE else | |
432 | // OBSOLETE { | |
433 | // OBSOLETE pc = get_pc_function_start ((frame_info)->pc); | |
434 | // OBSOLETE /* Verify we have a link a6 instruction next; | |
435 | // OBSOLETE if not we lose. If we win, find the address above the saved | |
436 | // OBSOLETE regs using the amount of storage from the link instruction. | |
437 | // OBSOLETE */ | |
438 | // OBSOLETE | |
439 | // OBSOLETE thebyte = read_memory_integer (pc, 1); | |
440 | // OBSOLETE if (0x1f == thebyte) | |
441 | // OBSOLETE next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 2), pc += 2; | |
442 | // OBSOLETE else if (0x17 == thebyte) | |
443 | // OBSOLETE next_addr = (frame_info)->frame + read_memory_integer (pc += 1, 1), pc += 1; | |
444 | // OBSOLETE else | |
445 | // OBSOLETE goto lose; | |
446 | // OBSOLETE #if 0 | |
447 | // OBSOLETE /* FIXME steve */ | |
448 | // OBSOLETE /* If have an add:g.waddal #-n, sp next, adjust next_addr. */ | |
449 | // OBSOLETE if ((0x0c0177777 & read_memory_integer (pc, 2)) == 0157774) | |
450 | // OBSOLETE next_addr += read_memory_integer (pc += 2, 4), pc += 4; | |
451 | // OBSOLETE #endif | |
452 | // OBSOLETE } | |
453 | // OBSOLETE | |
454 | // OBSOLETE thebyte = read_memory_integer (pc, 1); | |
455 | // OBSOLETE if (thebyte == 0x12) | |
456 | // OBSOLETE { | |
457 | // OBSOLETE /* Got stm */ | |
458 | // OBSOLETE pc++; | |
459 | // OBSOLETE regmask = read_memory_integer (pc, 1); | |
460 | // OBSOLETE pc++; | |
461 | // OBSOLETE for (regnum = 0; regnum < 8; regnum++, regmask >>= 1) | |
462 | // OBSOLETE { | |
463 | // OBSOLETE if (regmask & 1) | |
464 | // OBSOLETE { | |
465 | // OBSOLETE (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2; | |
466 | // OBSOLETE } | |
467 | // OBSOLETE } | |
468 | // OBSOLETE thebyte = read_memory_integer (pc, 1); | |
469 | // OBSOLETE } | |
470 | // OBSOLETE /* Maybe got a load of pushes */ | |
471 | // OBSOLETE while (thebyte == 0xbf) | |
472 | // OBSOLETE { | |
473 | // OBSOLETE pc++; | |
474 | // OBSOLETE regnum = read_memory_integer (pc, 1) & 0x7; | |
475 | // OBSOLETE pc++; | |
476 | // OBSOLETE (frame_saved_regs)->regs[regnum] = (next_addr += 2) - 2; | |
477 | // OBSOLETE thebyte = read_memory_integer (pc, 1); | |
478 | // OBSOLETE } | |
479 | // OBSOLETE | |
480 | // OBSOLETE lose:; | |
481 | // OBSOLETE | |
482 | // OBSOLETE /* Remember the address of the frame pointer */ | |
483 | // OBSOLETE (frame_saved_regs)->regs[FP_REGNUM] = (frame_info)->frame; | |
484 | // OBSOLETE | |
485 | // OBSOLETE /* This is where the old sp is hidden */ | |
486 | // OBSOLETE (frame_saved_regs)->regs[SP_REGNUM] = (frame_info)->frame; | |
487 | // OBSOLETE | |
488 | // OBSOLETE /* And the PC - remember the pushed FP is always two bytes long */ | |
489 | // OBSOLETE (frame_saved_regs)->regs[PC_REGNUM] = (frame_info)->frame + 2; | |
490 | // OBSOLETE } | |
491 | // OBSOLETE | |
492 | // OBSOLETE CORE_ADDR | |
493 | // OBSOLETE saved_pc_after_call (void) | |
494 | // OBSOLETE { | |
495 | // OBSOLETE int x; | |
496 | // OBSOLETE int a = read_register (SP_REGNUM); | |
497 | // OBSOLETE | |
498 | // OBSOLETE x = read_memory_integer (a, code_size); | |
499 | // OBSOLETE if (code_size == 2) | |
500 | // OBSOLETE { | |
501 | // OBSOLETE /* Stick current code segement onto top */ | |
502 | // OBSOLETE x &= 0xffff; | |
503 | // OBSOLETE x |= read_register (SEG_C_REGNUM) << 16; | |
504 | // OBSOLETE } | |
505 | // OBSOLETE x &= 0xffffff; | |
506 | // OBSOLETE return x; | |
507 | // OBSOLETE } | |
508 | // OBSOLETE | |
509 | // OBSOLETE void | |
510 | // OBSOLETE h8500_set_pointer_size (int newsize) | |
511 | // OBSOLETE { | |
512 | // OBSOLETE static int oldsize = 0; | |
513 | // OBSOLETE | |
514 | // OBSOLETE if (oldsize != newsize) | |
515 | // OBSOLETE { | |
516 | // OBSOLETE printf_unfiltered ("pointer size set to %d bits\n", newsize); | |
517 | // OBSOLETE oldsize = newsize; | |
518 | // OBSOLETE if (newsize == 32) | |
519 | // OBSOLETE { | |
520 | // OBSOLETE minimum_mode = 0; | |
521 | // OBSOLETE } | |
522 | // OBSOLETE else | |
523 | // OBSOLETE { | |
524 | // OBSOLETE minimum_mode = 1; | |
525 | // OBSOLETE } | |
526 | // OBSOLETE _initialize_gdbtypes (); | |
527 | // OBSOLETE } | |
528 | // OBSOLETE } | |
529 | // OBSOLETE | |
530 | // OBSOLETE static void | |
531 | // OBSOLETE big_command (char *arg, int from_tty) | |
532 | // OBSOLETE { | |
533 | // OBSOLETE h8500_set_pointer_size (32); | |
534 | // OBSOLETE code_size = 4; | |
535 | // OBSOLETE data_size = 4; | |
536 | // OBSOLETE } | |
537 | // OBSOLETE | |
538 | // OBSOLETE static void | |
539 | // OBSOLETE medium_command (char *arg, int from_tty) | |
540 | // OBSOLETE { | |
541 | // OBSOLETE h8500_set_pointer_size (32); | |
542 | // OBSOLETE code_size = 4; | |
543 | // OBSOLETE data_size = 2; | |
544 | // OBSOLETE } | |
545 | // OBSOLETE | |
546 | // OBSOLETE static void | |
547 | // OBSOLETE compact_command (char *arg, int from_tty) | |
548 | // OBSOLETE { | |
549 | // OBSOLETE h8500_set_pointer_size (32); | |
550 | // OBSOLETE code_size = 2; | |
551 | // OBSOLETE data_size = 4; | |
552 | // OBSOLETE } | |
553 | // OBSOLETE | |
554 | // OBSOLETE static void | |
555 | // OBSOLETE small_command (char *arg, int from_tty) | |
556 | // OBSOLETE { | |
557 | // OBSOLETE h8500_set_pointer_size (16); | |
558 | // OBSOLETE code_size = 2; | |
559 | // OBSOLETE data_size = 2; | |
560 | // OBSOLETE } | |
561 | // OBSOLETE | |
562 | // OBSOLETE static struct cmd_list_element *setmemorylist; | |
563 | // OBSOLETE | |
564 | // OBSOLETE static void | |
565 | // OBSOLETE set_memory (char *args, int from_tty) | |
566 | // OBSOLETE { | |
567 | // OBSOLETE printf_unfiltered ("\"set memory\" must be followed by the name of a memory subcommand.\n"); | |
568 | // OBSOLETE help_list (setmemorylist, "set memory ", -1, gdb_stdout); | |
569 | // OBSOLETE } | |
570 | // OBSOLETE | |
571 | // OBSOLETE /* See if variable name is ppc or pr[0-7] */ | |
572 | // OBSOLETE | |
573 | // OBSOLETE int | |
574 | // OBSOLETE h8500_is_trapped_internalvar (char *name) | |
575 | // OBSOLETE { | |
576 | // OBSOLETE if (name[0] != 'p') | |
577 | // OBSOLETE return 0; | |
578 | // OBSOLETE | |
579 | // OBSOLETE if (strcmp (name + 1, "pc") == 0) | |
580 | // OBSOLETE return 1; | |
581 | // OBSOLETE | |
582 | // OBSOLETE if (name[1] == 'r' | |
583 | // OBSOLETE && name[2] >= '0' | |
584 | // OBSOLETE && name[2] <= '7' | |
585 | // OBSOLETE && name[3] == '\000') | |
586 | // OBSOLETE return 1; | |
587 | // OBSOLETE else | |
588 | // OBSOLETE return 0; | |
589 | // OBSOLETE } | |
590 | // OBSOLETE | |
591 | // OBSOLETE struct value * | |
592 | // OBSOLETE h8500_value_of_trapped_internalvar (struct internalvar *var) | |
593 | // OBSOLETE { | |
594 | // OBSOLETE LONGEST regval; | |
595 | // OBSOLETE unsigned char regbuf[4]; | |
596 | // OBSOLETE int page_regnum, regnum; | |
597 | // OBSOLETE | |
598 | // OBSOLETE regnum = var->name[2] == 'c' ? PC_REGNUM : var->name[2] - '0'; | |
599 | // OBSOLETE | |
600 | // OBSOLETE switch (var->name[2]) | |
601 | // OBSOLETE { | |
602 | // OBSOLETE case 'c': | |
603 | // OBSOLETE page_regnum = SEG_C_REGNUM; | |
604 | // OBSOLETE break; | |
605 | // OBSOLETE case '0': | |
606 | // OBSOLETE case '1': | |
607 | // OBSOLETE case '2': | |
608 | // OBSOLETE case '3': | |
609 | // OBSOLETE page_regnum = SEG_D_REGNUM; | |
610 | // OBSOLETE break; | |
611 | // OBSOLETE case '4': | |
612 | // OBSOLETE case '5': | |
613 | // OBSOLETE page_regnum = SEG_E_REGNUM; | |
614 | // OBSOLETE break; | |
615 | // OBSOLETE case '6': | |
616 | // OBSOLETE case '7': | |
617 | // OBSOLETE page_regnum = SEG_T_REGNUM; | |
618 | // OBSOLETE break; | |
619 | // OBSOLETE } | |
620 | // OBSOLETE | |
621 | // OBSOLETE get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, page_regnum, NULL); | |
622 | // OBSOLETE regval = regbuf[0] << 16; | |
623 | // OBSOLETE | |
624 | // OBSOLETE get_saved_register (regbuf, NULL, NULL, deprecated_selected_frame, regnum, NULL); | |
625 | // OBSOLETE regval |= regbuf[0] << 8 | regbuf[1]; /* XXX host/target byte order */ | |
626 | // OBSOLETE | |
627 | // OBSOLETE xfree (var->value); /* Free up old value */ | |
628 | // OBSOLETE | |
629 | // OBSOLETE var->value = value_from_longest (builtin_type_unsigned_long, regval); | |
630 | // OBSOLETE release_value (var->value); /* Unchain new value */ | |
631 | // OBSOLETE | |
632 | // OBSOLETE VALUE_LVAL (var->value) = lval_internalvar; | |
633 | // OBSOLETE VALUE_INTERNALVAR (var->value) = var; | |
634 | // OBSOLETE return var->value; | |
635 | // OBSOLETE } | |
636 | // OBSOLETE | |
637 | // OBSOLETE void | |
638 | // OBSOLETE h8500_set_trapped_internalvar (struct internalvar *var, struct value *newval, | |
639 | // OBSOLETE int bitpos, int bitsize, int offset) | |
640 | // OBSOLETE { | |
641 | // OBSOLETE char *page_regnum, *regnum; | |
642 | // OBSOLETE char expression[100]; | |
643 | // OBSOLETE unsigned new_regval; | |
644 | // OBSOLETE struct type *type; | |
645 | // OBSOLETE enum type_code newval_type_code; | |
646 | // OBSOLETE | |
647 | // OBSOLETE type = check_typedef (VALUE_TYPE (newval)); | |
648 | // OBSOLETE newval_type_code = TYPE_CODE (type); | |
649 | // OBSOLETE | |
650 | // OBSOLETE if ((newval_type_code != TYPE_CODE_INT | |
651 | // OBSOLETE && newval_type_code != TYPE_CODE_PTR) | |
652 | // OBSOLETE || TYPE_LENGTH (type) != sizeof (new_regval)) | |
653 | // OBSOLETE error ("Illegal type (%s) for assignment to $%s\n", | |
654 | // OBSOLETE TYPE_NAME (VALUE_TYPE (newval)), var->name); | |
655 | // OBSOLETE | |
656 | // OBSOLETE new_regval = *(long *) VALUE_CONTENTS_RAW (newval); | |
657 | // OBSOLETE | |
658 | // OBSOLETE regnum = var->name + 1; | |
659 | // OBSOLETE | |
660 | // OBSOLETE switch (var->name[2]) | |
661 | // OBSOLETE { | |
662 | // OBSOLETE case 'c': | |
663 | // OBSOLETE page_regnum = "cp"; | |
664 | // OBSOLETE break; | |
665 | // OBSOLETE case '0': | |
666 | // OBSOLETE case '1': | |
667 | // OBSOLETE case '2': | |
668 | // OBSOLETE case '3': | |
669 | // OBSOLETE page_regnum = "dp"; | |
670 | // OBSOLETE break; | |
671 | // OBSOLETE case '4': | |
672 | // OBSOLETE case '5': | |
673 | // OBSOLETE page_regnum = "ep"; | |
674 | // OBSOLETE break; | |
675 | // OBSOLETE case '6': | |
676 | // OBSOLETE case '7': | |
677 | // OBSOLETE page_regnum = "tp"; | |
678 | // OBSOLETE break; | |
679 | // OBSOLETE } | |
680 | // OBSOLETE | |
681 | // OBSOLETE sprintf (expression, "$%s=%d", page_regnum, new_regval >> 16); | |
682 | // OBSOLETE parse_and_eval (expression); | |
683 | // OBSOLETE | |
684 | // OBSOLETE sprintf (expression, "$%s=%d", regnum, new_regval & 0xffff); | |
685 | // OBSOLETE parse_and_eval (expression); | |
686 | // OBSOLETE } | |
687 | // OBSOLETE | |
688 | // OBSOLETE CORE_ADDR | |
689 | // OBSOLETE h8500_read_sp (void) | |
690 | // OBSOLETE { | |
691 | // OBSOLETE return read_register (PR7_REGNUM); | |
692 | // OBSOLETE } | |
693 | // OBSOLETE | |
694 | // OBSOLETE void | |
695 | // OBSOLETE h8500_write_sp (CORE_ADDR v) | |
696 | // OBSOLETE { | |
697 | // OBSOLETE write_register (PR7_REGNUM, v); | |
698 | // OBSOLETE } | |
699 | // OBSOLETE | |
700 | // OBSOLETE CORE_ADDR | |
701 | // OBSOLETE h8500_read_pc (ptid_t ptid) | |
702 | // OBSOLETE { | |
703 | // OBSOLETE return read_register (PC_REGNUM); | |
704 | // OBSOLETE } | |
705 | // OBSOLETE | |
706 | // OBSOLETE void | |
707 | // OBSOLETE h8500_write_pc (CORE_ADDR v, ptid_t ptid) | |
708 | // OBSOLETE { | |
709 | // OBSOLETE write_register (PC_REGNUM, v); | |
710 | // OBSOLETE } | |
711 | // OBSOLETE | |
712 | // OBSOLETE CORE_ADDR | |
713 | // OBSOLETE h8500_read_fp (void) | |
714 | // OBSOLETE { | |
715 | // OBSOLETE return read_register (PR6_REGNUM); | |
716 | // OBSOLETE } | |
717 | // OBSOLETE | |
718 | // OBSOLETE void | |
719 | // OBSOLETE _initialize_h8500_tdep (void) | |
720 | // OBSOLETE { | |
721 | // OBSOLETE tm_print_insn = print_insn_h8500; | |
722 | // OBSOLETE | |
723 | // OBSOLETE add_prefix_cmd ("memory", no_class, set_memory, | |
724 | // OBSOLETE "set the memory model", &setmemorylist, "set memory ", 0, | |
725 | // OBSOLETE &setlist); | |
726 | // OBSOLETE | |
727 | // OBSOLETE add_cmd ("small", class_support, small_command, | |
728 | // OBSOLETE "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist); | |
729 | // OBSOLETE | |
730 | // OBSOLETE add_cmd ("big", class_support, big_command, | |
731 | // OBSOLETE "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist); | |
732 | // OBSOLETE | |
733 | // OBSOLETE add_cmd ("medium", class_support, medium_command, | |
734 | // OBSOLETE "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist); | |
735 | // OBSOLETE | |
736 | // OBSOLETE add_cmd ("compact", class_support, compact_command, | |
737 | // OBSOLETE "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist); | |
738 | // OBSOLETE | |
739 | // OBSOLETE } |