OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [symm-tdep.c] - Diff between revs 105 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 105 Rev 1765
/* Sequent Symmetry target interface, for GDB.
/* Sequent Symmetry target interface, for GDB.
   Copyright (C) 1986, 1987, 1989, 1991, 1994 Free Software Foundation, Inc.
   Copyright (C) 1986, 1987, 1989, 1991, 1994 Free Software Foundation, Inc.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */
   Boston, MA 02111-1307, USA.  */
 
 
/* many 387-specific items of use taken from i386-dep.c */
/* many 387-specific items of use taken from i386-dep.c */
 
 
#include "defs.h"
#include "defs.h"
#include "frame.h"
#include "frame.h"
#include "inferior.h"
#include "inferior.h"
#include "symtab.h"
#include "symtab.h"
 
 
#include <signal.h>
#include <signal.h>
#include <sys/param.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/user.h>
#include <sys/dir.h>
#include <sys/dir.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include "gdb_stat.h"
#include "gdb_stat.h"
#include "gdbcore.h"
#include "gdbcore.h"
#include <fcntl.h>
#include <fcntl.h>
 
 
void
void
symmetry_extract_return_value (type, regbuf, valbuf)
symmetry_extract_return_value (type, regbuf, valbuf)
     struct type *type;
     struct type *type;
     char *regbuf;
     char *regbuf;
     char *valbuf;
     char *valbuf;
{
{
  union
  union
    {
    {
      double d;
      double d;
      int l[2];
      int l[2];
    }
    }
  xd;
  xd;
  struct minimal_symbol *msymbol;
  struct minimal_symbol *msymbol;
  float f;
  float f;
 
 
  if (TYPE_CODE_FLT == TYPE_CODE (type))
  if (TYPE_CODE_FLT == TYPE_CODE (type))
    {
    {
      msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
      msymbol = lookup_minimal_symbol ("1167_flt", NULL, NULL);
      if (msymbol != NULL)
      if (msymbol != NULL)
        {
        {
          /* found "1167_flt" means 1167, %fp2-%fp3 */
          /* found "1167_flt" means 1167, %fp2-%fp3 */
          /* float & double; 19= %fp2, 20= %fp3 */
          /* float & double; 19= %fp2, 20= %fp3 */
          /* no single precision on 1167 */
          /* no single precision on 1167 */
          xd.l[1] = *((int *) &regbuf[REGISTER_BYTE (19)]);
          xd.l[1] = *((int *) &regbuf[REGISTER_BYTE (19)]);
          xd.l[0] = *((int *) &regbuf[REGISTER_BYTE (20)]);
          xd.l[0] = *((int *) &regbuf[REGISTER_BYTE (20)]);
          switch (TYPE_LENGTH (type))
          switch (TYPE_LENGTH (type))
            {
            {
            case 4:
            case 4:
              /* FIXME: broken for cross-debugging.  */
              /* FIXME: broken for cross-debugging.  */
              f = (float) xd.d;
              f = (float) xd.d;
              memcpy (valbuf, &f, TYPE_LENGTH (type));
              memcpy (valbuf, &f, TYPE_LENGTH (type));
              break;
              break;
            case 8:
            case 8:
              /* FIXME: broken for cross-debugging.  */
              /* FIXME: broken for cross-debugging.  */
              memcpy (valbuf, &xd.d, TYPE_LENGTH (type));
              memcpy (valbuf, &xd.d, TYPE_LENGTH (type));
              break;
              break;
            default:
            default:
              error ("Unknown floating point size");
              error ("Unknown floating point size");
              break;
              break;
            }
            }
        }
        }
      else
      else
        {
        {
          /* 387 %st(0), gcc uses this */
          /* 387 %st(0), gcc uses this */
          i387_to_double (((int *) &regbuf[REGISTER_BYTE (3)]),
          i387_to_double (((int *) &regbuf[REGISTER_BYTE (3)]),
                          &xd.d);
                          &xd.d);
          switch (TYPE_LENGTH (type))
          switch (TYPE_LENGTH (type))
            {
            {
            case 4:             /* float */
            case 4:             /* float */
              f = (float) xd.d;
              f = (float) xd.d;
              /* FIXME: broken for cross-debugging.  */
              /* FIXME: broken for cross-debugging.  */
              memcpy (valbuf, &f, 4);
              memcpy (valbuf, &f, 4);
              break;
              break;
            case 8:             /* double */
            case 8:             /* double */
              /* FIXME: broken for cross-debugging.  */
              /* FIXME: broken for cross-debugging.  */
              memcpy (valbuf, &xd.d, 8);
              memcpy (valbuf, &xd.d, 8);
              break;
              break;
            default:
            default:
              error ("Unknown floating point size");
              error ("Unknown floating point size");
              break;
              break;
            }
            }
        }
        }
    }
    }
  else
  else
    {
    {
      memcpy (valbuf, regbuf, TYPE_LENGTH (type));
      memcpy (valbuf, regbuf, TYPE_LENGTH (type));
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.