]>
Commit | Line | Data |
---|---|---|
5076de82 FF |
1 | /* Parameters for execution on a Sony/NEWS, for GDB, the GNU debugger. |
2 | Copyright 1987, 1989, 1991, 1993 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GDB. | |
5 | ||
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. | |
10 | ||
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. | |
15 | ||
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 | |
6c9638b4 | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
5076de82 FF |
19 | |
20 | /* See following cpu type determination macro to get the machine type. | |
f46ffb9e | 21 | |
5076de82 FF |
22 | Here is an m-news.h file for gdb. It supports the 68881 registers. |
23 | by [email protected] | |
f46ffb9e | 24 | |
5076de82 FF |
25 | * Ptrace for handling floating register has a bug(before NEWS OS version 2.2), |
26 | * After NEWS OS version 3.2, some of ptrace's bug is fixed. | |
27 | But we cannot change the floating register(see adb(1) in OS 3.2) yet. */ | |
28 | ||
5076de82 FF |
29 | /* Extract from an array REGBUF containing the (raw) register state |
30 | a function return value of type TYPE, and copy that, in virtual format, | |
31 | into VALBUF. */ | |
32 | ||
33 | /* when it return the floating value, use the FP0 in NEWS. */ | |
34 | #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ | |
35 | { if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ | |
36 | { \ | |
37 | REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, \ | |
ad09cb2b PS |
38 | REGISTER_VIRTUAL_TYPE (FP0_REGNUM), \ |
39 | ®BUF[REGISTER_BYTE (FP0_REGNUM)], \ | |
40 | VALBUF); \ | |
5076de82 FF |
41 | } \ |
42 | else \ | |
ade40d31 | 43 | memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE)); } |
5076de82 FF |
44 | |
45 | /* Write into appropriate registers a function return value | |
46 | of type TYPE, given in virtual format. */ | |
47 | ||
48 | /* when it return the floating value, use the FP0 in NEWS. */ | |
49 | #define STORE_RETURN_VALUE(TYPE,VALBUF) \ | |
50 | { if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \ | |
51 | { \ | |
52 | char raw_buf[REGISTER_RAW_SIZE (FP0_REGNUM)]; \ | |
ad09cb2b PS |
53 | REGISTER_CONVERT_TO_RAW (REGISTER_VIRTUAL_TYPE (FP0_REGNUM), \ |
54 | FP0_REGNUM, VALBUF, raw_buf); \ | |
5076de82 FF |
55 | write_register_bytes (FP0_REGNUM, \ |
56 | raw_buf, REGISTER_RAW_SIZE (FP0_REGNUM)); \ | |
57 | } \ | |
58 | else \ | |
59 | write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE)); } | |
60 | ||
61 | /* Return number of args passed to a frame. | |
62 | Can return -1, meaning no way to tell. */ | |
63 | ||
64 | #define FRAME_NUM_ARGS(val, fi) \ | |
65 | { register CORE_ADDR pc = FRAME_SAVED_PC (fi); \ | |
66 | register int insn = 0177777 & read_memory_integer (pc, 2); \ | |
67 | val = 0; \ | |
68 | if (insn == 0047757 || insn == 0157374) /* lea W(sp),sp or addaw #W,sp */ \ | |
69 | val = read_memory_integer (pc + 2, 2); \ | |
70 | else if ((insn & 0170777) == 0050217 /* addql #N, sp */ \ | |
71 | || (insn & 0170777) == 0050117) /* addqw */ \ | |
72 | { val = (insn >> 9) & 7; if (val == 0) val = 8; } \ | |
73 | else if (insn == 0157774) /* addal #WW, sp */ \ | |
74 | val = read_memory_integer (pc + 2, 4); \ | |
75 | val >>= 2; } | |
76 | ||
2225eb85 | 77 | #include "m68k/tm-m68k.h" |