debug.c 674 B

123456789101112131415161718192021222324252627
  1. #include "debug.h"
  2. #include "interrupt.h"
  3. #include "../lib/kernel/print.h"
  4. // 打印文件名、行号、函数名、条件并使程序悬停
  5. void panic_spin(char *filename, int line, const char *func, const char *condition)
  6. {
  7. intr_disable(); // 关中断
  8. put_str("\n\n\n!!! error !!!\n");
  9. put_str("Kernel panic at :\n");
  10. put_str("filename: ");
  11. put_str(filename);
  12. put_str("\n");
  13. put_str("line: 0x");
  14. put_int(line);
  15. put_str("\n");
  16. put_str("function: ");
  17. put_str((char *)func);
  18. put_str("\n");
  19. put_str("condition: ");
  20. put_str((char *)condition);
  21. put_str("\n");
  22. put_str("Halting...\n");
  23. while (1)
  24. ;
  25. }