diff --git a/repos/base-hw/src/include/hw/spec/x86_64/register_macros.h b/repos/base-hw/src/include/hw/spec/x86_64/register_macros.h index 15eec2296..ba93e85be 100644 --- a/repos/base-hw/src/include/hw/spec/x86_64/register_macros.h +++ b/repos/base-hw/src/include/hw/spec/x86_64/register_macros.h @@ -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_ */