/* SPDX-License-Identifier: GPL-2.0 */1#ifndef PERF_CPUID_H2#define PERF_CPUID_H 1345static inline void6cpuid(unsigned int op, unsigned int op2, unsigned int *a, unsigned int *b,7unsigned int *c, unsigned int *d)8{9/*10* Preserve %ebx/%rbx register by either placing it in %rdi or saving it11* on the stack - x86-64 needs to avoid the stack red zone. In PIC12* compilations %ebx contains the address of the global offset13* table. %rbx is occasionally used to address stack variables in14* presence of dynamic allocas.15*/16asm(17#if defined(__x86_64__)18"mov %%rbx, %%rdi\n"19"cpuid\n"20"xchg %%rdi, %%rbx\n"21#else22"pushl %%ebx\n"23"cpuid\n"24"movl %%ebx, %%edi\n"25"popl %%ebx\n"26#endif27: "=a"(*a), "=D"(*b), "=c"(*c), "=d"(*d)28: "a"(op), "2"(op2));29}3031void get_cpuid_0(char *vendor, unsigned int *lvl);3233#endif343536