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