From 87ee36023cfe296160c775df0d0e76aea205cbde Mon Sep 17 00:00:00 2001 From: Mark Alexander Date: Mon, 24 Mar 1997 00:29:12 +0000 Subject: [PATCH] Fixes from Peter Schauer: * config/mips/tm-mips.h (REGISTER_CONVERT_TO_TYPE, REGISTER_CONVERT_FROM_TYPE): Swap words if target, not host, is big-endian and if registers are 32 bits. * mips-tdep.c (mips_print_register, mips_extract_return_value, mips_store_return_value): Fix floating-point word-order problems on little-endian targets introduced by changes of Mar 21. --- gdb/ChangeLog | 10 ++++++++++ gdb/config/mips/tm-mips.h | 20 ++++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d9c3c2d263d..e25c25d6520 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +Sun Mar 23 16:19:20 1997 Mark Alexander + +Fixes from Peter Schauer: + * config/mips/tm-mips.h (REGISTER_CONVERT_TO_TYPE, + REGISTER_CONVERT_FROM_TYPE): Swap words if target, not host, + is big-endian and if registers are 32 bits. + * mips-tdep.c (mips_print_register, mips_extract_return_value, + mips_store_return_value): Fix floating-point word-order problems on + little-endian targets introduced by changes of Mar 21. + Sun Mar 23 15:43:27 1997 Stan Shebs * remote.c (target_resume_hook, target_wait_loop_hook): New diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h index aa595f55e9f..64a26b55846 100644 --- a/gdb/config/mips/tm-mips.h +++ b/gdb/config/mips/tm-mips.h @@ -265,28 +265,32 @@ extern void mips_do_registers_info PARAMS ((int, int)); ? builtin_type_float : builtin_type_int) #endif -#if HOST_BYTE_ORDER == BIG_ENDIAN /* All mips targets store doubles in a register pair with the least significant register in the lower numbered register. - If the host is big endian, double register values need conversion between - memory and register formats. */ + If the target is big endian, double register values need conversion + between memory and register formats. */ #define REGISTER_CONVERT_TO_TYPE(n, type, buffer) \ - do {if ((n) >= FP0_REGNUM && (n) < FP0_REGNUM + 32 && \ - TYPE_CODE(type) == TYPE_CODE_FLT && TYPE_LENGTH(type) == 8) { \ + do {if (TARGET_BYTE_ORDER == BIG_ENDIAN \ + && REGISTER_RAW_SIZE (n) == 4 \ + && (n) >= FP0_REGNUM && (n) < FP0_REGNUM + 32 \ + && TYPE_CODE(type) == TYPE_CODE_FLT \ + && TYPE_LENGTH(type) == 8) { \ char __temp[4]; \ memcpy (__temp, ((char *)(buffer))+4, 4); \ memcpy (((char *)(buffer))+4, (buffer), 4); \ memcpy (((char *)(buffer)), __temp, 4); }} while (0) #define REGISTER_CONVERT_FROM_TYPE(n, type, buffer) \ - do {if ((n) >= FP0_REGNUM && (n) < FP0_REGNUM + 32 && \ - TYPE_CODE(type) == TYPE_CODE_FLT && TYPE_LENGTH(type) == 8) { \ + do {if (TARGET_BYTE_ORDER == BIG_ENDIAN \ + && REGISTER_RAW_SIZE (n) == 4 \ + && (n) >= FP0_REGNUM && (n) < FP0_REGNUM + 32 \ + && TYPE_CODE(type) == TYPE_CODE_FLT \ + && TYPE_LENGTH(type) == 8) { \ char __temp[4]; \ memcpy (__temp, ((char *)(buffer))+4, 4); \ memcpy (((char *)(buffer))+4, (buffer), 4); \ memcpy (((char *)(buffer)), __temp, 4); }} while (0) -#endif /* Store the address of the place in which to copy the structure the subroutine will return. Handled by mips_push_arguments. */ -- 2.30.2