diff options
author | Camil Staps | 2015-11-30 22:08:58 +0100 |
---|---|---|
committer | Camil Staps | 2015-11-30 22:08:58 +0100 |
commit | d7c4536c91ddd307fc9b99984ac49b5b5459b485 (patch) | |
tree | 135749c25cda6177b7712ae425d9559b625f20e0 /CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c | |
parent | Initial commit (diff) |
Assignment 2, 3
Diffstat (limited to 'CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c')
-rw-r--r-- | CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c b/CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c new file mode 100644 index 0000000..9db671d --- /dev/null +++ b/CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c @@ -0,0 +1,22 @@ +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Camil Staps"); +MODULE_DESCRIPTION("A Simple Hello World module"); + +static int __init hello_init(void) { + unsigned long long result; + __asm__("movq %%cr4, %%rax\n" : "=a"(result)); + printk(KERN_INFO "Hello world! CR4 = %11x\n", result); + return 0; +} + +static void __exit hello_cleanup(void) { + printk(KERN_INFO "Cleaning up module.\n"); +} + +module_init(hello_init); +module_exit(hello_cleanup); + |