Skip to content

Commit

Permalink
aal::aal_arm implements tick for apple 64 bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Sep 25, 2022
1 parent a060462 commit cf22196
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/snmalloc/aal/aal_arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ namespace snmalloc
/**
* Bitmap of AalFeature flags
*/
static constexpr uint64_t aal_features =
IntegerPointers | NoCpuCycleCounters;
static constexpr uint64_t aal_features = IntegerPointers
#if defined(SNMALLOC_VA_BITS_32) || !defined(__APPLE__)
| NoCpuCycleCounters
#endif
;

static constexpr enum AalName aal_name = ARM;

Expand Down Expand Up @@ -56,6 +59,15 @@ namespace snmalloc
__asm__ volatile("pld\t[%0]" : "=r"(ptr));
#endif
}

#if defined(SNMALLOC_VA_BITS_64) && defined(__APPLE__)
static inline uint64_t tick() noexcept
{
uint64_t t;
__asm__ volatile("mrs %0, cntvct_el0" : "=r"(t));
return t;
}
#endif
};

using AAL_Arch = AAL_arm;
Expand Down

0 comments on commit cf22196

Please sign in to comment.