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