[PATCH v2 4/4] board_f.c: Insure 16 alignment of start_addr_sp and reserved memory

Patrick DELAUNAY patrick.delaunay at st.com
Thu Jan 23 11:05:26 CET 2020


Hi Stephen,

> From: Stephen Warren <swarren at wwwdotorg.org>
> Sent: mercredi 22 janvier 2020 17:54
> 
> On 1/22/20 6:52 AM, Patrick Delaunay wrote:
> > Add a function reserve_sp() to reserved memory with 16 bits alignment
> > after the stack pointer (gd->start_addr_sp) and use this new function
> > in board_f.c to reserve all the memory area (malloc, board, gd, fdt,
> > bootstage, stacks).
> >
> > This 16 byte alignment is needed for cast on struct pointer for the
> > reserved memory, for example:
> > + x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
> > + ARMv8 Instruction Set Overview: quad word, 16 bytes
> >
> > An other alignment value could be needed for other architecture.
> 
> > diff --git a/common/board_f.c b/common/board_f.c
> 
> >
> > +/*
> > + * reserve after start_addr_sp the requested size and make the stack
> > +pointer
> > + * 16-byte aligned, this alignment is needed for cast on the reserved
> > +memory
> > + * ref = x86_64 ABI: https://reviews.llvm.org/D30049: 16 bytes
> > + *     = ARMv8 Instruction Set Overview: quad word, 16 bytes
> > + */
> > +static unsigned long reserve_sp(size_t size)
> 
> Bikeshed: Not sure this name is very description. Perhaps
> reserve_stack_aligned() would be better. Not a big deal though. Patches
> 1,4 look fine otherwise.

Yes and thanks, I will update the comment.
I am waiting few day for sending v3.

Patrick


More information about the U-Boot mailing list