From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13625 invoked by alias); 1 Mar 2006 20:26:45 -0000 Received: (qmail 13615 invoked by uid 22791); 1 Mar 2006 20:26:45 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Mar 2006 20:26:44 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k21KQgJb013548 for ; Wed, 1 Mar 2006 15:26:42 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k21KQa118738 for ; Wed, 1 Mar 2006 15:26:37 -0500 Received: from [172.16.24.50] (bluegiant.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id k21KQZKt017747 for ; Wed, 1 Mar 2006 15:26:35 -0500 Message-ID: <4406037A.6020307@redhat.com> Date: Wed, 01 Mar 2006 20:26:00 -0000 From: Michael Snyder User-Agent: Mozilla Thunderbird 1.0.7-1.4.1 (X11/20050929) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: Re: [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call References: <20060301172752.GV3184@calimero.vinschen.de> In-Reply-To: <20060301172752.GV3184@calimero.vinschen.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00018.txt.bz2 Corinna Vinschen wrote: > Hi, > > the mn10300 hardware always writes the return address to the stack and > into the MDR register when any "call" machine instruction is executed. > The mn10300_push_dummy_call function does only write the return address > to the stack, which might result into problems when leaf functions are > called and the MDR register is known not to be clobbered by "mul" or > "div" instructions. The below patch also writes the return address > always into the MDR register, like the hardware. > > Ok to apply? Ha, yes, nice catch. ;-) > * mn10300-tdep.c (mn10300_push_dummy_call): Write breakpoint > address to MDR register. > > > Index: mn10300-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v > retrieving revision 1.136 > diff -u -p -r1.136 mn10300-tdep.c > --- mn10300-tdep.c 28 Feb 2006 22:28:21 -0000 1.136 > +++ mn10300-tdep.c 1 Mar 2006 17:23:05 -0000 > @@ -1055,6 +1055,11 @@ mn10300_push_dummy_call (struct gdbarch > /* Push the return address that contains the magic breakpoint. */ > sp -= 4; > write_memory_unsigned_integer (sp, push_size, bp_addr); > + > + /* The CPU also writes the return address always into the > + MDR register on "call". */ > + regcache_cooked_write_unsigned (regcache, E_MDR_REGNUM, bp_addr); > + > /* Update $sp. */ > regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp); > return sp; > >