add support for loongarch64 (#851)

This commit is contained in:
Wu Xiaotian
2022-04-18 15:12:30 +08:00
committed by GitHub
parent 047868e359
commit 6ea9991d84
17 changed files with 340 additions and 17 deletions

View File

@ -139,7 +139,7 @@ static __inline__ uint64_t rdtscp()
__asm__ __volatile__("rdtscp" : "=a"(rax), "=d"(rdx)::"%rcx");
return (rdx << 32) + rax;
}
#elif defined(__sw_64__)
#elif defined(__sw_64__) || defined(__loongarch64)
static __inline__ uint64_t rdtsc()
{
return (uint64_t)easy_time_now();
@ -163,7 +163,7 @@ static __inline__ uint64_t rdtsc()
#endif
#if defined(__x86_64__) || defined(__sw_64__)
#if defined(__x86_64__) || defined(__sw_64__) || defined(__loongarch64)
uint64_t get_cpufreq_khz()
{
char line[256];