This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]