From 9739cb46908ee021fd5028ab64ac8c2ebb3c7a6d Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 12 Oct 2024 03:03:35 -0400 Subject: [PATCH] use wrapper for calling memory_map_mte --- h_malloc.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/h_malloc.c b/h_malloc.c index 89ef91d..3ceb1d2 100644 --- a/h_malloc.c +++ b/h_malloc.c @@ -94,6 +94,15 @@ static inline bool is_memtag_enabled(void) { } #endif +static void *memory_map_tagged(size_t size) { +#ifdef HAS_ARM_MTE + if (likely51(is_memtag_enabled())) { + return memory_map_mte(size); + } +#endif + return memory_map(size); +} + #define SLAB_METADATA_COUNT struct slab_metadata { @@ -1242,15 +1251,7 @@ COLD static void init_slow_path(void) { if (unlikely(memory_protect_rw_metadata(ra->regions, ra->total * sizeof(struct region_metadata)))) { fatal_error("failed to unprotect memory for regions table"); } -#ifdef HAS_ARM_MTE - if (likely51(is_memtag_enabled())) { - ro.slab_region_start = memory_map_mte(slab_region_size); - } else { - ro.slab_region_start = memory_map(slab_region_size); - } -#else - ro.slab_region_start = memory_map(slab_region_size); -#endif + ro.slab_region_start = memory_map_tagged(slab_region_size); if (unlikely(ro.slab_region_start == NULL)) { fatal_error("failed to allocate slab region"); }