#pragma once #include #define IA32_EFER_MSR 0xC0000080 struct MSR { void write(uint64_t value); uint64_t read(); MSR(uint32_t msr_num); static void write_to(uint32_t msr_num, uint64_t value); static uint64_t read_from(uint32_t msr_num); static void with_value_of(uint32_t msr_num, void (*callback)(uint64_t&)); void with_value(void (*callback)(uint64_t&)); private: uint32_t m_msr_num; };