|
Message
From: Jeremy Bennett<jeremy.bennett@e...>
Date: Tue Jul 29 14:15:49 CEST 2008
Subject: [openrisc] Stack frame alignment on OpenRISC 1000
The Application Binary Interface (ABI) for the OR1000 specifies that all stack frames are double word aligned (section 16.2.2):
"The stack pointer always points to the end of the latest allocated stack frame. All frames must be double word aligned. In code compiled for 32-bit implementations, upper halves of all double words are zero."
I've just been working on some code compiled with GCC 3.4.4, and notice that the main function is compiled as:
<main>: l.addi r1,r1,-20 <main+4>: l.sw 4(r1),r2 <main+8>: l.addi r2,r1,20 <main+12>: l.sw 0(r1),r9
r1 is the stack pointer, r2 the frame pointer, so this is a stack frame of size 20 bytes, which is word-aligned, but not double-word aligned.
I can see no reason why the stack needs to be anything more than single word aligned. Using double word just wastes stack space.
Can anyone shed more light on this issue. For now I'll assume the documentation is in error (it affects the port of GDB 6.8).
Thanks,
Jeremy
-- Tel: +44 (1202) 416955 Cell: +44 (7970) 676050 SkypeID: jeremybennett Email: jeremy.bennett@e... Web: www.embecosm.com
|
 |