Code: Select all
static inline void write_msr(uint32_t msr_id, uint64_t msr_val) {
__asm__ __volatile__("wrmsr" :: "c"(msr_id), "A"(msr_val));
}
So I changed the function to this:
Code: Select all
static inline void write_msr(uint32_t msr_id, uint64_t msr_val) {
uint32_t edx = msr_val >> 32;
uint32_t eax = msr_val & 0xffffffff;
__asm__ __volatile__("wrmsr" :: "c"(msr_id), "d"(edx), "a"(eax));
}
PS. My OS is 64 bit, does it matters?