1 /* Target-machine dependent code for WDC-65816, for GDB.
2 Copyright (C) 1995 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, Boston, MA 02111-1307, USA. */
21 Contributed by Steve Chamberlain
34 /* Return the saved PC from this frame. */
38 w65_frame_saved_pc (frame
)
39 struct frame_info
*frame
;
41 return (read_memory_integer (frame
->frame
+ 2, 4) & 0xffffff);
51 read_memory_pointer (x
)
54 return read_memory_integer (ADDR_BITS_REMOVE (x
), 4);
63 w65_push_dummy_frame ()
68 /* Put here the code to store, into a struct frame_saved_regs,
69 the addresses of the saved registers of frame described by FRAME_INFO.
70 This includes special registers such as pc and fp saved in special
71 ways in the stack frame. sp is even more special:
72 the address we return for it IS the sp for the next frame.
74 We cache the result of doing this in the frame_cache_obstack, since
75 it is fairly expensive. */
78 frame_find_saved_regs (fip
, fsrp
)
79 struct frame_info
*fip
;
80 struct frame_saved_regs
*fsrp
;
87 memset (fsrp
, 0, sizeof *fsrp
);
91 saved_pc_after_call ()
93 int sp
= read_register (SP_REGNUM
);
94 int val
= read_memory_integer (sp
+ 1, 4);
95 return ADDR_BITS_REMOVE (val
);
99 extract_return_value (type
, regbuf
, valbuf
)
105 int len
= TYPE_LENGTH (type
);
107 for (b
= 0; b
< len
; b
+= 2)
112 memcpy (valbuf
+ b
, regbuf
+ b
, todo
);
117 write_return_value (type
, valbuf
)
123 for (len
= 0; len
< TYPE_LENGTH (type
); len
+= 2)
125 write_register_bytes (REGISTER_BYTE (len
/ 2 + 2), valbuf
+ len
, 2);
130 store_struct_return (addr
, sp
)
134 write_register (2, addr
);
142 init_extra_frame_info ()
150 w65_frame_chain (thisframe
)
151 struct frame_info
*thisframe
;
153 return 0xffff & read_memory_integer ((thisframe
)->frame
, 2);
159 return read_memory_integer (x
, 1) & 0xff;
163 w65_skip_prologue (pc
)
166 CORE_ADDR too_far
= pc
+ 20;
168 /* looking for bits of the prologue, we can expect to
169 see this in a frameful function:
198 /* Skip a stack adjust - any area between a tsc and tcs */
201 while (pc
< too_far
&& gb (pc
) != TCS
)
206 /* Skip a stupid inc a */
211 /* Stack adjust can also be done with n pha's */
212 while (gb (pc
) == PHA
)
215 /* Skip a link - that's a ld/ph/tsc/inc/sta */
217 if (gb (pc
) == LDADIR
218 && gb (pc
+ 5) == STADIR
219 && gb (pc
+ 1) == gb (pc
+ 6)
220 && gb (pc
+ 2) == PHA
221 && gb (pc
+ 3) == TSC
222 && gb (pc
+ 4) == INCA
)
231 register_raw_size (n
)
233 return sim_reg_size (n
);
238 print_register_hook (regno
)
240 if (regno
== P_REGNUM
)
244 int C
, Z
, N
, V
, I
, D
, X
, M
;
248 read_relative_register_raw_bytes (regno
, b
);
250 printf_unfiltered ("\t");
260 printf_unfiltered ("N-%d ", N
);
261 printf_unfiltered ("V-%d ", V
);
262 printf_unfiltered ("M-%d ", M
);
263 printf_unfiltered ("X-%d ", X
);
264 printf_unfiltered ("D-%d ", D
);
265 printf_unfiltered ("I-%d ", I
);
266 printf_unfiltered ("Z-%d ", Z
);
267 printf_unfiltered ("C-%d ", C
);
269 printf_unfiltered ("u> ");
271 printf_unfiltered ("u<= ");
273 printf_unfiltered ("u>= ");
275 printf_unfiltered ("u< ");
277 printf_unfiltered ("!= ");
279 printf_unfiltered ("== ");
281 printf_unfiltered (">= ");
283 printf_unfiltered ("< ");
284 if ((Z
| (N
^ V
)) == 0)
285 printf_unfiltered ("> ");
286 if ((Z
| (N
^ V
)) == 1)
287 printf_unfiltered ("<= ");
292 _initialize_w65_tdep ()
294 tm_print_insn
= print_insn_w65
;
This page took 0.035318 seconds and 4 git commands to generate.