1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2025-01-23 20:06:41 +00:00

Merge pull request #132 from enzo1982/arch

Fix compilation on non-x86/ARM architectures.
This commit is contained in:
Veselin Georgiev 2019-10-29 22:07:32 +02:00 committed by GitHub
commit a7d14afb61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 17 deletions

View file

@ -70,8 +70,6 @@ int cpuid_exists_by_eflags(void)
# else # else
return 0; return 0;
# endif /* COMPILER_MICROSOFT */ # endif /* COMPILER_MICROSOFT */
#elif defined(PLATFORM_ARM)
return 0;
#else #else
return 0; return 0;
#endif /* PLATFORM_X86 */ #endif /* PLATFORM_X86 */
@ -137,7 +135,6 @@ void exec_cpuid(uint32_t *regs)
:"m"(regs) :"m"(regs)
:"memory", "eax", "edi" :"memory", "eax", "edi"
); );
# elif defined(PLATFORM_ARM)
# endif /* COMPILER_GCC */ # endif /* COMPILER_GCC */
#else #else
# ifdef COMPILER_MICROSOFT # ifdef COMPILER_MICROSOFT
@ -177,20 +174,17 @@ void cpu_rdtsc(uint64_t* result)
{ {
uint32_t low_part, hi_part; uint32_t low_part, hi_part;
#if defined(COMPILER_GCC) || defined(COMPILER_CLANG) #if defined(COMPILER_GCC) || defined(COMPILER_CLANG)
#ifdef PLATFORM_ARM # if defined(PLATFORM_X86) || defined(PLATFORM_X64)
low_part = 0;
hi_part = 0;
#elif defined(PLATFORM_AARCH64)
low_part = 0;
hi_part = 0;
#else
__asm __volatile ( __asm __volatile (
" rdtsc\n" " rdtsc\n"
" mov %%eax, %0\n" " mov %%eax, %0\n"
" mov %%edx, %1\n" " mov %%edx, %1\n"
:"=m"(low_part), "=m"(hi_part)::"memory", "eax", "edx" :"=m"(low_part), "=m"(hi_part)::"memory", "eax", "edx"
); );
#endif # else
low_part = 0;
hi_part = 0;
# endif
#else #else
# ifdef COMPILER_MICROSOFT # ifdef COMPILER_MICROSOFT
__asm { __asm {
@ -215,9 +209,7 @@ void busy_sse_loop(int cycles)
#else #else
# define XALIGN ".align 4\n" # define XALIGN ".align 4\n"
#endif #endif
#ifdef PLATFORM_ARM #if defined(PLATFORM_X86) || defined(PLATFORM_X64)
#elif defined(PLATFORM_AARCH64)
#else
__asm __volatile ( __asm __volatile (
" xorps %%xmm0, %%xmm0\n" " xorps %%xmm0, %%xmm0\n"
" xorps %%xmm1, %%xmm1\n" " xorps %%xmm1, %%xmm1\n"

View file

@ -62,9 +62,8 @@
#endif #endif
/* Under Windows/AMD64 with MSVC, inline assembly isn't supported */ /* Under Windows/AMD64 with MSVC, inline assembly isn't supported */
#if (((defined(COMPILER_GCC) || defined(COMPILER_CLANG))) && \ #if (defined(COMPILER_GCC) || defined(COMPILER_CLANG)) || \
(defined(PLATFORM_X64) || defined(PLATFORM_X86) || defined(PLATFORM_ARM) || defined(PLATFORM_AARCH64))) || \ (defined(COMPILER_MICROSOFT) && defined(PLATFORM_X86))
(defined(COMPILER_MICROSOFT) && defined(PLATFORM_X86))
# define INLINE_ASM_SUPPORTED # define INLINE_ASM_SUPPORTED
#endif #endif