Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Arm frame alignment
@ 2006-03-07 21:40 Paul Brook
  2006-03-08 17:26 ` Richard Earnshaw
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Brook @ 2006-03-07 21:40 UTC (permalink / raw)
  To: gdb-patches

The patch below makes the Arm target code use the frame_align callback instead 
of aligning the stack in arm_push_dummy_call.

Tested with cross to arm-none-eabi.
Ok?

Paul

2006-03-07  Paul Brook  <paul@codesourcery.com>

	* arm-tdep.c (arm_push_dummy_call): Remove stack alignment.
	(arm_frame_align): New function.
	(arm_gdbarch_init): Use it.

Index: gdb/arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.205
diff -u -p -r1.205 arm-tdep.c
--- gdb/arm-tdep.c	15 Feb 2006 17:36:11 -0000	1.205
+++ gdb/arm-tdep.c	7 Mar 2006 19:33:02 -0000
@@ -1173,11 +1173,6 @@ arm_push_dummy_call (struct gdbarch *gdb
   argreg = ARM_A1_REGNUM;
   nstack = 0;
 
-  /* Some platforms require a double-word aligned stack.  Make sure sp
-     is correctly aligned before we start.  We always do this even if
-     it isn't really needed -- it can never hurt things.  */
-  sp &= ~(CORE_ADDR)(2 * DEPRECATED_REGISTER_SIZE - 1);
-
   /* The struct_return pointer occupies the first parameter
      passing register.  */
   if (struct_return)
@@ -1299,6 +1294,17 @@ arm_push_dummy_call (struct gdbarch *gdb
   return sp;
 }
 
+
+/* Always align the frame to an 8-byte boundary.  This is required on
+   some platforms and harmless on the rest.  */
+
+static CORE_ADDR
+arm_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
+{
+  /* Align the stack to eight bytes.  */
+  return sp & ~ (CORE_ADDR) 7;
+}
+
 static void
 print_fpu_flags (int flags)
 {
@@ -2738,6 +2744,7 @@ arm_gdbarch_init (struct gdbarch_info in
   tdep->jb_pc = -1;	/* Longjump support not enabled by default.  */
 
   set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call);
+  set_gdbarch_frame_align (gdbarch, arm_frame_align);
 
   set_gdbarch_write_pc (gdbarch, arm_write_pc);
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Arm frame alignment
  2006-03-07 21:40 [patch] Arm frame alignment Paul Brook
@ 2006-03-08 17:26 ` Richard Earnshaw
  2006-03-09  0:20   ` Paul Brook
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Earnshaw @ 2006-03-08 17:26 UTC (permalink / raw)
  To: Paul Brook; +Cc: gdb-patches

On Tue, 2006-03-07 at 19:34, Paul Brook wrote:
> The patch below makes the Arm target code use the frame_align callback instead 
> of aligning the stack in arm_push_dummy_call.
> 
> Tested with cross to arm-none-eabi.
> Ok?
> 
> Paul
> 
> 2006-03-07  Paul Brook  <paul@codesourcery.com>
> 
> 	* arm-tdep.c (arm_push_dummy_call): Remove stack alignment.
> 	(arm_frame_align): New function.
> 	(arm_gdbarch_init): Use it.

OK
R.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Arm frame alignment
  2006-03-08 17:26 ` Richard Earnshaw
@ 2006-03-09  0:20   ` Paul Brook
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Brook @ 2006-03-09  0:20 UTC (permalink / raw)
  To: gdb-patches

> > 2006-03-07  Paul Brook  <paul@codesourcery.com>
> >
> > 	* arm-tdep.c (arm_push_dummy_call): Remove stack alignment.
> > 	(arm_frame_align): New function.
> > 	(arm_gdbarch_init): Use it.

I've committed this patch to cvs.

Paul


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-08 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-07 21:40 [patch] Arm frame alignment Paul Brook
2006-03-08 17:26 ` Richard Earnshaw
2006-03-09  0:20   ` Paul Brook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox