Skip to content

Commit

Permalink
WIP: CHERI config
Browse files Browse the repository at this point in the history
  • Loading branch information
nwf committed Jul 31, 2019
1 parent eb78878 commit b152785
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ds/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ namespace snmalloc
return (static_cast<T>(1)) << shift;
}

#if defined(__mips__)
static constexpr size_t ADDRESS_BITS = 39;
#else
static constexpr size_t ADDRESS_BITS = is64() ? 48 : 32;
#endif

inline size_t clz(size_t x)
{
Expand Down
4 changes: 4 additions & 0 deletions src/mem/allocconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ namespace snmalloc
#endif

// Minimum allocation size is space for two pointers.
#ifdef __CHERI_PURE_CAPABILITY__
static constexpr size_t MIN_ALLOC_BITS = 5;
#else
static constexpr size_t MIN_ALLOC_BITS = bits::is64() ? 4 : 3;
#endif
static constexpr size_t MIN_ALLOC_SIZE = 1 << MIN_ALLOC_BITS;

// Slabs are 64 KiB unless constrained to 16 KiB.
Expand Down

0 comments on commit b152785

Please sign in to comment.