+2017-09-27 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * arm-tdep.c: (convert_from_extended): Remove.
+ (convert_to_extended): Likewise.
+ (arm_extract_return_value): Use convert_typed_floating.
+ (arm_store_return_value): Likewise.
+
+ * sh-tdep.h (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
+ * sh-tdep.c: Do not include "floatformat.h".
+ (sh_littlebyte_bigword_type): New function.
+ (sh_register_convert_to_virtual): Use convert_typed_floating.
+ (sh_register_convert_to_raw): Likewise.
+ * sh64-tdep.c: (struct gdbarch_tdep): Add sh_littlebyte_bigword_type.
+ (sh64_littlebyte_bigword_type): New function.
+ (sh64_extract_return_value): Use convert_typed_floating.
+ (sh64_register_convert_to_virtual): Likewise.
+ (sh64_register_convert_to_raw): Likewise.
+
2017-09-27 Ulrich Weigand <uweigand@de.ibm.com>
* doublest.h (floatformat_from_type): Move to gdbtypes.h.
struct cmd_list_element *,
const char *);
-static void convert_from_extended (const struct floatformat *, const void *,
- void *, int);
-static void convert_to_extended (const struct floatformat *, void *,
- const void *, int);
-
static enum register_status arm_neon_quad_read (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum, gdb_byte *buf);
internal_error (__FILE__, __LINE__, _("Bad REGNUM %d"), regnum);
}
-/* NOTE: cagney/2001-08-20: Both convert_from_extended() and
- convert_to_extended() use floatformat_arm_ext_littlebyte_bigword.
- It is thought that this is is the floating-point register format on
- little-endian systems. */
-
-static void
-convert_from_extended (const struct floatformat *fmt, const void *ptr,
- void *dbl, int endianess)
-{
- DOUBLEST d;
-
- if (endianess == BFD_ENDIAN_BIG)
- floatformat_to_doublest (&floatformat_arm_ext_big, ptr, &d);
- else
- floatformat_to_doublest (&floatformat_arm_ext_littlebyte_bigword,
- ptr, &d);
- floatformat_from_doublest (fmt, &d, dbl);
-}
-
-static void
-convert_to_extended (const struct floatformat *fmt, void *dbl, const void *ptr,
- int endianess)
-{
- DOUBLEST d;
-
- floatformat_to_doublest (fmt, ptr, &d);
- if (endianess == BFD_ENDIAN_BIG)
- floatformat_from_doublest (&floatformat_arm_ext_big, &d, dbl);
- else
- floatformat_from_doublest (&floatformat_arm_ext_littlebyte_bigword,
- &d, dbl);
-}
-
/* Given BUF, which is OLD_LEN bytes ending at ENDADDR, expand
the buffer to be NEW_LEN bytes ending at ENDADDR. Return
NULL if an error occurs. BUF is freed. */
bfd_byte tmpbuf[FP_REGISTER_SIZE];
regcache_cooked_read (regs, ARM_F0_REGNUM, tmpbuf);
- convert_from_extended (floatformat_from_type (type), tmpbuf,
- valbuf, gdbarch_byte_order (gdbarch));
+ convert_typed_floating (tmpbuf, arm_ext_type (gdbarch),
+ valbuf, type);
}
break;
{
case ARM_FLOAT_FPA:
- convert_to_extended (floatformat_from_type (type), buf, valbuf,
- gdbarch_byte_order (gdbarch));
+ convert_typed_floating (valbuf, type, buf, arm_ext_type (gdbarch));
regcache_cooked_write (regs, ARM_F0_REGNUM, buf);
break;
#include "dis-asm.h"
#include "inferior.h"
#include "arch-utils.h"
-#include "floatformat.h"
#include "regcache.h"
#include "doublest.h"
#include "osabi.h"
The other pseudo registers (the FVs) also don't pose a problem
because they are stored as 4 individual FP elements. */
+static struct type *
+sh_littlebyte_bigword_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (tdep->sh_littlebyte_bigword_type == NULL)
+ tdep->sh_littlebyte_bigword_type
+ = arch_float_type (gdbarch, -1, "builtin_type_sh_littlebyte_bigword",
+ floatformats_ieee_double_littlebyte_bigword);
+
+ return tdep->sh_littlebyte_bigword_type;
+}
+
static void
sh_register_convert_to_virtual (struct gdbarch *gdbarch, int regnum,
struct type *type, gdb_byte *from, gdb_byte *to)
}
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
- {
- DOUBLEST val;
- floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
- from, &val);
- store_typed_floating (to, type, val);
- }
+ convert_typed_floating (from, sh_littlebyte_bigword_type (gdbarch),
+ to, type);
else
error
("sh_register_convert_to_virtual called with non DR register number");
}
if (regnum >= DR0_REGNUM && regnum <= DR_LAST_REGNUM)
- {
- DOUBLEST val = extract_typed_floating (from, type);
- floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword,
- &val, to);
- }
+ convert_typed_floating (from, type,
+ to, sh_littlebyte_bigword_type (gdbarch));
else
error (_("sh_register_convert_to_raw called with non DR register number"));
}
inside the associated core file section. */
struct sh_corefile_regmap *core_fpregmap;
int sizeof_fpregset;
+ /* ISA-specific data types. */
+ struct type *sh_littlebyte_bigword_type;
};
extern const struct regset sh_corefile_gregset;
struct gdbarch_tdep
{
enum sh_abi sh_abi;
+ /* ISA-specific data types. */
+ struct type *sh_littlebyte_bigword_type;
};
+struct type *
+sh64_littlebyte_bigword_type (struct gdbarch *gdbarch)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (tdep->sh_littlebyte_bigword_type == NULL)
+ tdep->sh_littlebyte_bigword_type
+ = arch_float_type (gdbarch, -1, "builtin_type_sh_littlebyte_bigword",
+ floatformats_ieee_double_littlebyte_bigword);
+
+ return tdep->sh_littlebyte_bigword_type;
+}
+
struct sh64_frame_cache
{
/* Base address. */
else if (len == 8)
{
/* return value stored in DR0_REGNUM. */
- DOUBLEST val;
gdb_byte buf[8];
-
regcache_cooked_read (regcache, DR0_REGNUM, buf);
- if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
- floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
- buf, &val);
- else
- floatformat_to_doublest (&floatformat_ieee_double_big,
- buf, &val);
- store_typed_floating (valbuf, type, val);
+ convert_typed_floating (buf, sh64_littlebyte_bigword_type (gdbarch),
+ valbuf, type);
}
}
else
&& regnum <= DR_LAST_REGNUM)
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
- {
- DOUBLEST val;
- floatformat_to_doublest (&floatformat_ieee_double_littlebyte_bigword,
- from, &val);
- store_typed_floating (to, type, val);
- }
+ convert_typed_floating (from, sh64_littlebyte_bigword_type (gdbarch),
+ to, type);
else
error (_("sh64_register_convert_to_virtual "
"called with non DR register number"));
&& regnum <= DR_LAST_REGNUM)
|| (regnum >= DR0_C_REGNUM
&& regnum <= DR_LAST_C_REGNUM))
- {
- DOUBLEST val = extract_typed_floating (from, type);
- floatformat_from_doublest (&floatformat_ieee_double_littlebyte_bigword,
- &val, to);
- }
+ convert_typed_floating (from, type,
+ to, sh64_littlebyte_bigword_type (gdbarch));
else
error (_("sh64_register_convert_to_raw called "
"with non DR register number"));