summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2007-02-27 23:12:45 +0000
committerKUDr <KUDr@openttd.org>2007-02-27 23:12:45 +0000
commita7d9cbc15107609324d7a21bd81295e29d23af1b (patch)
tree19b93e311b3e1bcb7a09dda5b4ecb03a841fabfa /src
parent1168c5beb3c92d814eee4242dd9eba76857c32d4 (diff)
downloadopenttd-a7d9cbc15107609324d7a21bd81295e29d23af1b.tar.xz
(svn r8933) -Fix [Win64]: rdtsc now uses intrinsic on VC8 (michi_cc)
Diffstat (limited to 'src')
-rw-r--r--src/os_timer.cpp8
-rw-r--r--src/win32.cpp5
-rw-r--r--src/win64.asm9
3 files changed, 10 insertions, 12 deletions
diff --git a/src/os_timer.cpp b/src/os_timer.cpp
index e2a96e8f9..ee70cbfb1 100644
--- a/src/os_timer.cpp
+++ b/src/os_timer.cpp
@@ -7,8 +7,12 @@
/* rdtsc for MSC_VER, uses simple inline assembly, or _rdtsc
* from external win64.asm because VS2005 does not support inline assembly */
#if defined(_MSC_VER) && !defined(RDTSC_AVAILABLE)
-# if defined (_M_AMD64)
-extern uint64 _rdtsc(void);
+# if _MSC_VER >= 1400
+#include <intrin.h>
+uint64 _rdtsc(void)
+{
+ return __rdtsc();
+}
# else
uint64 _declspec(naked) _rdtsc(void)
{
diff --git a/src/win32.cpp b/src/win32.cpp
index b59621aa6..396c38d82 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -606,10 +606,13 @@ static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
return EXCEPTION_EXECUTE_HANDLER;
}
+#ifdef _M_AMD64
+extern "C" void *_get_save_esp(void);
+#endif
+
static void Win32InitializeExceptions(void)
{
#ifdef _M_AMD64
- extern void *_get_save_esp(void);
_safe_esp = _get_save_esp();
#else
_asm {
diff --git a/src/win64.asm b/src/win64.asm
index 21bfebbde..577fc496b 100644
--- a/src/win64.asm
+++ b/src/win64.asm
@@ -5,13 +5,4 @@ _get_save_esp:
MOV RAX,RSP
RET
-PUBLIC _rdtsc
-_rdtsc:
- RDTSC
- MOV RCX,RDX
- SHL RCX,32
- AND RAX,0FFFFFFFFh
- OR RAX,RCX
- RET
-
END