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:
commit
a7d14afb61
2 changed files with 8 additions and 17 deletions
|
@ -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,19 +174,16 @@ 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"
|
||||||
);
|
);
|
||||||
|
# else
|
||||||
|
low_part = 0;
|
||||||
|
hi_part = 0;
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# ifdef COMPILER_MICROSOFT
|
# ifdef COMPILER_MICROSOFT
|
||||||
|
@ -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"
|
||||||
|
|
|
@ -62,8 +62,7 @@
|
||||||
#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
|
||||||
|
|
Loading…
Reference in a new issue