_mach_continuous_hwclock(uint64_t *cont_time __unused)
{
#if defined(__arm64__)
+#define ISB_SY 0xf
uint8_t cont_hwclock = *((uint8_t*)_COMM_PAGE_CONT_HWCLOCK);
- uint64_t timebase;
if (cont_hwclock) {
- __asm__ volatile ("isb\n" "mrs %0, CNTPCT_EL0" : "=r"(timebase));
- *cont_time = timebase;
+ volatile uint64_t *base_ptr = (volatile uint64_t*)_COMM_PAGE_CONT_HW_TIMEBASE;
+ __builtin_arm_isb(ISB_SY);
+ *cont_time = __builtin_arm_rsr64("CNTVCT_EL0") + *base_ptr;
return KERN_SUCCESS;
}
#endif