[U-Boot] [PATCH] Align linebuf to avoid misaligned aliases of it

Mike Frysinger vapier at gentoo.org
Sat Aug 14 10:25:54 CEST 2010


On Sat, Aug 14, 2010 at 4:11 AM, Albert Aribaud wrote:
> Commit  64419e47518bbba059c80b77558f93ad4804145c aliases
> the uint16_t usp and uint32_t uip variables in print_buffer()
> to uint8_t variable linebuf without aligning it to an uint32_t
> address, thus causing data aborts on ARM when doing md.l on
> 32-bit wide area (and probably 16-bit wide as well).

hmm, i guess i overlooked that issue.  usually i'm pretty good at this
stuff.  sorry about that.

> Aligning linebuf fixes the issue.

i dont believe there are issues with gcc stack aligning for native
sizes ... just above that

>  int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen)
>  {
> -       uint8_t linebuf[MAX_LINE_LENGTH_BYTES + 1];
> +       uint8_t linebuf[MAX_LINE_LENGTH_BYTES + 1]
> +               __attribute__((__aligned__(sizeof(uint32_t))));

__aligned(sizeof(uint32_t))
-mike


More information about the U-Boot mailing list