Support ARM64 architecture under Windows

This commit is contained in:
2024-05-09 20:05:49 +03:00
parent 6dacf9e1f1
commit d2d2297dc7
11 changed files with 154 additions and 36 deletions

View File

@@ -157,10 +157,14 @@ bool Win32Platform::Init()
CpuInfo.PageSize = siSysInfo.dwPageSize;
CpuInfo.ClockSpeed = ClockFrequency;
{
#ifdef _M_ARM64
CpuInfo.CacheLineSize = 128;
#else
int args[4];
__cpuid(args, 0x80000006);
CpuInfo.CacheLineSize = args[2] & 0xFF;
ASSERT(CpuInfo.CacheLineSize && Math::IsPowerOfTwo(CpuInfo.CacheLineSize));
#endif
}
// Setup unique device ID
@@ -226,10 +230,12 @@ void Win32Platform::MemoryBarrier()
{
_ReadWriteBarrier();
#if PLATFORM_64BITS
#ifdef _AMD64_
#if defined(_AMD64_)
__faststorefence();
#elif defined(_IA64_)
__mf();
#elif defined(_ARM64_)
__dmb(_ARM64_BARRIER_ISH);
#else
#error "Invalid platform."
#endif
@@ -243,7 +249,11 @@ void Win32Platform::MemoryBarrier()
void Win32Platform::Prefetch(void const* ptr)
{
#if _M_ARM64
__prefetch((char const*)ptr);
#else
_mm_prefetch((char const*)ptr, _MM_HINT_T0);
#endif
}
void* Win32Platform::Allocate(uint64 size, uint64 alignment)