dipto181

indv_module

Feb 25th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <linux/module.h> /* Needed by all modules */
  2. #include <linux/kernel.h> /* Needed for KERN_INFO */
  3. #include <linux/init.h> /* Needed for the macros */
  4.  
  5. int new_wbinvd(void){
  6. asm volatile ("wbinvd" : : : "memory");
  7. return 0;
  8. }
  9.  
  10.  
  11. int new_invd(void){
  12. asm volatile ("invd" : : : "memory");
  13. return 0;
  14. }
  15.  
  16. static int __init hello_start(void)
  17. {
  18. printk(KERN_INFO "Loading hello module...\n");
  19.  
  20. //check if invd instruction executes
  21. printk(KERN_INFO "running wbinvd\n", new_wbinvd());
  22. printk(KERN_INFO "running invd\n", new_invd());
  23.  
  24. return 0;
  25. }
  26.  
  27. static void __exit hello_end(void)
  28. {
  29. printk(KERN_INFO "Goodbye\n");
  30. }
  31.  
  32. module_init(hello_start);
  33. module_exit(hello_end);
Advertisement
Add Comment
Please, Sign In to add comment