This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[rfa/arm] Remove HOST_BYTE_ORDER from arm-tdep.c
- To: gdb-patches at sources dot redhat dot com
- Subject: [rfa/arm] Remove HOST_BYTE_ORDER from arm-tdep.c
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 29 Jun 2001 01:24:01 -0400
Hello,
The attatched patch eliminates the use of HOST_BYTE_ORDER in the file
arm-tdep.c. In the process I think it rewrites the float->double code
in a more portable way.
Given I don't have an ARM toolchain handy it still needs testing :-/
Andrew
2001-06-29 Andrew Cagney <ac131313@redhat.com>
* config/arm/tm-arm.h: Include "floatformat.h".
* arm-tdep.c (SWAP_TARGET_AND_HOST): Delete macro.
(arm_push_arguments): Rewrite float to double code. Replace
SWAP_TARGET_AND_HOST with floatformat_to_doublest and
floatformat_from_doublest.
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.12
diff -p -r1.12 arm-tdep.c
*** arm-tdep.c 2001/03/06 08:21:05 1.12
--- arm-tdep.c 2001/06/29 05:19:05
*************** struct frame_extra_info
*** 117,140 ****
#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. */
--- 117,122 ----
*************** arm_push_arguments (int nargs, value_ptr
*** 1309,1315 ****
{
int len;
char *val;
- double dbl_arg;
CORE_ADDR regval;
enum type_code typecode;
struct type *arg_type, *target_type;
--- 1291,1296 ----
*************** arm_push_arguments (int nargs, value_ptr
*** 1329,1350 ****
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 */
! val = (char *) &dbl_arg;
}
#if 1
/* I don't know why this code was disable. The only logical use
--- 1310,1320 ----
calling the function. */
if (TYPE_CODE_FLT == typecode && REGISTER_SIZE == len)
{
! DOUBLEST d;
! len = TARGET_DOUBLE_BIT / HOST_CHAR_BIT;
! val = alloca (len);
! floatformat_to_doublest (TARGET_FLOAT_FORMAT, val, &d);
! floatformat_from_doublest (TARGET_DOUBLE_FORMAT, &d, val);
}
#if 1
/* I don't know why this code was disable. The only logical use
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.6
diff -p -r1.6 tm-arm.h
*** tm-arm.h 2001/03/14 23:23:09 1.6
--- tm-arm.h 2001/06/29 05:19:09
***************
*** 23,28 ****
--- 23,29 ----
#define TM_ARM_H
#include "regcache.h"
+ #include "floatformat.h"
/* Forward declarations for prototypes. */
struct type;