Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Feb 2014 13:07:09 -0700
From:      Ian Lepore <ian@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: Malloc alignment in libstand / loader(8)
Message-ID:  <1391630829.1196.31.camel@revolution.hippie.lan>
In-Reply-To: <2882663.sRzekugaiD@ralph.baldwin.cx>
References:  <1391576134.1196.21.camel@revolution.hippie.lan> <2882663.sRzekugaiD@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2014-02-05 at 08:29 -0500, John Baldwin wrote:
> On Tuesday, February 04, 2014 09:55:34 PM Ian Lepore wrote:
> > On newer ARM chips, the device drivers used by loader(8) require that
> > I/O buffers be aligned on cache line sized boundaries.  The drivers are
> > part of u-boot which serves as a sort of load-time bios.
> > 
> > Attached is a patch that sets the malloc alignment in libstand to 64
> > bytes when compiled on ARM, and leaves it at 16 bytes for all other
> > platforms.  If there are no objections I'd like to commit this soon.
> > 
> > I've tested this on ARM, but have no way to test it on other platforms.
> > The changes should be a no-op on other platforms.
> 
> I think this looks fine, but perhaps use CTASSERT() instead of rolling your 
> own?  (I would say to use _Static_assert(), but I don't think that works with 
> our old GCC)
> 

I wasn't sure if it's a good idea to #include <systm.h> in the libstand
environment, since it has declarations for a lot of stuff.  I looked at
what's in systm.h and then hand-replicated what seemed like the most
generic of the choices.

-- Ian





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1391630829.1196.31.camel>