Hi Rémi,
On 10.03.2021 12:22, Rémi Bernon wrote:
Signed-off-by: Rémi Bernon rbernon@codeweavers.com
include/msvcrt/intrin.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/include/msvcrt/intrin.h b/include/msvcrt/intrin.h index 781c6fac823..061866fe63b 100644 --- a/include/msvcrt/intrin.h +++ b/include/msvcrt/intrin.h @@ -20,6 +20,36 @@ static inline void __cpuid(int info[4], int ax) { return __cpuidex(info, ax, 0); }
+#ifdef __i386 +static inline unsigned __int64 __rdtsc(void) +{
- unsigned __int64 a;
- __asm__ ("rdtsc" : "=A" (a));
- return a;
+}
+static inline unsigned __int64 __rdtscp(unsigned int *aux) +{
- unsigned __int64 a;
- __asm__ ("rdtscp" : "=A" (a), "=c" (*aux));
- return a;
+} +#elif defined __amd64 +static inline unsigned __int64 __rdtsc(void) +{
- unsigned __int64 a, d;
- __asm__ ("rdtsc" : "=a" (a), "=d" (d));
- return (d << 32) | a;
+}
+static inline unsigned __int64 __rdtscp(unsigned int *aux) +{
- unsigned __int64 a, d;
- __asm__ ("rdtscp" : "=a" (a), "=d" (d), "=c" (*aux));
- return (d << 32) | a;
+} +#endif #endif
I think you meant __i386__ and __x86_64__ for guards. If guards were right, you'd get a redefinition because __rdtsc is a compiler builtin. It seems to me that all we need for __rdtsc is to provide MSVC-style declaration in winnt.h, like it's done in WinSDK.
Thanks,
Jacek