mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 17:30:51 +02:00
wolfEntropy: Add ARM Generic Timer virtual counter as time src
This commit is contained in:
@@ -155,6 +155,20 @@ static WC_INLINE word64 Entropy_TimeHiRes(void)
|
||||
QueryPerformanceCounter(&count);
|
||||
return (word64)(count.QuadPart);
|
||||
}
|
||||
#elif !defined(ENTROPY_MEMUSE_THREAD) && defined(__arm__)
|
||||
/* Get time counter from arch_sys_counter clocksource.
|
||||
*
|
||||
* @return 64-bit timer count.
|
||||
*/
|
||||
static WC_INLINE word64 Entropy_TimeHiRes(void)
|
||||
{
|
||||
word32 lo, hi;
|
||||
__asm__ __volatile__ (
|
||||
"mrrc p15, 1, %[lo], %[hi], c14"
|
||||
: [lo] "=r"(lo), [hi] "=r"(hi)
|
||||
);
|
||||
return ((word64)hi << 32) | lo;
|
||||
}
|
||||
#elif defined(WOLFSSL_THREAD_NO_JOIN)
|
||||
|
||||
/* Start and stop thread that counts as a proxy for time counter. */
|
||||
|
||||
Reference in New Issue
Block a user