Index: arm-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/arm-tdep.c,v retrieving revision 1.4 diff -u -p -r1.4 arm-tdep.c --- arm-tdep.c 2000/02/29 07:23:02 1.4 +++ arm-tdep.c 2000/03/14 18:58:46 @@ -24,6 +24,7 @@ #include "inferior.h" #include "gdbcmd.h" #include "gdbcore.h" +#include "floatformat.h" #include "symfile.h" #include "gdb_string.h" #include "coff/internal.h" /* Internal format of COFF symbols in BFD */ @@ -86,24 +87,6 @@ struct frame_extra_info #define MAKE_THUMB_ADDR(addr) ((addr) | 1) #define UNMAKE_THUMB_ADDR(addr) ((addr) & ~1) -#define SWAP_TARGET_AND_HOST(buffer,len) \ - do \ - { \ - if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \ - { \ - char tmp; \ - char *p = (char *)(buffer); \ - char *q = ((char *)(buffer)) + len - 1; \ - for (; p < q; p++, q--) \ - { \ - tmp = *q; \ - *q = *p; \ - *p = tmp; \ - } \ - } \ - } \ - while (0) - /* Will a function return an aggregate type in memory or in a register? Return 0 if an aggregate type can be returned in a register, 1 if it must be returned in memory. */ @@ -1235,27 +1218,16 @@ arm_push_arguments (int nargs, value_ptr calling the function. */ if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len) { - float f; - double d; - char * bufo = (char *) &d; - char * bufd = (char *) &dbl_arg; - - len = sizeof (double); - f = *(float *) val; - SWAP_TARGET_AND_HOST (&f, sizeof (float)); /* adjust endianess */ - d = f; - /* We must revert the longwords so they get loaded into the - the right registers. */ - memcpy (bufd, bufo + len / 2, len / 2); - SWAP_TARGET_AND_HOST (bufd, len / 2); /* adjust endianess */ - memcpy (bufd + len / 2, bufo, len / 2); - SWAP_TARGET_AND_HOST (bufd + len / 2, len / 2); /* adjust endianess */ + /* Float argument in buffer is in host format. Read it and + convert to DOUBLEST, and store it in target double. */ + DOUBLEST dblval; + + len = TARGET_DOUBLE_BIT / TARGET_CHAR_BIT; + floatformat_to_doublest (HOST_FLOAT_FORMAT, val, &dblval); + store_floating (&dbl_arg, len, dblval); val = (char *) &dbl_arg; } -#if 1 - /* I don't know why this code was disable. The only logical use - for a function pointer is to call that function, so setting - the mode bit is perfectly fine. FN */ + /* If the argument is a pointer to a function, and it is a Thumb function, set the low bit of the pointer. */ if (TYPE_CODE_PTR == typecode @@ -1266,7 +1238,7 @@ arm_push_arguments (int nargs, value_ptr if (arm_pc_is_thumb (regval)) store_address (val, len, MAKE_THUMB_ADDR (regval)); } -#endif + /* Copy the argument to general registers or the stack in register-sized pieces. Large arguments are split between registers and stack. */