This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [rfa?] Add frame_align(); Was: ARM stack alignment on hand called functions
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Andrew Cagney <ac131313 at redhat dot com>
- Cc: Richard dot Earnshaw at arm dot com, Kris Warkentin <kewarken at qnx dot com>, gdb-patches at sources dot redhat dot com
- Date: Thu, 28 Nov 2002 16:49:42 +0000
- Subject: Re: [rfa?] Add frame_align(); Was: ARM stack alignment on hand called functions
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> >> >> +/* Ensure that the ARM's stack pointer has the correct alignment for a
> >> >> + new frame. */
> >> >> +static CORE_ADDR
> >> >> +arm_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
> >> >> +{
> >> >> + return (addr & -16);
> >> >> +}
> >
> >> >
> >> >
> >> > Yuck, two's complement assumption. I much prefer ~0xf in this case.
> >> >
> >> > But why so much. The maximum stack alignment you'll see on an ARM is 8
> >> > bytes.
> >
> >>
> >> The function was lifted from the PPC code. And, hey, what's a few extra
> >> bytes between friends? :-)
> >>
> >> Does (addr & 0x7) look better?
> >>
> >> Andrew
> >>
> >>
> >
> >
> > As discussed elsewhere, the best solution (IMO) is
> >
> > ~(CORE_ADDR)0x7
>
> You mean ~(ULONGEST)0x7?
>
>
I mean ~(typeof(addr)) 0x7.
R.