0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +08:00

Merge pull request #4299 from nsait-linaro/enable_woa64

Get cycle count from ARM64 PMCCNTR_EL0 register
This commit is contained in:
Luca Boccassi 2021-11-15 12:56:22 +00:00 committed by GitHub
commit 2375ca8b26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

15
RELICENSE/niyassait.md Normal file
View File

@ -0,0 +1,15 @@
# Permission to Relicense under MPLv2 or any other OSI approved license chosen by the current ZeroMQ BDFL
This is a statement by Niyas SAIT
that grants permission to relicense its copyrights in the libzmq C++
library (ZeroMQ) under the Mozilla Public License v2 (MPLv2) or any other
Open Source Initiative approved license chosen by the current ZeroMQ
BDFL (Benevolent Dictator for Life).
A portion of the commits made by the Github handle "nsait-linaro", with
commit author "Niyas SAIT", are copyright of Niyas SAIT .
This document hereby grants the libzmq project team to relicense libzmq,
including all past, present and future contributions of the author listed above.
Niyas SAIT (nsait-linaro)
Done in Cambridge, UK on the 2021/11/15

View File

@ -244,11 +244,12 @@ uint64_t zmq::clock_t::rdtsc ()
#elif defined(_MSC_VER) && defined(_M_ARM) // NC => added for windows ARM
return __rdpmccntr64 ();
#elif defined(_MSC_VER) && defined(_M_ARM64) // NC => added for windows ARM64
//return __rdpmccntr64 ();
//return __rdtscp (nullptr);
// todo: find proper implementation for ARM64
static uint64_t snCounter = 0;
return ++snCounter;
const int64_t pmccntr_el0 = (((3 & 1) << 14) | // op0
((3 & 7) << 11) | // op1
((9 & 15) << 7) | // crn
((13 & 15) << 3) | // crm
((0 & 7) << 0)); // op2
return _ReadStatusReg (pmccntr_el0);
#elif (defined __GNUC__ && (defined __i386__ || defined __x86_64__))
uint32_t low, high;
__asm__ volatile("rdtsc" : "=a"(low), "=d"(high));