From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9251 invoked by alias); 11 Jun 2011 18:50:15 -0000 Received: (qmail 9239 invoked by uid 22791); 11 Jun 2011 18:50:14 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_FAIL,TW_EG X-Spam-Check-By: sourceware.org Received: from gate.lvk.cs.msu.su (HELO mail.lvk.cs.msu.su) (158.250.17.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 11 Jun 2011 18:49:59 +0000 Received: from mail.lvk.cs.msu.su (localhost [127.0.0.1]) by mail.lvk.cs.msu.su (Postfix) with ESMTP id 93D6E5073; Sat, 11 Jun 2011 22:49:54 +0400 (MSD) X-Spam-ASN: Received: from thunder.localnet (h86-62-88-129.ln.rinet.ru [86.62.88.129]) by mail.lvk.cs.msu.su (Postfix) with ESMTPSA id 7E78410B2; Sat, 11 Jun 2011 22:49:54 +0400 (MSD) From: Vladimir Prus To: Mark Kettenis Subject: Re: m68k-elf return value registers Date: Sat, 11 Jun 2011 18:50:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic-pae; KDE/4.6.2; i686; ; ) Cc: gdb-patches@sources.redhat.com References: <201101140157.38487.vladimir@codesourcery.com> <201101251949.15840.vladimir@codesourcery.com> <201104261537.17424.vladimir@codesourcery.com> In-Reply-To: <201104261537.17424.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Message-Id: <201106112249.53362.vladimir@codesourcery.com> X-AV-Checked: ClamAV using ClamSMTP Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-06/txt/msg00148.txt.bz2 On Tuesday, April 26, 2011 15:37:17 Vladimir Prus wrote: > On Tuesday, January 25, 2011 19:49:15 Vladimir Prus wrote: > > How about this split: > > > > > > - Register used to return structures > > - Logic used to decide whether a structure is returned in register > > - Adjusting register used for returning pointers > > Here's a patch to adjust the register for returning pointers. > Comments? Note that I still not able to test on classic m68k, > therefore eye inspection or testing there would be still required. Mark, were you able to take a look at this patch, as well as two others, into which my original patch has been split? Thanks, -- Vladimir Prus CodeSourcery / Mentor Graphics +7 (812) 677-68-40 > -- > Vladimir Prus > Mentor Graphics > +7 (812) 677-68-40 > ptr_value_regnum.diff > commit 607918e383bd3ba7f84ce5f3a1255da5ac5ee401 > Author: Vladimir Prus > Date: Tue Apr 26 15:31:18 2011 +0400 > > Make pointer return value be right on bare metal. > > * m68k-tdep.h (struct gdbarch_tdep): New field > ptr_value_regnum. > * m68k-tdep.c (m68k_svr4_extract_return_value): Use > tdep->ptr_value_regnum. > (m68k_svr4_store_return_value): Likewise. > (m68k_svr4_init_abi): Set ptr_value_regnum to %a0. > (m68k_gdbarch_init): Set ptr_value_regnum to %d0. > * m68kbsd-tdep.c (m68kbsd_aout_init_abi): Set ptr_value_regnum > to %a0. > > diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c > index 6d7a824..c6ae36d 100644 > --- a/gdb/m68k-tdep.c > +++ b/gdb/m68k-tdep.c > @@ -329,7 +329,7 @@ m68k_svr4_extract_return_value (struct type *type, > struct regcache *regcache, convert_typed_floating (buf, fpreg_type, > valbuf, type); > } > else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) > - regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf); > + regcache_raw_read (regcache, tdep->ptr_value_regnum, valbuf); > else > m68k_extract_return_value (type, regcache, valbuf); > } > @@ -371,10 +371,7 @@ m68k_svr4_store_return_value (struct type *type, > struct regcache *regcache, regcache_raw_write (regcache, M68K_FP0_REGNUM, > buf); > } > else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) > - { > - regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf); > - regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf); > - } > + regcache_raw_write (regcache, tdep->ptr_value_regnum, valbuf); > else > m68k_store_return_value (type, regcache, valbuf); > } > @@ -1065,6 +1062,8 @@ m68k_svr4_init_abi (struct gdbarch_info info, struct > gdbarch *gdbarch) > /* SVR4 uses %a0 instead of %a1. */ > tdep->struct_value_regnum = M68K_A0_REGNUM; > + > + tdep->ptr_value_regnum = M68K_A0_REGNUM; > } > > > @@ -1239,6 +1238,7 @@ m68k_gdbarch_init (struct gdbarch_info info, struct > gdbarch_list *arches) set_gdbarch_push_dummy_call (gdbarch, > m68k_push_dummy_call); > set_gdbarch_return_value (gdbarch, m68k_return_value); > > + tdep->ptr_value_regnum = M68K_D0_REGNUM; > > /* Disassembler. */ > set_gdbarch_print_insn (gdbarch, print_insn_m68k); > diff --git a/gdb/m68k-tdep.h b/gdb/m68k-tdep.h > index 596a8cb..3ea7f24 100644 > --- a/gdb/m68k-tdep.h > +++ b/gdb/m68k-tdep.h > @@ -83,6 +83,9 @@ struct gdbarch_tdep > /* Convention for returning structures. */ > enum struct_return struct_return; > > + /* Register in which pointers are returned. */ > + int ptr_value_regnum; > + > /* Convention for returning floats. zero in int regs, non-zero in > float. */ int float_return; > > diff --git a/gdb/m68kbsd-tdep.c b/gdb/m68kbsd-tdep.c > index 81e34e9..3b5f5e0 100644 > --- a/gdb/m68kbsd-tdep.c > +++ b/gdb/m68kbsd-tdep.c > @@ -213,11 +213,12 @@ m68kbsd_aout_init_abi (struct gdbarch_info info, > struct gdbarch *gdbarch) m68kbsd_init_abi (info, gdbarch); > > tdep->struct_return = reg_struct_return; > + tdep->ptr_value_regnum = M68K_A0_REGNUM; > > tramp_frame_prepend_unwinder (gdbarch, &m68kobsd_sigtramp); > } > > -/* NetBSD ELF. */ > +/* OpenBSD and NetBSD ELF. */ > > static void > m68kbsd_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)