All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Van Baren <vanbaren_gerald@si.com>
To: linuxppc-embedded@lists.linuxppc.org
Subject: Re: Initial stack frame
Date: Tue, 30 Jan 2001 10:27:20 -0500	[thread overview]
Message-ID: <4.3.2.20010130095138.00baf2a0@falcon.si.com> (raw)
In-Reply-To: <200101301446.f0UEkTO10556@denx.local.net>


At 03:46 PM 1/30/01 +0100, Wolfgang Denk wrote:

>In message <4.3.2.20010130074919.00bb0a80@falcon.si.com>
>Jerry Van Baren wrote:
> >
> > One of the differences between the ABI and EABI is that the EABI
> > requires 8 byte alignment of the stack and the ABI requires 16 byte
> > alignment (EABI, p.28).
>
>Yes, ok. But what is implemented by GCC and glibc? The SVR4 ABI or
>the EABI?
>
>In other words: Wolfgang Grandegger wants to know if  we  must  align
>"private" stack frames on 8 or 16 byte boundaries...
>
>Wolfgang Denk
>
>--
>Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
>Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
>Visit us at Embedded Systems: Feb 14-16 2001, Nuremberg, Halle 12/K01
>(with TQ Components); our presentation "Starke Zwerge: Embedded Linux
>auf PowerPC-Systemen" on Thursday, Feb 15 2001, 13:30 Forum Halle 11.

The stack frame alignment shouldn't matter as long as it doesn't matter
to the processor (there may be efficiency reasons to align to 16 bytes,
but there doesn't appear to be any operational problems aligning to 8
bytes -- I never knowingly misaligned to 4 bytes so I don't know if
that works).

The difference between 8 and 16 byte alignment is extra padding words
inside the stack frame.  Since C doesn't allow you to access a
function's variables from within a nested function (Pascal is the only
language I can think of that does this), nobody but the local function
should need to know where the variables are inside a given stack
frame.  Since that is the routine that put in the padding, it would
know where the the registers and variables are.  Well, on second
thought, the debugger (gdb) needs to know where the padding is in order
to display variables and parameters of the function, but that is
getting pretty deep into the system.  Stack back-tracing should use the
frame back chain, which is independent of the alignment padding.

The ABI/EABI doesn't specify where the padding should be put in the
frame, but it would logically go in the "Area for constructing
parameter lists for callees" portion of the frame.  The simplest thing
to do would be to compile some example functions and look at the
disassembled output, and then do the same thing -- my favorite method
of programming (plagiarism is a Good Thing in programming :-).

gvb


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

      parent reply	other threads:[~2001-01-30 15:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-27  1:29 Sandpoint 8240 or 7400 Roland Dreier
2001-01-27  1:59 ` Roland Dreier
2001-01-27  2:04 ` Dan Malek
2001-01-29 18:07   ` Roland Dreier
2001-01-29 19:33     ` Dan Malek
2001-01-30 23:55       ` Roland Dreier
     [not found]     ` <3A75DB0F.29DC7C96@bluewin.ch>
2001-01-30 13:26       ` Initial stack frame Jerry Van Baren
2001-01-30 14:46         ` Wolfgang Denk
2001-01-30 15:12           ` Kenneth Johansson
2001-01-30 15:27           ` Jerry Van Baren [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4.3.2.20010130095138.00baf2a0@falcon.si.com \
    --to=vanbaren_gerald@si.com \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.