]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/config/m68k/tm-linux.h
2003-03-12 Andrew Cagney <cagney@redhat.com>
[thirdparty/binutils-gdb.git] / gdb / config / m68k / tm-linux.h
1 /* Definitions to target GDB to GNU/Linux on m680x0.
2
3 Copyright 1996, 1998, 1999, 2000, 2002 Free Software Foundation,
4 Inc.
5
6 This file is part of GDB.
7
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.
12
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.
17
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. */
22
23 #include "regcache.h"
24 #include "m68k-tdep.h"
25
26 /* Number of traps that happen between exec'ing the shell to run an
27 inferior, and when we finally get to the inferior code. This is 2
28 on most implementations. */
29
30 #define START_INFERIOR_TRAPS_EXPECTED 2
31
32 /* The following definitions are appropriate when using the ELF
33 format, where floating point values are returned in fp0, pointer
34 values in a0 and other values in d0. */
35
36 /* Extract from an array REGBUF containing the (raw) register state a
37 function return value of type TYPE, and copy that, in virtual
38 format, into VALBUF. */
39
40 #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
41 { \
42 if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
43 { \
44 REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE, \
45 ((char *) (REGBUF) \
46 + REGISTER_BYTE (FP0_REGNUM)), \
47 VALBUF); \
48 } \
49 else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \
50 memcpy (VALBUF, (char *) (REGBUF) + REGISTER_BYTE (M68K_A0_REGNUM), \
51 TYPE_LENGTH (TYPE)); \
52 else \
53 memcpy (VALBUF, \
54 ((char *) (REGBUF) \
55 + (TYPE_LENGTH (TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH (TYPE))), \
56 TYPE_LENGTH (TYPE)); \
57 }
58
59 /* Write into appropriate registers a function return value of type
60 TYPE, given in virtual format. */
61
62 #define DEPRECATED_STORE_RETURN_VALUE(TYPE,VALBUF) \
63 { \
64 if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
65 { \
66 char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)]; \
67 REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buffer); \
68 deprecated_write_register_bytes (REGISTER_BYTE (FP0_REGNUM), \
69 raw_buffer, TYPE_LENGTH (TYPE)); \
70 } \
71 else \
72 { \
73 if (TYPE_CODE (TYPE) == TYPE_CODE_PTR) \
74 deprecated_write_register_bytes (REGISTER_BYTE (M68K_A0_REGNUM), VALBUF, \
75 TYPE_LENGTH (TYPE)); \
76 deprecated_write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); \
77 } \
78 }
79
80 #include "config/tm-linux.h"
81 #include "m68k/tm-m68k.h"
82
83 /* Extract from an array REGBUF containing the (raw) register state
84 the address in which a function should return its structure value,
85 as a CORE_ADDR (or an expression that can be used as one). */
86
87 #undef DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS
88 #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
89 (*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (M68K_A0_REGNUM)))
90
91 /* Offsets (in target ints) into jmp_buf. */
92
93 #define JB_ELEMENT_SIZE 4
94 #define JB_PC 7
95
96 /* Figure out where the longjmp will land. Slurp the args out of the stack.
97 We expect the first arg to be a pointer to the jmp_buf structure from which
98 we extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
99 This routine returns true on success */
100
101 #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
102
103 #undef DEPRECATED_FRAME_SAVED_PC
104 #define DEPRECATED_FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame)
105 extern CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *);
106
107 #define IN_SIGTRAMP(pc,name) m68k_linux_in_sigtramp (pc)
108 extern int m68k_linux_in_sigtramp (CORE_ADDR pc);