0ad/source/lib/sysdep/amd64/amd64.cpp
janwas 04127c7af3 fixes/improvements to lib code from work
- topology.cpp: modify interface due to thread-safety issue. caller is
now responsible for ensuring the first _Detect call isn't reentered;
everything else is safe.
- fix thread-safety issue in wnuma; use winit mechanism to ensure it's
ready before use
- VFS now takes a cacheSize parameter (required for being able to
disable read-only file caches for the image loader at work)
- allow dynarray that isn't actually holding memory
- debug_stl: VC9 fix (disable this code except on the exact STL version
on which it was tested)
- zlib, lib_api: changes to macro used to toggle between static and
dynamic linking
- add boost filesystem header in external_libraries
- amd64: cpu_ topology functions are now provided by x86_x64
- cpu: remove cpu_ClockFrequency (dangerous, may be tempting to use
during WHRT init which would cause a crash). use x86_x64_ClockFrequency
or os_cpu_ClockFrequency instead.
- werrno: cope with newer boost versions
- wmman: follow SUSv3 in rejecting zero-length mappings

This was SVN commit r5954.
2008-05-13 19:43:02 +00:00

28 lines
635 B
C++

#include "precompiled.h"
#include "amd64.h"
#include "lib/sysdep/cpu.h"
#if MSC_VERSION
#include <intrin.h>
#endif
void* cpu_memcpy(void* RESTRICT dst, const void* RESTRICT src, size_t size)
{
return memcpy(dst, src, size);
}
#if MSC_VERSION
bool cpu_CAS(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue)
{
const uintptr_t initial = _InterlockedCompareExchange64((volatile __int64*)location, newValue, expected);
return initial == expected;
}
void cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment)
{
(void)_InterlockedExchangeAdd64(location, increment);
}
#endif