Files
rk35xx-android14/external/ltp/include/lapi/cpuid.h
T
hmz007 36ed224bac Rockchip Anroid14_SDK 20240628-rkr5 (2556df1a)
Signed-off-by: hmz007 <hmz007@gmail.com>
Change-Id: Ib87fdbe7a0be7dc961af3500fe9ea4589a127f9f
2024-10-29 18:12:02 +08:00

31 lines
770 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
#if !(defined(__i386__) || defined(__x86_64__))
# error "cpuid.h should only be included on x86"
#endif
#ifdef HAVE_CPUID_H
# include <cpuid.h>
#endif
#ifndef LAPI_CPUID_H__
#define LAPI_CPUID_H__
/*
* gcc cpuid.h provides __cpuid_count() since v4.4.
* Clang/LLVM cpuid.h provides __cpuid_count() since v3.4.0.
*
* Provide local define for tests needing __cpuid_count() because
* ltp needs to work in older environments that do not yet
* have __cpuid_count().
*/
#ifndef __cpuid_count
#define __cpuid_count(level, count, a, b, c, d) ({ \
__asm__ __volatile__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level), "2" (count)); \
})
#endif
#endif /* LAPI_CPUID_H__ */