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