mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-03 01:03:16 +00:00
Initial support for compiling on ARM64. (#788)
This commit is contained in:
parent
adfb3af95f
commit
411449cd51
12 changed files with 166 additions and 25 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "common/arch.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
@ -13,15 +15,20 @@ namespace Common {
|
|||
|
||||
#ifdef _MSC_VER
|
||||
__forceinline static u64 FencedRDTSC() {
|
||||
#ifdef ARCH_X86_64
|
||||
_mm_lfence();
|
||||
_ReadWriteBarrier();
|
||||
const u64 result = __rdtsc();
|
||||
_mm_lfence();
|
||||
_ReadWriteBarrier();
|
||||
return result;
|
||||
#else
|
||||
#error "Missing FencedRDTSC() implementation for target CPU architecture."
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
static inline u64 FencedRDTSC() {
|
||||
#ifdef ARCH_X86_64
|
||||
u64 eax;
|
||||
u64 edx;
|
||||
asm volatile("lfence\n\t"
|
||||
|
@ -29,6 +36,16 @@ static inline u64 FencedRDTSC() {
|
|||
"lfence\n\t"
|
||||
: "=a"(eax), "=d"(edx));
|
||||
return (edx << 32) | eax;
|
||||
#elif defined(ARCH_ARM64)
|
||||
u64 ret;
|
||||
asm volatile("isb\n\t"
|
||||
"mrs %0, cntvct_el0\n\t"
|
||||
"isb\n\t"
|
||||
: "=r"(ret)::"memory");
|
||||
return ret;
|
||||
#else
|
||||
#error "Missing FencedRDTSC() implementation for target CPU architecture."
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue