kdbg.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* On-screen kernel debug output (no serial console needed).
  2. *
  3. * Draws straight into the linear framebuffer, bypassing the shadow buffer
  4. * and the window manager, so it still works when the WM is wedged. Used on
  5. * real hardware to debug e.g. keyboard/IRQ problems:
  6. *
  7. * - kdbg_status(): two counter lines in the bottom-left corner
  8. * - kdbg_pit_tick(): 0.5s heartbeat square (bottom-right) + periodic
  9. * status refresh, called from the PIT IRQ
  10. * - kdbg_panic(): red banner with exception info
  11. */
  12. #ifndef KDBG_H
  13. #define KDBG_H
  14. void kdbg_init(void);
  15. void kdbg_status(void);
  16. void kdbg_pit_tick(void);
  17. void kdbg_panic(const char *name, unsigned int eip, unsigned int cr2);
  18. /* Extra debug lines drawn above the status block (row 0 = lowest, at
  19. fb_h-31). Text is copied, so callers may pass stack buffers. Safe to
  20. call before kdbg_init(): the text is stored and drawn once the
  21. framebuffer is up. */
  22. void kdbg_info(unsigned int row, const char *s);
  23. /* Counters shared by the keyboard IRQ, the WM and the terminal. */
  24. extern volatile unsigned int kdbg_irq_count; /* IRQ1 entries */
  25. extern volatile unsigned int kdbg_irq_bytes; /* scancode bytes read */
  26. extern volatile unsigned int kdbg_irq_other; /* AUX/empty reads */
  27. extern volatile unsigned int kdbg_last_sc; /* last scancode read */
  28. extern volatile unsigned int kdbg_irq_masked; /* storm guard tripped */
  29. extern volatile unsigned int kdbg_wm_count; /* keys handled by the WM */
  30. extern volatile unsigned int kdbg_wm_last;
  31. extern volatile unsigned int kdbg_term_count; /* keys handled by terminal */
  32. extern volatile unsigned int kdbg_term_last;
  33. #endif