From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23336 invoked by alias); 20 May 2003 23:42:41 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 23301 invoked from network); 20 May 2003 23:42:40 -0000 Received: from unknown (HELO mout1.freenet.de) (194.97.50.132) by sources.redhat.com with SMTP; 20 May 2003 23:42:40 -0000 Received: from [194.97.55.147] (helo=mx4.freenet.de) by mout1.freenet.de with asmtp (Exim 4.20) id 19IGkh-0006Vd-Nr for gdb-patches@sources.redhat.com; Wed, 21 May 2003 01:42:39 +0200 Received: from b01d6.pppool.de ([213.7.1.214] helo=whitebox.local) by mx4.freenet.de with esmtp (Exim 4.20 #1) id 19IGkf-0003Zu-Jw for gdb-patches@sources.redhat.com; Wed, 21 May 2003 01:42:38 +0200 Received: from whitebox.local (localhost [127.0.0.1]) by whitebox.local (8.12.7/8.12.7/SuSE Linux 0.6) with ESMTP id h4KNeZUs000408 for ; Wed, 21 May 2003 01:40:36 +0200 Received: (from andreas@localhost) by whitebox.local (8.12.7/8.12.7/Submit) id h4KNeZMm000405; Wed, 21 May 2003 01:40:35 +0200 X-Authentication-Warning: whitebox.local: andreas set sender to schwab@suse.de using -f To: gdb-patches@sources.redhat.com Subject: Multi-arch m68k-linux X-Yow: I want to so HAPPY, the VEINS in my neck STAND OUT!! From: Andreas Schwab Date: Tue, 20 May 2003 23:42:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-05/txt/msg00378.txt.bz2 2003-05-21 Andreas Schwab * Makefile.in (m68k-tdep.o, m68klinux-tdep.o): Update dependencies. * m68k-tdep.c (m68k_gdbarch_init): Call gdbarch_init_osabi at the end. * m68klinux-tdep.c (m68k_linux_init_abi): New function. (_initialize_m68k_linux_tdep): New function. (m68k_linux_frame_saved_pc): Make static. (m68k_linux_extract_return_value): Likewise. (m68k_linux_store_return_value): Likewise. (m68k_linux_extract_struct_value_address): Likewise. (m68k_linux_in_sigtramp): Handle unsigned long with more than 32 bits. * config/m68k/tm-linux.h (DEPRECATED_EXTRACT_RETURN_VALUE): Remove. (DEPRECATED_STORE_RETURN_VALUE): Remove. (DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS): Remove. (DEPRECATED_FRAME_SAVED_PC): Remove. --- gdb/Makefile.in.~1.380.~ 2003-05-20 20:08:34.000000000 +0200 +++ gdb/Makefile.in 2003-05-21 01:13:53.000000000 +0200 @@ -1918,12 +1918,12 @@ m68hc11-tdep.o: m68hc11-tdep.c $(defs_h) m68k-stub.o: m68k-stub.c m68k-tdep.o: m68k-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(gdbcore_h) \ $(value_h) $(gdb_string_h) $(inferior_h) $(regcache_h) \ - $(arch_utils_h) $(gregset_h) $(m68k_tdep_h) + $(arch_utils_h) $(gregset_h) $(osabi_h) $(m68k_tdep_h) m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \ $(language_h) $(gdbcore_h) $(gdb_string_h) $(regcache_h) \ $(m68k_tdep_h) $(gdb_stat_h) $(floatformat_h) $(target_h) m68klinux-tdep.o: m68klinux-tdep.c $(defs_h) $(gdbcore_h) $(frame_h) \ - $(target_h) $(gdb_string_h) $(gdbtypes_h) $(m68k_tdep_t) + $(target_h) $(gdb_string_h) $(gdbtypes_h) $(osabi_h) $(m68k_tdep_t) m68knbsd-nat.o: m68knbsd-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) \ $(regcache_h) m68knbsd-tdep.o: m68knbsd-tdep.c $(defs_h) $(gdbtypes_h) $(regcache_h) --- gdb/config/m68k/tm-linux.h.~1.14.~ 2003-05-18 14:13:01.000000000 +0200 +++ gdb/config/m68k/tm-linux.h 2003-05-21 01:24:31.000000000 +0200 @@ -31,33 +31,6 @@ #define START_INFERIOR_TRAPS_EXPECTED 2 -/* The following definitions are appropriate when using the ELF - format, where floating point values are returned in fp0, pointer - values in a0 and other values in d0. */ - -/* Extract from an array REGBUF containing the (raw) register state a - function return value of type TYPE, and copy that, in virtual - format, into VALBUF. */ - -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE, REGBUF, VALBUF) \ - m68k_linux_extract_return_value (TYPE, REGBUF, VALBUF) -extern void m68k_linux_extract_return_value (struct type *, char *, char *); - -/* Write into appropriate registers a function return value of type - TYPE, given in virtual format. */ - -#define DEPRECATED_STORE_RETURN_VALUE(TYPE, VALBUF) \ - m68k_linux_store_return_value (TYPE, VALBUF) -extern void m68k_linux_store_return_value (struct type *, char *); - -/* Extract from an array REGBUF containing the (raw) register state - the address in which a function should return its structure value, - as a CORE_ADDR (or an expression that can be used as one). */ - -#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \ - m68k_linux_extract_struct_value_address (REGBUF) -extern CORE_ADDR m68k_linux_extract_struct_value_address (char *); - /* Offsets (in target ints) into jmp_buf. */ #define JB_ELEMENT_SIZE 4 @@ -70,8 +43,5 @@ extern CORE_ADDR m68k_linux_extract_stru #define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR) -#define DEPRECATED_FRAME_SAVED_PC(frame) m68k_linux_frame_saved_pc (frame) -extern CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *); - #define IN_SIGTRAMP(pc,name) m68k_linux_in_sigtramp (pc) extern int m68k_linux_in_sigtramp (CORE_ADDR pc); --- gdb/m68k-tdep.c.~1.60.~ 2003-05-17 20:00:19.000000000 +0200 +++ gdb/m68k-tdep.c 2003-05-21 01:13:41.000000000 +0200 @@ -29,6 +29,7 @@ #include "inferior.h" #include "regcache.h" #include "arch-utils.h" +#include "osabi.h" #include "m68k-tdep.h" @@ -1052,6 +1053,9 @@ m68k_gdbarch_init (struct gdbarch_info i /* Should be using push_dummy_call. */ set_gdbarch_deprecated_dummy_write_sp (gdbarch, generic_target_write_sp); + /* Hook in ABI-specific overrides, if they have been registered. */ + gdbarch_init_osabi (info, gdbarch); + return gdbarch; } --- gdb/m68klinux-tdep.c.~1.3.~ 2003-05-18 22:44:40.000000000 +0200 +++ gdb/m68klinux-tdep.c 2003-05-21 01:13:30.000000000 +0200 @@ -26,6 +26,7 @@ #include "target.h" #include "gdb_string.h" #include "gdbtypes.h" +#include "osabi.h" #include "m68k-tdep.h" /* Check whether insn1 and insn2 are parts of a signal trampoline. */ @@ -68,8 +69,8 @@ m68k_linux_in_sigtramp (CORE_ADDR pc) if (IS_RT_SIGTRAMP (insn0, insn1)) return 2; - insn0 = (insn0 << 16) | (insn1 >> 16); - insn1 = (insn1 << 16) | (insn2 >> 16); + insn0 = ((insn0 << 16) & 0xffffffff) | (insn1 >> 16); + insn1 = ((insn1 << 16) & 0xffffffff) | (insn2 >> 16); if (IS_SIGTRAMP (insn0, insn1)) return 1; if (IS_RT_SIGTRAMP (insn0, insn1)) @@ -118,7 +119,7 @@ m68k_linux_sigtramp_saved_pc (struct fra /* Return the saved program counter for FRAME. */ -CORE_ADDR +static CORE_ADDR m68k_linux_frame_saved_pc (struct frame_info *frame) { if (get_frame_type (frame) == SIGTRAMP_FRAME) @@ -127,7 +128,15 @@ m68k_linux_frame_saved_pc (struct frame_ return read_memory_unsigned_integer (get_frame_base (frame) + 4, 4); } -void +/* The following definitions are appropriate when using the ELF + format, where floating point values are returned in fp0, pointer + values in a0 and other values in d0. */ + +/* Extract from an array REGBUF containing the (raw) register state a + function return value of type TYPE, and copy that, in virtual + format, into VALBUF. */ + +static void m68k_linux_extract_return_value (struct type *type, char *regbuf, char *valbuf) { if (TYPE_CODE (type) == TYPE_CODE_FLT) @@ -145,7 +154,10 @@ m68k_linux_extract_return_value (struct TYPE_LENGTH (type)); } -void +/* Write into appropriate registers a function return value of type + TYPE, given in virtual format. */ + +static void m68k_linux_store_return_value (struct type *type, char *valbuf) { if (TYPE_CODE (type) == TYPE_CODE_FLT) @@ -164,8 +176,32 @@ m68k_linux_store_return_value (struct ty } } -CORE_ADDR +/* Extract from an array REGBUF containing the (raw) register state + the address in which a function should return its structure value, + as a CORE_ADDR. */ + +static CORE_ADDR m68k_linux_extract_struct_value_address (char *regbuf) { return *(CORE_ADDR *) (regbuf + REGISTER_BYTE (M68K_A0_REGNUM)); } + +static void +m68k_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) +{ + set_gdbarch_deprecated_frame_saved_pc (gdbarch, + m68k_linux_frame_saved_pc); + set_gdbarch_deprecated_extract_return_value (gdbarch, + m68k_linux_extract_return_value); + set_gdbarch_deprecated_store_return_value (gdbarch, + m68k_linux_store_return_value); + set_gdbarch_deprecated_extract_struct_value_address (gdbarch, + m68k_linux_extract_struct_value_address); +} + +void +_initialize_m68k_linux_tdep (void) +{ + gdbarch_register_osabi (bfd_arch_m68k, 0, GDB_OSABI_LINUX, + m68k_linux_init_abi); +}