From d7c4536c91ddd307fc9b99984ac49b5b5459b485 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 30 Nov 2015 22:08:58 +0100 Subject: Assignment 2, 3 --- CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c (limited to 'CamilStaps-s4498062-Assignment-2/ex2/hello-cr4.c') 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 +#include +#include + +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); + -- cgit v1.2.3