* remote-fileio.c (remote_fileio_reset): New.
[deliverable/binutils-gdb.git] / gdb / m68k-tdep.c
index 31ac09cb4bc06a37d10b4a2d563d42d48c542086..1761996fc9e28b096d2a309fa4b06fb2fd4bf2f2 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for the Motorola 68000 series.
 
-   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
+   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000,
    2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 #include "defs.h"
 #include "dwarf2-frame.h"
@@ -122,8 +122,7 @@ m68k_register_name (int regnum)
     "fpcontrol", "fpstatus", "fpiaddr", "fpcode", "fpflags"
   };
 
-  if (regnum < 0 ||
-      regnum >= sizeof (register_names) / sizeof (register_names[0]))
+  if (regnum < 0 || regnum >= ARRAY_SIZE (register_names))
     internal_error (__FILE__, __LINE__,
                    _("m68k_register_name: illegal register number %d"), regnum);
   else
@@ -333,13 +332,25 @@ m68k_return_value (struct gdbarch *gdbarch, struct type *type,
 {
   enum type_code code = TYPE_CODE (type);
 
-  if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
-      && !m68k_reg_struct_return_p (gdbarch, type))
-    return RETURN_VALUE_STRUCT_CONVENTION;
+  /* GCC returns a `long double' in memory too.  */
+  if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION)
+       && !m68k_reg_struct_return_p (gdbarch, type))
+      || (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12))
+    {
+      /* The default on m68k is to return structures in static memory.
+         Consequently a function must return the address where we can
+         find the return value.  */
+
+      if (readbuf)
+       {
+         ULONGEST addr;
+
+         regcache_raw_read_unsigned (regcache, M68K_D0_REGNUM, &addr);
+         read_memory (addr, readbuf, TYPE_LENGTH (type));
+       }
 
-  /* GCC returns a `long double' in memory.  */
-  if (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12)
-    return RETURN_VALUE_STRUCT_CONVENTION;
+      return RETURN_VALUE_ABI_RETURNS_ADDRESS;
+    }
 
   if (readbuf)
     m68k_extract_return_value (type, regcache, readbuf);
This page took 0.024093 seconds and 4 git commands to generate.