* m68k-tdep.h (struct gdbarch_tdep): Add member
[deliverable/binutils-gdb.git] / gdb / m68k-tdep.c
CommitLineData
748894bf 1/* Target-dependent code for the Motorola 68000 series.
c6f0559b
AC
2
3 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
4 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
c906108c 5
c5aa993b 6 This file is part of GDB.
c906108c 7
c5aa993b
JM
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
c906108c 12
c5aa993b
JM
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
c906108c 17
c5aa993b
JM
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. */
c906108c
SS
22
23#include "defs.h"
3f244638 24#include "dwarf2-frame.h"
c906108c 25#include "frame.h"
8de307e0
AS
26#include "frame-base.h"
27#include "frame-unwind.h"
f595cb19 28#include "floatformat.h"
c906108c
SS
29#include "symtab.h"
30#include "gdbcore.h"
31#include "value.h"
32#include "gdb_string.h"
8de307e0 33#include "gdb_assert.h"
7a292a7a 34#include "inferior.h"
4e052eda 35#include "regcache.h"
5d3ed2e3 36#include "arch-utils.h"
55809acb 37#include "osabi.h"
a89aa300 38#include "dis-asm.h"
32eeb91a
AS
39
40#include "m68k-tdep.h"
c906108c 41\f
c5aa993b 42
89c3b6d3
PDM
43#define P_LINKL_FP 0x480e
44#define P_LINKW_FP 0x4e56
45#define P_PEA_FP 0x4856
8de307e0
AS
46#define P_MOVEAL_SP_FP 0x2c4f
47#define P_ADDAW_SP 0xdefc
48#define P_ADDAL_SP 0xdffc
49#define P_SUBQW_SP 0x514f
50#define P_SUBQL_SP 0x518f
51#define P_LEA_SP_SP 0x4fef
52#define P_LEA_PC_A5 0x4bfb0170
53#define P_FMOVEMX_SP 0xf227
54#define P_MOVEL_SP 0x2f00
55#define P_MOVEML_SP 0x48e7
89c3b6d3 56
103a1597 57
103a1597
GS
58#define REGISTER_BYTES_FP (16*4 + 8 + 8*12 + 3*4)
59#define REGISTER_BYTES_NOFP (16*4 + 8)
60
103a1597 61/* Offset from SP to first arg on stack at first instruction of a function */
103a1597
GS
62#define SP_ARG0 (1 * 4)
63
103a1597
GS
64#if !defined (BPT_VECTOR)
65#define BPT_VECTOR 0xf
66#endif
67
eb2e12d7 68static const unsigned char *
103a1597
GS
69m68k_local_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
70{
71 static unsigned char break_insn[] = {0x4e, (0x40 | BPT_VECTOR)};
72 *lenptr = sizeof (break_insn);
73 return break_insn;
74}
75
76
942dc0e9 77static int
5ae5f592 78m68k_register_bytes_ok (long numbytes)
942dc0e9
GS
79{
80 return ((numbytes == REGISTER_BYTES_FP)
81 || (numbytes == REGISTER_BYTES_NOFP));
82}
83
d85fe7f7
AS
84/* Return the GDB type object for the "standard" data type of data in
85 register N. This should be int for D0-D7, SR, FPCONTROL and
86 FPSTATUS, long double for FP0-FP7, and void pointer for all others
87 (A0-A7, PC, FPIADDR). Note, for registers which contain
88 addresses return pointer to void, not pointer to char, because we
89 don't want to attempt to print the string after printing the
90 address. */
5d3ed2e3
GS
91
92static struct type *
8de307e0 93m68k_register_type (struct gdbarch *gdbarch, int regnum)
5d3ed2e3 94{
03dac896
AS
95 if (regnum >= FP0_REGNUM && regnum <= FP0_REGNUM + 7)
96 return builtin_type_m68881_ext;
97
32eeb91a 98 if (regnum == M68K_FPI_REGNUM || regnum == PC_REGNUM)
03dac896
AS
99 return builtin_type_void_func_ptr;
100
32eeb91a
AS
101 if (regnum == M68K_FPC_REGNUM || regnum == M68K_FPS_REGNUM
102 || regnum == PS_REGNUM)
03dac896
AS
103 return builtin_type_int32;
104
32eeb91a 105 if (regnum >= M68K_A0_REGNUM && regnum <= M68K_A0_REGNUM + 7)
03dac896
AS
106 return builtin_type_void_data_ptr;
107
108 return builtin_type_int32;
5d3ed2e3
GS
109}
110
111/* Function: m68k_register_name
112 Returns the name of the standard m68k register regnum. */
113
114static const char *
115m68k_register_name (int regnum)
116{
117 static char *register_names[] = {
118 "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
119 "a0", "a1", "a2", "a3", "a4", "a5", "fp", "sp",
120 "ps", "pc",
121 "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7",
122 "fpcontrol", "fpstatus", "fpiaddr", "fpcode", "fpflags"
123 };
124
125 if (regnum < 0 ||
126 regnum >= sizeof (register_names) / sizeof (register_names[0]))
127 internal_error (__FILE__, __LINE__,
128 "m68k_register_name: illegal register number %d", regnum);
129 else
130 return register_names[regnum];
131}
8de307e0 132\f
f595cb19
MK
133/* There is a fair number of calling conventions that are in somewhat
134 wide use. The 68000/08/10 don't support an FPU, not even as a
135 coprocessor. All function return values are stored in %d0/%d1.
136 Structures are returned in a static buffer, a pointer to which is
137 returned in %d0. This means that functions returning a structure
138 are not re-entrant. To avoid this problem some systems use a
139 convention where the caller passes a pointer to a buffer in %a1
140 where the return values is to be stored. This convention is the
141 default, and is implemented in the function m68k_return_value.
142
143 The 68020/030/040/060 do support an FPU, either as a coprocessor
144 (68881/2) or built-in (68040/68060). That's why System V release 4
145 (SVR4) instroduces a new calling convention specified by the SVR4
146 psABI. Integer values are returned in %d0/%d1, pointer return
147 values in %a0 and floating values in %fp0. When calling functions
148 returning a structure the caller should pass a pointer to a buffer
149 for the return value in %a0. This convention is implemented in the
150 function m68k_svr4_return_value, and by appropriately setting the
151 struct_value_regnum member of `struct gdbarch_tdep'.
152
153 GNU/Linux returns values in the same way as SVR4 does, but uses %a1
154 for passing the structure return value buffer.
155
156 GCC can also generate code where small structures are returned in
157 %d0/%d1 instead of in memory by using -freg-struct-return. This is
158 the default on NetBSD a.out, OpenBSD and GNU/Linux and several
159 embedded systems. This convention is implemented by setting the
160 struct_return member of `struct gdbarch_tdep' to reg_struct_return. */
161
162/* Read a function return value of TYPE from REGCACHE, and copy that
8de307e0 163 into VALBUF. */
942dc0e9
GS
164
165static void
8de307e0
AS
166m68k_extract_return_value (struct type *type, struct regcache *regcache,
167 void *valbuf)
942dc0e9 168{
8de307e0
AS
169 int len = TYPE_LENGTH (type);
170 char buf[M68K_MAX_REGISTER_SIZE];
942dc0e9 171
8de307e0
AS
172 if (len <= 4)
173 {
174 regcache_raw_read (regcache, M68K_D0_REGNUM, buf);
175 memcpy (valbuf, buf + (4 - len), len);
176 }
177 else if (len <= 8)
178 {
179 regcache_raw_read (regcache, M68K_D0_REGNUM, buf);
180 memcpy (valbuf, buf + (8 - len), len - 4);
181 regcache_raw_read (regcache, M68K_D1_REGNUM,
182 (char *) valbuf + (len - 4));
183 }
184 else
185 internal_error (__FILE__, __LINE__,
186 "Cannot extract return value of %d bytes long.", len);
942dc0e9
GS
187}
188
942dc0e9 189static void
f595cb19
MK
190m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache,
191 void *valbuf)
942dc0e9 192{
8de307e0 193 int len = TYPE_LENGTH (type);
f595cb19 194 char buf[M68K_MAX_REGISTER_SIZE];
942dc0e9 195
f595cb19 196 if (TYPE_CODE (type) == TYPE_CODE_FLT)
8de307e0 197 {
f595cb19
MK
198 regcache_raw_read (regcache, M68K_FP0_REGNUM, buf);
199 convert_typed_floating (buf, builtin_type_m68881_ext, valbuf, type);
8de307e0 200 }
f595cb19
MK
201 else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
202 regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf);
203 else
204 m68k_extract_return_value (type, regcache, valbuf);
205}
206
207/* Write a function return value of TYPE from VALBUF into REGCACHE. */
208
209static void
210m68k_store_return_value (struct type *type, struct regcache *regcache,
211 const void *valbuf)
212{
213 int len = TYPE_LENGTH (type);
942dc0e9 214
8de307e0
AS
215 if (len <= 4)
216 regcache_raw_write_part (regcache, M68K_D0_REGNUM, 4 - len, len, valbuf);
217 else if (len <= 8)
218 {
f595cb19 219 regcache_raw_write_part (regcache, M68K_D0_REGNUM, 8 - len,
8de307e0 220 len - 4, valbuf);
f595cb19 221 regcache_raw_write (regcache, M68K_D1_REGNUM,
8de307e0
AS
222 (char *) valbuf + (len - 4));
223 }
224 else
225 internal_error (__FILE__, __LINE__,
226 "Cannot store return value of %d bytes long.", len);
227}
942dc0e9 228
f595cb19
MK
229static void
230m68k_svr4_store_return_value (struct type *type, struct regcache *regcache,
231 const void *valbuf)
942dc0e9 232{
f595cb19 233 int len = TYPE_LENGTH (type);
8de307e0 234
f595cb19
MK
235 if (TYPE_CODE (type) == TYPE_CODE_FLT)
236 {
237 char buf[M68K_MAX_REGISTER_SIZE];
238 convert_typed_floating (valbuf, type, buf, builtin_type_m68881_ext);
239 regcache_raw_write (regcache, M68K_FP0_REGNUM, buf);
240 }
241 else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4)
242 {
243 regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf);
244 regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf);
245 }
246 else
247 m68k_store_return_value (type, regcache, valbuf);
942dc0e9
GS
248}
249
f595cb19
MK
250/* Return non-zero if TYPE, which is assumed to be a structure or
251 union type, should be returned in registers for architecture
252 GDBARCH. */
253
c481dac7 254static int
f595cb19 255m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
c481dac7 256{
f595cb19
MK
257 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
258 enum type_code code = TYPE_CODE (type);
259 int len = TYPE_LENGTH (type);
c481dac7 260
f595cb19
MK
261 gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION);
262
263 if (tdep->struct_return == pcc_struct_return)
264 return 0;
265
266 return (len == 1 || len == 2 || len == 4 || len == 8);
c481dac7
AS
267}
268
f595cb19
MK
269/* Determine, for architecture GDBARCH, how a return value of TYPE
270 should be returned. If it is supposed to be returned in registers,
271 and READBUF is non-zero, read the appropriate value from REGCACHE,
272 and copy it into READBUF. If WRITEBUF is non-zero, write the value
273 from WRITEBUF into REGCACHE. */
274
275static enum return_value_convention
276m68k_return_value (struct gdbarch *gdbarch, struct type *type,
277 struct regcache *regcache, void *readbuf,
278 const void *writebuf)
279{
280 enum type_code code = TYPE_CODE (type);
281
282 if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
283 && !m68k_reg_struct_return_p (gdbarch, type))
284 return RETURN_VALUE_STRUCT_CONVENTION;
285
286 /* GCC returns a `long double' in memory. */
287 if (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12)
288 return RETURN_VALUE_STRUCT_CONVENTION;
289
290 if (readbuf)
291 m68k_extract_return_value (type, regcache, readbuf);
292 if (writebuf)
293 m68k_store_return_value (type, regcache, writebuf);
294
295 return RETURN_VALUE_REGISTER_CONVENTION;
296}
297
298static enum return_value_convention
299m68k_svr4_return_value (struct gdbarch *gdbarch, struct type *type,
300 struct regcache *regcache, void *readbuf,
301 const void *writebuf)
302{
303 enum type_code code = TYPE_CODE (type);
304
305 if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
306 && !m68k_reg_struct_return_p (gdbarch, type))
307 return RETURN_VALUE_STRUCT_CONVENTION;
308
309 /* This special case is for structures consisting of a single
310 `float' or `double' member. These structures are returned in
311 %fp0. For these structures, we call ourselves recursively,
312 changing TYPE into the type of the first member of the structure.
313 Since that should work for all structures that have only one
314 member, we don't bother to check the member's type here. */
315 if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
316 {
317 type = check_typedef (TYPE_FIELD_TYPE (type, 0));
318 return m68k_svr4_return_value (gdbarch, type, regcache,
319 readbuf, writebuf);
320 }
321
322 if (readbuf)
323 m68k_svr4_extract_return_value (type, regcache, readbuf);
324 if (writebuf)
325 m68k_svr4_store_return_value (type, regcache, writebuf);
326
327 return RETURN_VALUE_REGISTER_CONVENTION;
328}
329\f
330
942dc0e9
GS
331/* A function that tells us whether the function invocation represented
332 by fi does not have a frame on the stack associated with it. If it
333 does not, FRAMELESS is set to 1, else 0. */
334
335static int
336m68k_frameless_function_invocation (struct frame_info *fi)
337{
32eeb91a 338 if (get_frame_type (fi) == SIGTRAMP_FRAME)
942dc0e9
GS
339 return 0;
340 else
19772a2c 341 return legacy_frameless_look_for_prologue (fi);
942dc0e9
GS
342}
343
89c3b6d3 344int
fba45db2 345delta68_in_sigtramp (CORE_ADDR pc, char *name)
89c3b6d3 346{
1bd54964
AC
347 if (name != NULL)
348 return strcmp (name, "_sigcode") == 0;
349 else
350 return 0;
89c3b6d3
PDM
351}
352
353CORE_ADDR
fba45db2 354delta68_frame_args_address (struct frame_info *frame_info)
89c3b6d3
PDM
355{
356 /* we assume here that the only frameless functions are the system calls
357 or other functions who do not put anything on the stack. */
32eeb91a 358 if (get_frame_type (frame_info) == SIGTRAMP_FRAME)
1e2330ba 359 return get_frame_base (frame_info) + 12;
19772a2c 360 else if (legacy_frameless_look_for_prologue (frame_info))
89c3b6d3 361 {
b5d78d39 362 /* Check for an interrupted system call */
11c02a10
AC
363 if (get_next_frame (frame_info) && (get_frame_type (get_next_frame (frame_info)) == SIGTRAMP_FRAME))
364 return get_frame_base (get_next_frame (frame_info)) + 16;
b5d78d39 365 else
1e2330ba 366 return get_frame_base (frame_info) + 4;
89c3b6d3
PDM
367 }
368 else
1e2330ba 369 return get_frame_base (frame_info);
89c3b6d3
PDM
370}
371
372CORE_ADDR
fba45db2 373delta68_frame_saved_pc (struct frame_info *frame_info)
89c3b6d3 374{
b5fc49aa
AS
375 return read_memory_unsigned_integer (delta68_frame_args_address (frame_info)
376 + 4, 4);
89c3b6d3
PDM
377}
378
392a587b 379int
fba45db2 380delta68_frame_num_args (struct frame_info *fi)
392a587b
JM
381{
382 int val;
8bedc050 383 CORE_ADDR pc = DEPRECATED_FRAME_SAVED_PC (fi);
b5fc49aa 384 int insn = read_memory_unsigned_integer (pc, 2);
392a587b 385 val = 0;
c5aa993b 386 if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */
392a587b 387 val = read_memory_integer (pc + 2, 2);
c5aa993b
JM
388 else if ((insn & 0170777) == 0050217 /* addql #N, sp */
389 || (insn & 0170777) == 0050117) /* addqw */
392a587b
JM
390 {
391 val = (insn >> 9) & 7;
392 if (val == 0)
393 val = 8;
394 }
c5aa993b 395 else if (insn == 0157774) /* addal #WW, sp */
392a587b
JM
396 val = read_memory_integer (pc + 2, 4);
397 val >>= 2;
398 return val;
399}
400
8de307e0
AS
401static CORE_ADDR
402m68k_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
403 struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
404 struct value **args, CORE_ADDR sp, int struct_return,
405 CORE_ADDR struct_addr)
7f8e7424 406{
f595cb19 407 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
8de307e0
AS
408 char buf[4];
409 int i;
410
411 /* Push arguments in reverse order. */
412 for (i = nargs - 1; i >= 0; i--)
413 {
c481dac7
AS
414 struct type *value_type = VALUE_ENCLOSING_TYPE (args[i]);
415 int len = TYPE_LENGTH (value_type);
8de307e0 416 int container_len = (len + 3) & ~3;
c481dac7
AS
417 int offset;
418
419 /* Non-scalars bigger than 4 bytes are left aligned, others are
420 right aligned. */
421 if ((TYPE_CODE (value_type) == TYPE_CODE_STRUCT
422 || TYPE_CODE (value_type) == TYPE_CODE_UNION
423 || TYPE_CODE (value_type) == TYPE_CODE_ARRAY)
424 && len > 4)
425 offset = 0;
426 else
427 offset = container_len - len;
8de307e0
AS
428 sp -= container_len;
429 write_memory (sp + offset, VALUE_CONTENTS_ALL (args[i]), len);
430 }
431
c481dac7 432 /* Store struct value address. */
8de307e0
AS
433 if (struct_return)
434 {
8de307e0 435 store_unsigned_integer (buf, 4, struct_addr);
f595cb19 436 regcache_cooked_write (regcache, tdep->struct_value_regnum, buf);
8de307e0
AS
437 }
438
439 /* Store return address. */
440 sp -= 4;
441 store_unsigned_integer (buf, 4, bp_addr);
442 write_memory (sp, buf, 4);
443
444 /* Finally, update the stack pointer... */
445 store_unsigned_integer (buf, 4, sp);
446 regcache_cooked_write (regcache, M68K_SP_REGNUM, buf);
447
448 /* ...and fake a frame pointer. */
449 regcache_cooked_write (regcache, M68K_FP_REGNUM, buf);
450
451 /* DWARF2/GCC uses the stack address *before* the function call as a
452 frame's CFA. */
453 return sp + 8;
7f8e7424 454}
8de307e0
AS
455\f
456struct m68k_frame_cache
457{
458 /* Base address. */
459 CORE_ADDR base;
460 CORE_ADDR sp_offset;
461 CORE_ADDR pc;
7f8e7424 462
8de307e0
AS
463 /* Saved registers. */
464 CORE_ADDR saved_regs[M68K_NUM_REGS];
465 CORE_ADDR saved_sp;
7f8e7424 466
8de307e0
AS
467 /* Stack space reserved for local variables. */
468 long locals;
469};
c906108c 470
8de307e0
AS
471/* Allocate and initialize a frame cache. */
472
473static struct m68k_frame_cache *
474m68k_alloc_frame_cache (void)
c906108c 475{
8de307e0
AS
476 struct m68k_frame_cache *cache;
477 int i;
c906108c 478
8de307e0 479 cache = FRAME_OBSTACK_ZALLOC (struct m68k_frame_cache);
c906108c 480
8de307e0
AS
481 /* Base address. */
482 cache->base = 0;
483 cache->sp_offset = -4;
484 cache->pc = 0;
c906108c 485
8de307e0
AS
486 /* Saved registers. We initialize these to -1 since zero is a valid
487 offset (that's where %fp is supposed to be stored). */
488 for (i = 0; i < M68K_NUM_REGS; i++)
489 cache->saved_regs[i] = -1;
490
491 /* Frameless until proven otherwise. */
492 cache->locals = -1;
493
494 return cache;
c906108c
SS
495}
496
8de307e0
AS
497/* Check whether PC points at a code that sets up a new stack frame.
498 If so, it updates CACHE and returns the address of the first
499 instruction after the sequence that sets removes the "hidden"
500 argument from the stack or CURRENT_PC, whichever is smaller.
501 Otherwise, return PC. */
c906108c 502
8de307e0
AS
503static CORE_ADDR
504m68k_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR current_pc,
505 struct m68k_frame_cache *cache)
c906108c 506{
8de307e0
AS
507 int op;
508
509 if (pc >= current_pc)
510 return current_pc;
c906108c 511
8de307e0
AS
512 op = read_memory_unsigned_integer (pc, 2);
513
514 if (op == P_LINKW_FP || op == P_LINKL_FP || op == P_PEA_FP)
c906108c 515 {
8de307e0
AS
516 cache->saved_regs[M68K_FP_REGNUM] = 0;
517 cache->sp_offset += 4;
518 if (op == P_LINKW_FP)
519 {
520 /* link.w %fp, #-N */
521 /* link.w %fp, #0; adda.l #-N, %sp */
522 cache->locals = -read_memory_integer (pc + 2, 2);
523
524 if (pc + 4 < current_pc && cache->locals == 0)
525 {
526 op = read_memory_unsigned_integer (pc + 4, 2);
527 if (op == P_ADDAL_SP)
528 {
529 cache->locals = read_memory_integer (pc + 6, 4);
530 return pc + 10;
531 }
532 }
533
534 return pc + 4;
535 }
536 else if (op == P_LINKL_FP)
c906108c 537 {
8de307e0
AS
538 /* link.l %fp, #-N */
539 cache->locals = -read_memory_integer (pc + 2, 4);
540 return pc + 6;
541 }
542 else
543 {
544 /* pea (%fp); movea.l %sp, %fp */
545 cache->locals = 0;
546
547 if (pc + 2 < current_pc)
548 {
549 op = read_memory_unsigned_integer (pc + 2, 2);
550
551 if (op == P_MOVEAL_SP_FP)
552 {
553 /* move.l %sp, %fp */
554 return pc + 4;
555 }
556 }
557
558 return pc + 2;
c906108c
SS
559 }
560 }
8de307e0 561 else if ((op & 0170777) == P_SUBQW_SP || (op & 0170777) == P_SUBQL_SP)
c906108c 562 {
8de307e0
AS
563 /* subq.[wl] #N,%sp */
564 /* subq.[wl] #8,%sp; subq.[wl] #N,%sp */
565 cache->locals = (op & 07000) == 0 ? 8 : (op & 07000) >> 9;
566 if (pc + 2 < current_pc)
c906108c 567 {
8de307e0
AS
568 op = read_memory_unsigned_integer (pc + 2, 2);
569 if ((op & 0170777) == P_SUBQW_SP || (op & 0170777) == P_SUBQL_SP)
570 {
571 cache->locals += (op & 07000) == 0 ? 8 : (op & 07000) >> 9;
572 return pc + 4;
573 }
c906108c 574 }
8de307e0
AS
575 return pc + 2;
576 }
577 else if (op == P_ADDAW_SP || op == P_LEA_SP_SP)
578 {
579 /* adda.w #-N,%sp */
580 /* lea (-N,%sp),%sp */
581 cache->locals = -read_memory_integer (pc + 2, 2);
582 return pc + 4;
c906108c 583 }
8de307e0 584 else if (op == P_ADDAL_SP)
c906108c 585 {
8de307e0
AS
586 /* adda.l #-N,%sp */
587 cache->locals = -read_memory_integer (pc + 2, 4);
588 return pc + 6;
c906108c 589 }
8de307e0
AS
590
591 return pc;
c906108c 592}
c5aa993b 593
8de307e0
AS
594/* Check whether PC points at code that saves registers on the stack.
595 If so, it updates CACHE and returns the address of the first
596 instruction after the register saves or CURRENT_PC, whichever is
597 smaller. Otherwise, return PC. */
c906108c 598
8de307e0
AS
599static CORE_ADDR
600m68k_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
601 struct m68k_frame_cache *cache)
602{
603 if (cache->locals >= 0)
604 {
605 CORE_ADDR offset;
606 int op;
607 int i, mask, regno;
c906108c 608
8de307e0
AS
609 offset = -4 - cache->locals;
610 while (pc < current_pc)
611 {
612 op = read_memory_unsigned_integer (pc, 2);
613 if (op == P_FMOVEMX_SP)
614 {
615 /* fmovem.x REGS,-(%sp) */
616 op = read_memory_unsigned_integer (pc + 2, 2);
617 if ((op & 0xff00) == 0xe000)
618 {
619 mask = op & 0xff;
620 for (i = 0; i < 16; i++, mask >>= 1)
621 {
622 if (mask & 1)
623 {
624 cache->saved_regs[i + M68K_FP0_REGNUM] = offset;
625 offset -= 12;
626 }
627 }
628 pc += 4;
629 }
630 else
631 break;
632 }
633 else if ((op & 0170677) == P_MOVEL_SP)
634 {
635 /* move.l %R,-(%sp) */
636 regno = ((op & 07000) >> 9) | ((op & 0100) >> 3);
637 cache->saved_regs[regno] = offset;
638 offset -= 4;
639 pc += 2;
640 }
641 else if (op == P_MOVEML_SP)
642 {
643 /* movem.l REGS,-(%sp) */
644 mask = read_memory_unsigned_integer (pc + 2, 2);
645 for (i = 0; i < 16; i++, mask >>= 1)
646 {
647 if (mask & 1)
648 {
649 cache->saved_regs[15 - i] = offset;
650 offset -= 4;
651 }
652 }
653 pc += 4;
654 }
655 else
656 break;
657 }
658 }
659
660 return pc;
661}
c906108c 662
c906108c 663
8de307e0
AS
664/* Do a full analysis of the prologue at PC and update CACHE
665 accordingly. Bail out early if CURRENT_PC is reached. Return the
666 address where the analysis stopped.
c906108c 667
8de307e0 668 We handle all cases that can be generated by gcc.
c906108c 669
8de307e0 670 For allocating a stack frame:
c906108c 671
8de307e0
AS
672 link.w %a6,#-N
673 link.l %a6,#-N
674 pea (%fp); move.l %sp,%fp
675 link.w %a6,#0; add.l #-N,%sp
676 subq.l #N,%sp
677 subq.w #N,%sp
678 subq.w #8,%sp; subq.w #N-8,%sp
679 add.w #-N,%sp
680 lea (-N,%sp),%sp
681 add.l #-N,%sp
c906108c 682
8de307e0 683 For saving registers:
c906108c 684
8de307e0
AS
685 fmovem.x REGS,-(%sp)
686 move.l R1,-(%sp)
687 move.l R1,-(%sp); move.l R2,-(%sp)
688 movem.l REGS,-(%sp)
c906108c 689
8de307e0 690 For setting up the PIC register:
c906108c 691
8de307e0 692 lea (%pc,N),%a5
c906108c 693
8de307e0 694 */
c906108c 695
eb2e12d7 696static CORE_ADDR
8de307e0
AS
697m68k_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
698 struct m68k_frame_cache *cache)
c906108c 699{
8de307e0 700 unsigned int op;
c906108c 701
8de307e0
AS
702 pc = m68k_analyze_frame_setup (pc, current_pc, cache);
703 pc = m68k_analyze_register_saves (pc, current_pc, cache);
704 if (pc >= current_pc)
705 return current_pc;
c906108c 706
8de307e0
AS
707 /* Check for GOT setup. */
708 op = read_memory_unsigned_integer (pc, 4);
709 if (op == P_LEA_PC_A5)
c906108c 710 {
8de307e0
AS
711 /* lea (%pc,N),%a5 */
712 return pc + 6;
c906108c 713 }
8de307e0
AS
714
715 return pc;
c906108c
SS
716}
717
8de307e0 718/* Return PC of first real instruction. */
7f8e7424 719
8de307e0
AS
720static CORE_ADDR
721m68k_skip_prologue (CORE_ADDR start_pc)
c906108c 722{
8de307e0
AS
723 struct m68k_frame_cache cache;
724 CORE_ADDR pc;
725 int op;
c906108c 726
8de307e0
AS
727 cache.locals = -1;
728 pc = m68k_analyze_prologue (start_pc, (CORE_ADDR) -1, &cache);
729 if (cache.locals < 0)
730 return start_pc;
731 return pc;
732}
c906108c 733
8de307e0
AS
734static CORE_ADDR
735m68k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
736{
737 char buf[8];
7f8e7424 738
8de307e0
AS
739 frame_unwind_register (next_frame, PC_REGNUM, buf);
740 return extract_typed_address (buf, builtin_type_void_func_ptr);
741}
742\f
743/* Normal frames. */
7f8e7424 744
8de307e0
AS
745static struct m68k_frame_cache *
746m68k_frame_cache (struct frame_info *next_frame, void **this_cache)
747{
748 struct m68k_frame_cache *cache;
749 char buf[4];
750 int i;
751
752 if (*this_cache)
753 return *this_cache;
754
755 cache = m68k_alloc_frame_cache ();
756 *this_cache = cache;
757
758 /* In principle, for normal frames, %fp holds the frame pointer,
759 which holds the base address for the current stack frame.
760 However, for functions that don't need it, the frame pointer is
761 optional. For these "frameless" functions the frame pointer is
762 actually the frame pointer of the calling frame. Signal
763 trampolines are just a special case of a "frameless" function.
764 They (usually) share their frame pointer with the frame that was
765 in progress when the signal occurred. */
766
767 frame_unwind_register (next_frame, M68K_FP_REGNUM, buf);
768 cache->base = extract_unsigned_integer (buf, 4);
769 if (cache->base == 0)
770 return cache;
771
772 /* For normal frames, %pc is stored at 4(%fp). */
773 cache->saved_regs[M68K_PC_REGNUM] = 4;
774
775 cache->pc = frame_func_unwind (next_frame);
776 if (cache->pc != 0)
777 m68k_analyze_prologue (cache->pc, frame_pc_unwind (next_frame), cache);
778
779 if (cache->locals < 0)
780 {
781 /* We didn't find a valid frame, which means that CACHE->base
782 currently holds the frame pointer for our calling frame. If
783 we're at the start of a function, or somewhere half-way its
784 prologue, the function's frame probably hasn't been fully
785 setup yet. Try to reconstruct the base address for the stack
786 frame by looking at the stack pointer. For truly "frameless"
787 functions this might work too. */
788
789 frame_unwind_register (next_frame, M68K_SP_REGNUM, buf);
790 cache->base = extract_unsigned_integer (buf, 4) + cache->sp_offset;
791 }
7f8e7424 792
8de307e0
AS
793 /* Now that we have the base address for the stack frame we can
794 calculate the value of %sp in the calling frame. */
795 cache->saved_sp = cache->base + 8;
7f8e7424 796
8de307e0
AS
797 /* Adjust all the saved registers such that they contain addresses
798 instead of offsets. */
799 for (i = 0; i < M68K_NUM_REGS; i++)
800 if (cache->saved_regs[i] != -1)
801 cache->saved_regs[i] += cache->base;
c906108c 802
8de307e0
AS
803 return cache;
804}
c906108c 805
8de307e0
AS
806static void
807m68k_frame_this_id (struct frame_info *next_frame, void **this_cache,
808 struct frame_id *this_id)
809{
810 struct m68k_frame_cache *cache = m68k_frame_cache (next_frame, this_cache);
c906108c 811
8de307e0
AS
812 /* This marks the outermost frame. */
813 if (cache->base == 0)
814 return;
c5aa993b 815
8de307e0
AS
816 /* See the end of m68k_push_dummy_call. */
817 *this_id = frame_id_build (cache->base + 8, cache->pc);
818}
c5aa993b 819
8de307e0
AS
820static void
821m68k_frame_prev_register (struct frame_info *next_frame, void **this_cache,
822 int regnum, int *optimizedp,
823 enum lval_type *lvalp, CORE_ADDR *addrp,
824 int *realnump, void *valuep)
825{
826 struct m68k_frame_cache *cache = m68k_frame_cache (next_frame, this_cache);
827
828 gdb_assert (regnum >= 0);
829
830 if (regnum == M68K_SP_REGNUM && cache->saved_sp)
c5aa993b 831 {
8de307e0
AS
832 *optimizedp = 0;
833 *lvalp = not_lval;
834 *addrp = 0;
835 *realnump = -1;
836 if (valuep)
c906108c 837 {
8de307e0
AS
838 /* Store the value. */
839 store_unsigned_integer (valuep, 4, cache->saved_sp);
89c3b6d3 840 }
8de307e0
AS
841 return;
842 }
843
844 if (regnum < M68K_NUM_REGS && cache->saved_regs[regnum] != -1)
845 {
846 *optimizedp = 0;
847 *lvalp = lval_memory;
848 *addrp = cache->saved_regs[regnum];
849 *realnump = -1;
850 if (valuep)
89c3b6d3 851 {
8de307e0
AS
852 /* Read the value in from memory. */
853 read_memory (*addrp, valuep,
854 register_size (current_gdbarch, regnum));
89c3b6d3 855 }
8de307e0 856 return;
c906108c 857 }
8de307e0
AS
858
859 frame_register_unwind (next_frame, regnum,
860 optimizedp, lvalp, addrp, realnump, valuep);
861}
862
863static const struct frame_unwind m68k_frame_unwind =
864{
865 NORMAL_FRAME,
866 m68k_frame_this_id,
867 m68k_frame_prev_register
868};
869
870static const struct frame_unwind *
336d1bba 871m68k_frame_sniffer (struct frame_info *next_frame)
8de307e0
AS
872{
873 return &m68k_frame_unwind;
874}
875\f
8de307e0
AS
876static CORE_ADDR
877m68k_frame_base_address (struct frame_info *next_frame, void **this_cache)
878{
879 struct m68k_frame_cache *cache = m68k_frame_cache (next_frame, this_cache);
880
881 return cache->base;
882}
883
884static const struct frame_base m68k_frame_base =
885{
886 &m68k_frame_unwind,
887 m68k_frame_base_address,
888 m68k_frame_base_address,
889 m68k_frame_base_address
890};
891
892static struct frame_id
893m68k_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
894{
895 char buf[4];
896 CORE_ADDR fp;
c906108c 897
8de307e0
AS
898 frame_unwind_register (next_frame, M68K_FP_REGNUM, buf);
899 fp = extract_unsigned_integer (buf, 4);
c906108c 900
8de307e0
AS
901 /* See the end of m68k_push_dummy_call. */
902 return frame_id_build (fp + 8, frame_pc_unwind (next_frame));
903}
904\f
c5aa993b 905#ifdef USE_PROC_FS /* Target dependent support for /proc */
c906108c
SS
906
907#include <sys/procfs.h>
908
c60c0f5f
MS
909/* Prototypes for supply_gregset etc. */
910#include "gregset.h"
911
c906108c 912/* The /proc interface divides the target machine's register set up into
c5aa993b
JM
913 two different sets, the general register set (gregset) and the floating
914 point register set (fpregset). For each set, there is an ioctl to get
915 the current register set and another ioctl to set the current values.
c906108c 916
c5aa993b
JM
917 The actual structure passed through the ioctl interface is, of course,
918 naturally machine dependent, and is different for each set of registers.
919 For the m68k for example, the general register set is typically defined
920 by:
c906108c 921
c5aa993b 922 typedef int gregset_t[18];
c906108c 923
c5aa993b
JM
924 #define R_D0 0
925 ...
926 #define R_PS 17
c906108c 927
c5aa993b 928 and the floating point set by:
c906108c 929
c5aa993b
JM
930 typedef struct fpregset {
931 int f_pcr;
932 int f_psr;
933 int f_fpiaddr;
934 int f_fpregs[8][3]; (8 regs, 96 bits each)
935 } fpregset_t;
c906108c 936
c5aa993b
JM
937 These routines provide the packing and unpacking of gregset_t and
938 fpregset_t formatted data.
c906108c
SS
939
940 */
941
942/* Atari SVR4 has R_SR but not R_PS */
943
944#if !defined (R_PS) && defined (R_SR)
945#define R_PS R_SR
946#endif
947
948/* Given a pointer to a general register set in /proc format (gregset_t *),
c5aa993b
JM
949 unpack the register contents and supply them as gdb's idea of the current
950 register values. */
c906108c
SS
951
952void
fba45db2 953supply_gregset (gregset_t *gregsetp)
c906108c 954{
52f0bd74
AC
955 int regi;
956 greg_t *regp = (greg_t *) gregsetp;
c906108c 957
c5aa993b 958 for (regi = 0; regi < R_PC; regi++)
c906108c
SS
959 {
960 supply_register (regi, (char *) (regp + regi));
961 }
962 supply_register (PS_REGNUM, (char *) (regp + R_PS));
963 supply_register (PC_REGNUM, (char *) (regp + R_PC));
964}
965
966void
fba45db2 967fill_gregset (gregset_t *gregsetp, int regno)
c906108c 968{
52f0bd74
AC
969 int regi;
970 greg_t *regp = (greg_t *) gregsetp;
c906108c 971
c5aa993b 972 for (regi = 0; regi < R_PC; regi++)
c906108c 973 {
8de307e0
AS
974 if (regno == -1 || regno == regi)
975 regcache_collect (regi, regp + regi);
c906108c 976 }
8de307e0
AS
977 if (regno == -1 || regno == PS_REGNUM)
978 regcache_collect (PS_REGNUM, regp + R_PS);
979 if (regno == -1 || regno == PC_REGNUM)
980 regcache_collect (PC_REGNUM, regp + R_PC);
c906108c
SS
981}
982
983#if defined (FP0_REGNUM)
984
985/* Given a pointer to a floating point register set in /proc format
c5aa993b
JM
986 (fpregset_t *), unpack the register contents and supply them as gdb's
987 idea of the current floating point register values. */
c906108c 988
c5aa993b 989void
fba45db2 990supply_fpregset (fpregset_t *fpregsetp)
c906108c 991{
52f0bd74 992 int regi;
c906108c 993 char *from;
c5aa993b 994
32eeb91a 995 for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
c906108c 996 {
c5aa993b 997 from = (char *) &(fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
c906108c
SS
998 supply_register (regi, from);
999 }
32eeb91a
AS
1000 supply_register (M68K_FPC_REGNUM, (char *) &(fpregsetp->f_pcr));
1001 supply_register (M68K_FPS_REGNUM, (char *) &(fpregsetp->f_psr));
1002 supply_register (M68K_FPI_REGNUM, (char *) &(fpregsetp->f_fpiaddr));
c906108c
SS
1003}
1004
1005/* Given a pointer to a floating point register set in /proc format
c5aa993b
JM
1006 (fpregset_t *), update the register specified by REGNO from gdb's idea
1007 of the current floating point register set. If REGNO is -1, update
1008 them all. */
c906108c
SS
1009
1010void
fba45db2 1011fill_fpregset (fpregset_t *fpregsetp, int regno)
c906108c
SS
1012{
1013 int regi;
c906108c 1014
32eeb91a 1015 for (regi = FP0_REGNUM; regi < M68K_FPC_REGNUM; regi++)
c906108c 1016 {
8de307e0
AS
1017 if (regno == -1 || regno == regi)
1018 regcache_collect (regi, &fpregsetp->f_fpregs[regi - FP0_REGNUM][0]);
c906108c 1019 }
8de307e0
AS
1020 if (regno == -1 || regno == M68K_FPC_REGNUM)
1021 regcache_collect (M68K_FPC_REGNUM, &fpregsetp->f_pcr);
1022 if (regno == -1 || regno == M68K_FPS_REGNUM)
1023 regcache_collect (M68K_FPS_REGNUM, &fpregsetp->f_psr);
1024 if (regno == -1 || regno == M68K_FPI_REGNUM)
1025 regcache_collect (M68K_FPI_REGNUM, &fpregsetp->f_fpiaddr);
c906108c
SS
1026}
1027
c5aa993b 1028#endif /* defined (FP0_REGNUM) */
c906108c 1029
c5aa993b 1030#endif /* USE_PROC_FS */
c906108c 1031
c906108c
SS
1032/* Figure out where the longjmp will land. Slurp the args out of the stack.
1033 We expect the first arg to be a pointer to the jmp_buf structure from which
1034 we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
1035 This routine returns true on success. */
1036
1037int
f4281f55 1038m68k_get_longjmp_target (CORE_ADDR *pc)
c906108c 1039{
35fc8285 1040 char *buf;
c906108c 1041 CORE_ADDR sp, jb_addr;
eb2e12d7
AS
1042 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
1043
1044 if (tdep->jb_pc < 0)
1045 {
1046 internal_error (__FILE__, __LINE__,
1047 "m68k_get_longjmp_target: not implemented");
1048 return 0;
1049 }
c906108c 1050
35fc8285 1051 buf = alloca (TARGET_PTR_BIT / TARGET_CHAR_BIT);
c5aa993b 1052 sp = read_register (SP_REGNUM);
c906108c 1053
b5d78d39
GS
1054 if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
1055 buf, TARGET_PTR_BIT / TARGET_CHAR_BIT))
c906108c
SS
1056 return 0;
1057
7c0b4a20 1058 jb_addr = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
c906108c 1059
eb2e12d7 1060 if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
c906108c
SS
1061 TARGET_PTR_BIT / TARGET_CHAR_BIT))
1062 return 0;
1063
7c0b4a20 1064 *pc = extract_unsigned_integer (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
c906108c
SS
1065 return 1;
1066}
f595cb19
MK
1067\f
1068
1069/* System V Release 4 (SVR4). */
1070
1071void
1072m68k_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
1073{
1074 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
1075
1076 /* SVR4 uses a different calling convention. */
1077 set_gdbarch_return_value (gdbarch, m68k_svr4_return_value);
1078
1079 /* SVR4 uses %a0 instead of %a1. */
1080 tdep->struct_value_regnum = M68K_A0_REGNUM;
1081}
1082\f
c906108c 1083
152d9db6
GS
1084/* Function: m68k_gdbarch_init
1085 Initializer function for the m68k gdbarch vector.
1086 Called by gdbarch. Sets up the gdbarch vector(s) for this target. */
1087
1088static struct gdbarch *
1089m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1090{
1091 struct gdbarch_tdep *tdep = NULL;
1092 struct gdbarch *gdbarch;
1093
1094 /* find a candidate among the list of pre-declared architectures. */
1095 arches = gdbarch_list_lookup_by_info (arches, &info);
1096 if (arches != NULL)
1097 return (arches->gdbarch);
1098
eb2e12d7
AS
1099 tdep = xmalloc (sizeof (struct gdbarch_tdep));
1100 gdbarch = gdbarch_alloc (&info, tdep);
152d9db6 1101
5d3ed2e3
GS
1102 set_gdbarch_long_double_format (gdbarch, &floatformat_m68881_ext);
1103 set_gdbarch_long_double_bit (gdbarch, 96);
1104
5d3ed2e3 1105 set_gdbarch_skip_prologue (gdbarch, m68k_skip_prologue);
103a1597 1106 set_gdbarch_breakpoint_from_pc (gdbarch, m68k_local_breakpoint_from_pc);
5d3ed2e3
GS
1107
1108 /* Stack grows down. */
1109 set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
78bf922a 1110 set_gdbarch_parm_boundary (gdbarch, 32);
6300c360
GS
1111
1112 set_gdbarch_believe_pcc_promotion (gdbarch, 1);
942dc0e9
GS
1113 set_gdbarch_decr_pc_after_break (gdbarch, 2);
1114
19772a2c 1115 set_gdbarch_deprecated_frameless_function_invocation (gdbarch, m68k_frameless_function_invocation);
6300c360 1116 set_gdbarch_frame_args_skip (gdbarch, 8);
942dc0e9 1117
8de307e0 1118 set_gdbarch_register_type (gdbarch, m68k_register_type);
5d3ed2e3 1119 set_gdbarch_register_name (gdbarch, m68k_register_name);
942dc0e9
GS
1120 set_gdbarch_num_regs (gdbarch, 29);
1121 set_gdbarch_register_bytes_ok (gdbarch, m68k_register_bytes_ok);
32eeb91a 1122 set_gdbarch_sp_regnum (gdbarch, M68K_SP_REGNUM);
32eeb91a
AS
1123 set_gdbarch_pc_regnum (gdbarch, M68K_PC_REGNUM);
1124 set_gdbarch_ps_regnum (gdbarch, M68K_PS_REGNUM);
1125 set_gdbarch_fp0_regnum (gdbarch, M68K_FP0_REGNUM);
a2c6a6d5 1126
8de307e0 1127 set_gdbarch_push_dummy_call (gdbarch, m68k_push_dummy_call);
f595cb19 1128 set_gdbarch_return_value (gdbarch, m68k_return_value);
6c0e89ed 1129
650fcc91
AS
1130 /* Disassembler. */
1131 set_gdbarch_print_insn (gdbarch, print_insn_m68k);
1132
eb2e12d7
AS
1133#if defined JB_PC && defined JB_ELEMENT_SIZE
1134 tdep->jb_pc = JB_PC;
1135 tdep->jb_elt_size = JB_ELEMENT_SIZE;
1136#else
1137 tdep->jb_pc = -1;
1138#endif
f595cb19 1139 tdep->struct_value_regnum = M68K_A1_REGNUM;
c481dac7 1140 tdep->struct_return = pcc_struct_return;
8de307e0
AS
1141
1142 /* Frame unwinder. */
1143 set_gdbarch_unwind_dummy_id (gdbarch, m68k_unwind_dummy_id);
1144 set_gdbarch_unwind_pc (gdbarch, m68k_unwind_pc);
3f244638
AS
1145
1146 /* Hook in the DWARF CFI frame unwinder. */
1147 frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
1148
8de307e0 1149 frame_base_set_default (gdbarch, &m68k_frame_base);
eb2e12d7 1150
55809acb
AS
1151 /* Hook in ABI-specific overrides, if they have been registered. */
1152 gdbarch_init_osabi (info, gdbarch);
1153
eb2e12d7
AS
1154 /* Now we have tuned the configuration, set a few final things,
1155 based on what the OS ABI has told us. */
1156
1157 if (tdep->jb_pc >= 0)
1158 set_gdbarch_get_longjmp_target (gdbarch, m68k_get_longjmp_target);
1159
336d1bba 1160 frame_unwind_append_sniffer (gdbarch, m68k_frame_sniffer);
8de307e0 1161
152d9db6
GS
1162 return gdbarch;
1163}
1164
1165
1166static void
1167m68k_dump_tdep (struct gdbarch *current_gdbarch, struct ui_file *file)
1168{
eb2e12d7 1169 struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
152d9db6 1170
eb2e12d7
AS
1171 if (tdep == NULL)
1172 return;
152d9db6 1173}
2acceee2 1174
a78f21af
AC
1175extern initialize_file_ftype _initialize_m68k_tdep; /* -Wmissing-prototypes */
1176
c906108c 1177void
fba45db2 1178_initialize_m68k_tdep (void)
c906108c 1179{
152d9db6 1180 gdbarch_register (bfd_arch_m68k, m68k_gdbarch_init, m68k_dump_tdep);
c906108c 1181}
This page took 0.52788 seconds and 4 git commands to generate.