Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#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
You can’t perform that action at this time.