mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-04 15:53:44 +00:00
Acked-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Adrian Reber <areber@redhat.com>
29 lines
791 B
C
29 lines
791 B
C
#ifndef ZDTM_CPUID_H__
|
|
#define ZDTM_CPUID_H__
|
|
|
|
/*
|
|
* Adopted from linux kernel code.
|
|
*/
|
|
|
|
static inline void native_cpuid(unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
|
|
{
|
|
/* ecx is often an input as well as an output. */
|
|
asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "0"(*eax), "2"(*ecx) : "memory");
|
|
}
|
|
|
|
static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
|
|
{
|
|
*eax = op;
|
|
*ecx = 0;
|
|
native_cpuid(eax, ebx, ecx, edx);
|
|
}
|
|
|
|
static inline void cpuid_count(unsigned int op, unsigned int count, unsigned int *eax, unsigned int *ebx,
|
|
unsigned int *ecx, unsigned int *edx)
|
|
{
|
|
*eax = op;
|
|
*ecx = count;
|
|
native_cpuid(eax, ebx, ecx, edx);
|
|
}
|
|
|
|
#endif /* ZDTM_CPUID_H__ */
|