Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
530 B
2
Indexable
#include <linux/module.h>
#include <linux/kernel.h>

static int __init my_module_init(void) {
    uint64_t cr3_value;

    // Read the CR3 register
    asm volatile (
        "movq %%cr3, %0"
        : "=r" (cr3_value)
    );

    pr_info("CR3 Register value: 0x%llx\n", cr3_value);

    return 0;
}

static void __exit my_module_exit(void) {
    // Cleanup code here
}

module_init(my_module_init);
module_exit(my_module_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Read CR3 Register Example");
MODULE_AUTHOR("Your Name");
Leave a Comment