* Makefile.in (ALLDEPFILES): Add nbsd-tdep.c.
[deliverable/binutils-gdb.git] / gdb / symm-tdep.c
1 /* Sequent Symmetry target interface, for GDB.
2 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 2000
3 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 /* many 387-specific items of use taken from i386-dep.c */
23
24 #include "defs.h"
25 #include "frame.h"
26 #include "inferior.h"
27 #include "symtab.h"
28
29 #include <signal.h>
30 #include <sys/param.h>
31 #include <sys/user.h>
32 #include <sys/dir.h>
33 #include <sys/ioctl.h>
34 #include "gdb_stat.h"
35 #include "gdbcore.h"
36 #include <fcntl.h>
37
38 void
39 symmetry_extract_return_value (struct type *type, char *regbuf, char *valbuf)
40 {
41 union
42 {
43 double d;
44 int l[2];
45 }
46 xd;
47 struct minimal_symbol *msymbol;
48 float f;
49
50 if (TYPE_CODE_FLT == TYPE_CODE (type))
51 {
52 msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
53 if (msymbol != NULL)
54 {
55 /* found "1167_flt" means 1167, %fp2-%fp3 */
56 /* float & double; 19= %fp2, 20= %fp3 */
57 /* no single precision on 1167 */
58 xd.l[1] = *((int *) &regbuf[REGISTER_BYTE (19)]);
59 xd.l[0] = *((int *) &regbuf[REGISTER_BYTE (20)]);
60 switch (TYPE_LENGTH (type))
61 {
62 case 4:
63 /* FIXME: broken for cross-debugging. */
64 f = (float) xd.d;
65 memcpy (valbuf, &f, TYPE_LENGTH (type));
66 break;
67 case 8:
68 /* FIXME: broken for cross-debugging. */
69 memcpy (valbuf, &xd.d, TYPE_LENGTH (type));
70 break;
71 default:
72 error ("Unknown floating point size");
73 break;
74 }
75 }
76 else
77 {
78 /* 387 %st(0), gcc uses this */
79 i387_to_double (((int *) &regbuf[REGISTER_BYTE (3)]),
80 &xd.d);
81 switch (TYPE_LENGTH (type))
82 {
83 case 4: /* float */
84 f = (float) xd.d;
85 /* FIXME: broken for cross-debugging. */
86 memcpy (valbuf, &f, 4);
87 break;
88 case 8: /* double */
89 /* FIXME: broken for cross-debugging. */
90 memcpy (valbuf, &xd.d, 8);
91 break;
92 default:
93 error ("Unknown floating point size");
94 break;
95 }
96 }
97 }
98 else
99 {
100 memcpy (valbuf, regbuf, TYPE_LENGTH (type));
101 }
102 }
This page took 0.03161 seconds and 4 git commands to generate.