diff options
author | ian <ian@FreeBSD.org> | 2014-07-25 23:12:22 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2014-07-25 23:12:22 +0000 |
commit | d599f4ba1eb7534933e5371228b5883e9c2c5d9c (patch) | |
tree | c68518e63a02cb96596f0a0b192c6826ab42e17b /lib/libstand/zalloc.c | |
parent | 414a4cb93173e7abba9c0ff6950044c5254370d1 (diff) | |
download | FreeBSD-src-d599f4ba1eb7534933e5371228b5883e9c2c5d9c.zip FreeBSD-src-d599f4ba1eb7534933e5371228b5883e9c2c5d9c.tar.gz |
MFC r261530
Set the malloc alignment to 64 bytes on platforms that use the U-Boot API
device drivers. Recent versions of u-boot run with the MMU enabled, and
require DMA-based I/O to be aligned to cache line boundaries.
Diffstat (limited to 'lib/libstand/zalloc.c')
-rw-r--r-- | lib/libstand/zalloc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libstand/zalloc.c b/lib/libstand/zalloc.c index 41aef0d..4d1ec62 100644 --- a/lib/libstand/zalloc.c +++ b/lib/libstand/zalloc.c @@ -71,6 +71,15 @@ __FBSDID("$FreeBSD$"); #include "zalloc_defs.h" /* + * Objects in the pool must be aligned to at least the size of struct MemNode. + * They must also be aligned to MALLOCALIGN, which should normally be larger + * than the struct, so assert that to be so at compile time. + */ +typedef char assert_align[(sizeof(struct MemNode) <= MALLOCALIGN) ? 1 : -1]; + +#define MEMNODE_SIZE_MASK MALLOCALIGN_MASK + +/* * znalloc() - allocate memory (without zeroing) from pool. Call reclaim * and retry if appropriate, return NULL if unable to allocate * memory. |