From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3203 invoked by alias); 7 Mar 2006 19:34:48 -0000 Received: (qmail 3192 invoked by uid 22791); 7 Mar 2006 19:34:47 -0000 X-Spam-Check-By: sourceware.org Received: from intranet.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.6) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 07 Mar 2006 19:34:45 +0000 Received: (qmail 23355 invoked from network); 7 Mar 2006 19:34:43 -0000 Received: from unknown (HELO 81-178-176-36.dsl.pipex.com) (paul@127.0.0.2) by mail.codesourcery.com with ESMTPA; 7 Mar 2006 19:34:43 -0000 From: Paul Brook To: gdb-patches@sourceware.org Subject: [patch] Arm frame alignment Date: Tue, 07 Mar 2006 21:40:00 -0000 User-Agent: KMail/1.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200603071934.42376.paul@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00119.txt.bz2 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 * 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);