From: Richard Henderson Date: Mon, 2 Jun 2003 16:14:54 +0000 (+0000) Subject: * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=14696584bb200e76b7f6ac81d86deb7fa6dba913;p=binutils-gdb.git * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch macros where appropriate. (alpha_register_convert_to_raw): Similarly. Use unpack_long. (alpha_convert_flt_dbl, alpha_convert_dbl_flt): New. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ff7afe633b6..fe34023b051 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2003-06-02 Richard Henderson + * alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of + deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch + macros where appropriate. + (alpha_register_convert_to_raw): Similarly. Use unpack_long. + (alpha_convert_flt_dbl, alpha_convert_dbl_flt): New. + * alpha-tdep.c (alpha_register_virtual_type): Use void_data_ptr for SP, GP; void_func_ptr for PC; non-language-specific types for all others. diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 44b8401cff4..99e8b62dfc8 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -159,25 +159,38 @@ alpha_register_virtual_size (int regno) bytes or less, as the representation of integers in floating point registers is different. */ +static void +alpha_convert_flt_dbl (void *out, const void *in) +{ + DOUBLEST d = extract_typed_floating (in, builtin_type_ieee_single_little); + store_typed_floating (out, builtin_type_ieee_double_little, d); +} + +static void +alpha_convert_dbl_flt (void *out, const void *in) +{ + DOUBLEST d = extract_typed_floating (in, builtin_type_ieee_double_little); + store_typed_floating (out, builtin_type_ieee_single_little, d); +} + static void alpha_register_convert_to_virtual (int regnum, struct type *valtype, char *raw_buffer, char *virtual_buffer) { - if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum)) + if (TYPE_LENGTH (valtype) >= ALPHA_REGISTER_SIZE) { - memcpy (virtual_buffer, raw_buffer, REGISTER_VIRTUAL_SIZE (regnum)); + memcpy (virtual_buffer, raw_buffer, ALPHA_REGISTER_SIZE); return; } + /* Note that everything below is less than 8 bytes long. */ + if (TYPE_CODE (valtype) == TYPE_CODE_FLT) - { - double d = deprecated_extract_floating (raw_buffer, REGISTER_RAW_SIZE (regnum)); - deprecated_store_floating (virtual_buffer, TYPE_LENGTH (valtype), d); - } - else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4) + alpha_convert_dbl_flt (virtual_buffer, raw_buffer); + else if (TYPE_CODE (valtype) == TYPE_CODE_INT) { ULONGEST l; - l = extract_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum)); + l = extract_unsigned_integer (raw_buffer, ALPHA_REGISTER_SIZE); l = ((l >> 32) & 0xc0000000) | ((l >> 29) & 0x3fffffff); store_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype), l); } @@ -189,26 +202,21 @@ static void alpha_register_convert_to_raw (struct type *valtype, int regnum, char *virtual_buffer, char *raw_buffer) { - if (TYPE_LENGTH (valtype) >= REGISTER_RAW_SIZE (regnum)) + if (TYPE_LENGTH (valtype) >= ALPHA_REGISTER_SIZE) { - memcpy (raw_buffer, virtual_buffer, REGISTER_RAW_SIZE (regnum)); + memcpy (raw_buffer, virtual_buffer, ALPHA_REGISTER_SIZE); return; } + /* Note that everything below is less than 8 bytes long. */ + if (TYPE_CODE (valtype) == TYPE_CODE_FLT) + alpha_convert_flt_dbl (raw_buffer, virtual_buffer); + else if (TYPE_CODE (valtype) == TYPE_CODE_INT) { - double d = deprecated_extract_floating (virtual_buffer, TYPE_LENGTH (valtype)); - deprecated_store_floating (raw_buffer, REGISTER_RAW_SIZE (regnum), d); - } - else if (TYPE_CODE (valtype) == TYPE_CODE_INT && TYPE_LENGTH (valtype) <= 4) - { - ULONGEST l; - if (TYPE_UNSIGNED (valtype)) - l = extract_unsigned_integer (virtual_buffer, TYPE_LENGTH (valtype)); - else - l = extract_signed_integer (virtual_buffer, TYPE_LENGTH (valtype)); + ULONGEST l = unpack_long (valtype, virtual_buffer); l = ((l & 0xc0000000) << 32) | ((l & 0x3fffffff) << 29); - store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (regnum), l); + store_unsigned_integer (raw_buffer, ALPHA_REGISTER_SIZE, l); } else error ("Cannot store value in floating point register");