panic.c 748 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. It will happen eventually, so you might as well learn do deal with it.
  3. TODO: how to scroll up to see full trace? Shift + Page Up does not work as it normally does:
  4. https://superuser.com/questions/848412/scrolling-up-the-failed-screen-with-kernel-panic
  5. The alternative is to get the serial data out streamed to console or to a file:
  6. - https://superuser.com/questions/269228/write-qemu-booting-virtual-machine-output-to-a-file
  7. - http://www.reactos.org/wiki/QEMU#Redirect_to_a_file
  8. */
  9. #include <linux/module.h>
  10. #include <linux/kernel.h>
  11. static int myinit(void)
  12. {
  13. printk(KERN_INFO "panic init\n");
  14. panic("hello panic");
  15. return 0;
  16. }
  17. static void myexit(void)
  18. {
  19. printk(KERN_INFO "panic cleanup\n");
  20. }
  21. module_init(myinit)
  22. module_exit(myexit)