Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 27 Apr 2014 14:00:32 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Bare metal progress and an oddity.

On Sun, Apr 27, 2014 at 12:37:13PM -0500, Richard Pennington wrote:
> As part of my quixotic quest to run musl on ARM bare metal I've
> started to handle interrupts and an ARM timer to implement the
> clock_* functions to prepare for pre-emptive scheduling of
> pthread_create'd threads. The current sources are here:
> http://ellcc.org/viewvc/svn/ellcc/trunk/baremetal/arm/
> 
> An oddity: If I use printf() to print out values in an interrupt
> handler it sort of works. The format string prints perfectly, but it
> seems that the va_arg values are getting messed up. The stack is
> large enough, fp and sp are sane. Am I missing something in
> pop_arg() that is causing this? Come to think of it, do I have to
> insure a certain stack alignment, for example? Most of the messed up
> values are "long long".
> 
> Any thoughts appreciated.

Yes, ARM EABI requires the stack to be aligned to at least an 8-byte
boundary (maybe 16 but I think 8 is all that's required). If your
stack is only aligned to 4 bytes, this will mess things up badly.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.