31 lines
702 B
C++
31 lines
702 B
C++
/***
|
|
Copyright (C) 2024 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Clocks.aarch64.cpp
|
|
Date: 2024-01-02
|
|
Author: Reece
|
|
***/
|
|
#include <Source/RuntimeInternal.hpp>
|
|
|
|
AUKN_SYM AuUInt64 ArmQueryClockCounter()
|
|
{
|
|
AuUInt64 uValue {};
|
|
#if defined(AURORA_COMPILER_MSVC)
|
|
uValue = _ReadStatusReg(CNTVCT_EL0);
|
|
#else
|
|
asm volatile ("mrs %0, CNTVCT_EL0; isb; " : "=r" (uValue));
|
|
#endif
|
|
return uValue;
|
|
}
|
|
|
|
AUKN_SYM AuUInt64 ArmQueryClockFrequency()
|
|
{
|
|
AuUInt64 uClockFreq {};
|
|
#if defined(defined(AURORA_COMPILER_MSVC))
|
|
uClockFreq = _ReadStatusReg(CNTFRQ_EL0);
|
|
#else
|
|
asm volatile ("mrs %0, CNTFRQ_EL0; isb; " : "=r" (uClockFreq));
|
|
#endif
|
|
return uClockFreq;
|
|
}
|