summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/eigccx86.h
diff options
context:
space:
mode:
author Couriersud <couriersud@users.noreply.github.com>2009-09-16 23:46:41 +0000
committer Couriersud <couriersud@users.noreply.github.com>2009-09-16 23:46:41 +0000
commit12977f2823f0d95bb9e7dabbea346888a888d00e (patch)
treeb674a2ce86ab438aafb6a003271ae5575c40250d /src/emu/eigccx86.h
parentc8402e45ef8374350f41a4ca3514ad9267ff9bde (diff)
"=A" inline assembly seems to be only supported on 32bit gcc. Provide a 64bit safe version of _get_profile_ticks
Diffstat (limited to 'src/emu/eigccx86.h')
-rw-r--r--src/emu/eigccx86.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/emu/eigccx86.h b/src/emu/eigccx86.h
index 2d9107c55d8..ae1b7951660 100644
--- a/src/emu/eigccx86.h
+++ b/src/emu/eigccx86.h
@@ -658,6 +658,8 @@ _atomic_decrement32(INT32 volatile *ptr)
-------------------------------------------------*/
#define get_profile_ticks _get_profile_ticks
+
+#ifndef __x86_64__
INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
{
UINT64 result;
@@ -667,5 +669,19 @@ INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
);
return (INT64) (result & U64(0x7fffffffffffffff));
}
+#else
+INLINE INT64 ATTR_UNUSED ATTR_FORCE_INLINE _get_profile_ticks(void)
+{
+ UINT64 result;
+ UINT32 r1, r2;
+ __asm__ __volatile__ (
+ "rdtsc"
+ : "=a" (r1), "=d" (r2)
+ );
+
+ result = ((UINT64)r2<<32) | (UINT64)r1;
+ return (INT64) (result & U64(0x7fffffffffffffff));
+}
+#endif
#endif /* __EIGCCX86__ */