Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@redhat.com>
To: gdb-patches@sourceware.org
Subject: Re: [RFA] mn10300-tdep.c: Always write return address to MDR register  on push_dummy_call
Date: Wed, 01 Mar 2006 20:26:00 -0000	[thread overview]
Message-ID: <4406037A.6020307@redhat.com> (raw)
In-Reply-To: <20060301172752.GV3184@calimero.vinschen.de>

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;
> 
> 


  reply	other threads:[~2006-03-01 20:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-01 17:27 Corinna Vinschen
2006-03-01 20:26 ` Michael Snyder [this message]
2006-03-02  9:31   ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4406037A.6020307@redhat.com \
    --to=msnyder@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox