hw/x86: add cpuid register macro

Issue #3623
This commit is contained in:
Alexander Boettcher 2020-01-28 14:48:46 +01:00 committed by Norman Feske
parent 507a34b3d0
commit 44ace04b95

View File

@ -50,4 +50,22 @@
__VA_ARGS__; \
};
#define X86_64_CPUID_REGISTER(name, id, reg, ...) \
struct name : Genode::Register<64> \
{ \
static access_t read() \
{ \
Genode::uint32_t eax = id; \
Genode::uint32_t ebx = 0; \
Genode::uint32_t ecx = 0; \
Genode::uint32_t edx = 0; \
asm volatile ("cpuid" : "+a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)); \
return reg; \
} \
\
static void write(access_t const) { } \
\
__VA_ARGS__; \
};
#endif /* _SRC__LIB__HW__SPEC__X86_64__REGISTER_MACROS_H_ */