* [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call
@ 2006-03-01 17:27 Corinna Vinschen
2006-03-01 20:26 ` Michael Snyder
0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2006-03-01 17:27 UTC (permalink / raw)
To: gdb-patches
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call
2006-03-01 17:27 [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call Corinna Vinschen
@ 2006-03-01 20:26 ` Michael Snyder
2006-03-02 9:31 ` Corinna Vinschen
0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2006-03-01 20:26 UTC (permalink / raw)
To: gdb-patches
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;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call
2006-03-01 20:26 ` Michael Snyder
@ 2006-03-02 9:31 ` Corinna Vinschen
0 siblings, 0 replies; 3+ messages in thread
From: Corinna Vinschen @ 2006-03-02 9:31 UTC (permalink / raw)
To: gdb-patches
On Mar 1 12:26, Michael Snyder wrote:
> 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. ;-)
Thanks, applied.
> > * mn10300-tdep.c (mn10300_push_dummy_call): Write breakpoint
> > address to MDR register.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-02 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-01 17:27 [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call Corinna Vinschen
2006-03-01 20:26 ` Michael Snyder
2006-03-02 9:31 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox