From 6f79ddee31b3f50ba4ebef22b35a46fed4ee717d Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Thu, 12 Aug 2021 11:59:27 +0100 Subject: [PATCH] FreeBSD RISC platforms have fewer address bits --- src/pal/pal_freebsd.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pal/pal_freebsd.h b/src/pal/pal_freebsd.h index 13d74ae..6248f7c 100644 --- a/src/pal/pal_freebsd.h +++ b/src/pal/pal_freebsd.h @@ -24,6 +24,17 @@ namespace snmalloc * add new features that they should add any required feature flags. */ static constexpr uint64_t pal_features = PALBSD_Aligned::pal_features; + + /** + * FreeBSD uses atypically small address spaces on its 64 bit RISC machines. + * Problematically, these are so small that if we used the default + * address_bits (48), we'd try to allocate the whole AS (or larger!) for the + * Pagemap itself! + */ + static constexpr size_t address_bits = (Aal::bits == 32) ? + Aal::address_bits : + (Aal::aal_name == RISCV ? 38 : Aal::address_bits); + // TODO, if we ever backport to MIPS, this should yield 39 there. }; } // namespace snmalloc #endif