This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Long double support on m68k


This patch enables long double support for m68k.

Andreas.

2001-07-23  Andreas Schwab  <schwab@suse.de>

	* config/m68k/tm-m68k.h (TARGET_LONG_DOUBLE_FORMAT): Define.
	(TARGET_LONG_DOUBLE_BIT): Define.
	(REGISTER_VIRTUAL_SIZE): Return 12 for floating point registers.
	(MAX_REGISTER_VIRTUAL_SIZE): Increase to 12.
	(REGISTER_VIRTUAL_TYPE): Return builtin_type_long_double for
	floating point registers.
	(REGISTER_CONVERTIBLE, REGISTER_CONVERT_TO_VIRTUAL,
	REGISTER_CONVERT_TO_RAW): Remove.
	* config/m68k/xm-linux.h (HOST_LONG_DOUBLE_FORMAT): Define.

--- tm-m68k.h.~1.6.~	Thu Mar 15 10:16:08 2001
+++ tm-m68k.h	Sun Jul 15 22:26:50 2001
@@ -28,6 +28,10 @@
 /* Define the bit, byte, and word ordering of the machine.  */
 #define TARGET_BYTE_ORDER BIG_ENDIAN
 
+#define TARGET_LONG_DOUBLE_FORMAT &floatformat_m68881_ext
+
+#define TARGET_LONG_DOUBLE_BIT 96
+
 /* Offset from address of function to start of its code.
    Zero on most machines.  */
 
@@ -137,9 +141,9 @@
 
 /* Number of bytes of storage in the program's representation
    for register N.  On the 68000, all regs are 4 bytes
-   except the floating point regs which are 8-byte doubles.  */
+   except the floating point regs which are 12-byte long doubles.  */
 
-#define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 8 : 4)
+#define REGISTER_VIRTUAL_SIZE(N) (((unsigned)(N) - FP0_REGNUM) < 8 ? 12 : 4)
 
 /* Largest value REGISTER_RAW_SIZE can have.  */
 
@@ -147,39 +151,10 @@
 
 /* Largest value REGISTER_VIRTUAL_SIZE can have.  */
 
-#define MAX_REGISTER_VIRTUAL_SIZE 8
-
-/* Nonzero if register N requires conversion
-   from raw format to virtual format.  */
-
-#define REGISTER_CONVERTIBLE(N) (((unsigned)(N) - FP0_REGNUM) < 8)
-
-#include "floatformat.h"
-
-/* Convert data from raw format for register REGNUM in buffer FROM
-   to virtual format with type TYPE in buffer TO.  */
-
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,TYPE,FROM,TO) \
-do									\
-  {									\
-    DOUBLEST dbl_tmp_val;							\
-    floatformat_to_doublest (&floatformat_m68881_ext, (FROM), &dbl_tmp_val); \
-    store_floating ((TO), TYPE_LENGTH (TYPE), dbl_tmp_val);		\
-  } while (0)
-
-/* Convert data from virtual format with type TYPE in buffer FROM
-   to raw format for register REGNUM in buffer TO.  */
-
-#define REGISTER_CONVERT_TO_RAW(TYPE,REGNUM,FROM,TO)	\
-do									\
-  {									\
-    DOUBLEST dbl_tmp_val;						\
-    dbl_tmp_val = extract_floating ((FROM), TYPE_LENGTH (TYPE));	\
-    floatformat_from_doublest (&floatformat_m68881_ext, &dbl_tmp_val, (TO)); \
-  } while (0)
+#define MAX_REGISTER_VIRTUAL_SIZE 12
 
 /* Return the GDB type object for the "standard" data type of data 
-   in register N.  This should be int for D0-D7, double for FP0-FP7,
+   in register N.  This should be int for D0-D7, long double for FP0-FP7,
    and void pointer for all others (A0-A7, PC, SR, FPCONTROL etc).
    Note, for registers which contain addresses return pointer to void, 
    not pointer to char, because we don't want to attempt to print 
@@ -187,7 +162,7 @@
 
 #define REGISTER_VIRTUAL_TYPE(N) \
   ((unsigned) (N) >= FPC_REGNUM ? lookup_pointer_type (builtin_type_void) : \
-   (unsigned) (N) >= FP0_REGNUM ? builtin_type_double :                     \
+   (unsigned) (N) >= FP0_REGNUM ? builtin_type_long_double :                \
    (unsigned) (N) >=  A0_REGNUM ? lookup_pointer_type (builtin_type_void) : \
    builtin_type_int)
 
Index: config/m68k/xm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/xm-linux.h,v
retrieving revision 1.5
diff -u -a -u -r1.5 config/m68k/xm-linux.h
--- config/m68k/xm-linux.h	2001/07/23 19:21:55	1.5
+++ config/m68k/xm-linux.h	2001/07/24 14:28:43
@@ -29,6 +29,8 @@
    to get the offset in the core file of the register values.  */
 #define KERNEL_U_ADDR 0x0
 
+#define HOST_LONG_DOUBLE_FORMAT &floatformat_m68881_ext
+
 /* Need R_OK etc, but USG isn't defined.  */
 #include <unistd.h>
 
 

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]