1 /* Target-machine dependent code for WDC-65816, for GDB.
2 Copyright 1995, 1996, 2000, 2001 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
22 Contributed by Steve Chamberlain
36 /* Return the saved PC from this frame. */
40 w65_frame_saved_pc (struct frame_info
*frame
)
42 return (read_memory_integer (frame
->frame
+ 2, 4) & 0xffffff);
46 w65_addr_bits_remove (CORE_ADDR addr
)
48 return ((addr
) & 0xffffff);
51 read_memory_pointer (CORE_ADDR x
)
53 return read_memory_integer (ADDR_BITS_REMOVE (x
), 4);
58 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");
62 w65_push_dummy_frame (void)
64 internal_error (__FILE__
, __LINE__
, "failed internal consistency check");
67 /* Put here the code to store, into a struct frame_saved_regs,
68 the addresses of the saved registers of frame described by FRAME_INFO.
69 This includes special registers such as pc and fp saved in special
70 ways in the stack frame. sp is even more special:
71 the address we return for it IS the sp for the next frame.
73 We cache the result of doing this in the frame_cache_obstack, since
74 it is fairly expensive. */
77 frame_find_saved_regs (struct frame_info
*fip
, struct frame_saved_regs
*fsrp
)
84 memset (fsrp
, 0, sizeof *fsrp
);
88 saved_pc_after_call (void)
90 int sp
= read_register (SP_REGNUM
);
91 int val
= read_memory_integer (sp
+ 1, 4);
92 return ADDR_BITS_REMOVE (val
);
96 extract_return_value (struct type
*type
, char *regbuf
, char *valbuf
)
99 int len
= TYPE_LENGTH (type
);
101 for (b
= 0; b
< len
; b
+= 2)
106 memcpy (valbuf
+ b
, regbuf
+ b
, todo
);
111 write_return_value (struct type
*type
, char *valbuf
)
115 for (len
= 0; len
< TYPE_LENGTH (type
); len
+= 2)
117 write_register_bytes (REGISTER_BYTE (len
/ 2 + 2), valbuf
+ len
, 2);
122 store_struct_return (CORE_ADDR addr
, CORE_ADDR sp
)
124 write_register (2, addr
);
132 init_extra_frame_info (void)
140 w65_frame_chain (struct frame_info
*thisframe
)
142 return 0xffff & read_memory_integer ((thisframe
)->frame
, 2);
148 return read_memory_integer (x
, 1) & 0xff;
152 w65_skip_prologue (CORE_ADDR pc
)
154 CORE_ADDR too_far
= pc
+ 20;
156 /* looking for bits of the prologue, we can expect to
157 see this in a frameful function:
186 /* Skip a stack adjust - any area between a tsc and tcs */
189 while (pc
< too_far
&& gb (pc
) != TCS
)
194 /* Skip a stupid inc a */
199 /* Stack adjust can also be done with n pha's */
200 while (gb (pc
) == PHA
)
203 /* Skip a link - that's a ld/ph/tsc/inc/sta */
205 if (gb (pc
) == LDADIR
206 && gb (pc
+ 5) == STADIR
207 && gb (pc
+ 1) == gb (pc
+ 6)
208 && gb (pc
+ 2) == PHA
209 && gb (pc
+ 3) == TSC
210 && gb (pc
+ 4) == INCA
)
219 register_raw_size (int n
)
221 return sim_reg_size (n
);
226 print_register_hook (int regno
)
228 if (regno
== P_REGNUM
)
232 int C
, Z
, N
, V
, I
, D
, X
, M
;
236 read_relative_register_raw_bytes (regno
, b
);
238 printf_unfiltered ("\t");
248 printf_unfiltered ("N-%d ", N
);
249 printf_unfiltered ("V-%d ", V
);
250 printf_unfiltered ("M-%d ", M
);
251 printf_unfiltered ("X-%d ", X
);
252 printf_unfiltered ("D-%d ", D
);
253 printf_unfiltered ("I-%d ", I
);
254 printf_unfiltered ("Z-%d ", Z
);
255 printf_unfiltered ("C-%d ", C
);
257 printf_unfiltered ("u> ");
259 printf_unfiltered ("u<= ");
261 printf_unfiltered ("u>= ");
263 printf_unfiltered ("u< ");
265 printf_unfiltered ("!= ");
267 printf_unfiltered ("== ");
269 printf_unfiltered (">= ");
271 printf_unfiltered ("< ");
272 if ((Z
| (N
^ V
)) == 0)
273 printf_unfiltered ("> ");
274 if ((Z
| (N
^ V
)) == 1)
275 printf_unfiltered ("<= ");
280 _initialize_w65_tdep (void)
282 tm_print_insn
= print_insn_w65
;
This page took 0.035299 seconds and 4 git commands to generate.