From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sourceware.org
Subject: [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call
Date: Wed, 01 Mar 2006 17:27:00 -0000 [thread overview]
Message-ID: <20060301172752.GV3184@calimero.vinschen.de> (raw)
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?
Corinna
* 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;
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
next reply other threads:[~2006-03-01 17:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-01 17:27 Corinna Vinschen [this message]
2006-03-01 20:26 ` Michael Snyder
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=20060301172752.GV3184@calimero.vinschen.de \
--to=vinschen@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