Created
September 24, 2018 16:14
-
-
Save morimolymoly/f4724eb95e32e68148977bd8cf790f3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <linux/module.h> | |
static inline uint64_t exec_rdmsr(uint64_t msr) | |
{ | |
uint32_t low, high; | |
asm volatile ( | |
"rdmsr" | |
: "=a"(low), "=d"(high) | |
: "c"(msr) | |
); | |
return ((uint64_t)high << 32) | low; | |
} | |
static int mymodule_init(void) | |
{ | |
uint64_t res = exec_rdmsr(0xc0000082U); | |
printk(KERN_INFO "MOLY: MSR_IA32_LSTAR: %llx\n", res); | |
return 0; | |
} | |
static void mymodule_exit(void) | |
{ | |
} | |
module_init(mymodule_init); | |
module_exit(mymodule_exit); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment