CheriBSD renamed VMEM SW perm bit

CheriBSD 00d71bd4d11af448871d196f987c2ded474f3039 changes
"CHERI_PERM_CHERIABI_VMMAP" to be spelled "CHERI_PERM_SW_VMEM" and deprecated
the old form.  Follow along with fallback so we can use older CheriBSDs.
This commit is contained in:
Nathaniel Wesley Filardo 2022-03-13 14:10:28 +00:00 коммит произвёл Nathaniel Wesley Filardo
Родитель 6424edaeaa
Коммит deac29c576
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -3,11 +3,14 @@
#if defined(__FreeBSD__) && !defined(_KERNEL)
# include "pal_bsd_aligned.h"
// On CHERI platforms, we need to know the value of CHERI_PERM_CHERIABI_VMMAP.
// On CHERI platforms, we need to know the value of CHERI_PERM_SW_VMEM.
// This pollutes the global namespace a little, sadly, but I think only with
// symbols that begin with CHERI_, which is as close to namespaces as C offers.
# if defined(__CHERI_PURE_CAPABILITY__)
# include <cheri/cherireg.h>
# if !defined(CHERI_PERM_SW_VMEM)
# define CHERI_PERM_SW_VMEM CHERI_PERM_CHERIABI_VMMAP
# endif
# endif
namespace snmalloc
@ -108,7 +111,7 @@ namespace snmalloc
/**
* On CheriBSD, exporting a pointer means stripping it of the authority to
* manage the address space it references by clearing the CHERIABI_VMMAP
* manage the address space it references by clearing the SW_VMEM
* permission bit.
*/
template<typename T, SNMALLOC_CONCEPT(capptr::ConceptBound) B>
@ -124,8 +127,7 @@ namespace snmalloc
}
return CapPtr<T, capptr::user_address_control_type<B>>(
__builtin_cheri_perms_and(
p.unsafe_ptr(),
~static_cast<unsigned int>(CHERI_PERM_CHERIABI_VMMAP)));
p.unsafe_ptr(), ~static_cast<unsigned int>(CHERI_PERM_SW_VMEM)));
}
# endif
};