kdebug_32.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * kdebug.h: Defines and definitions for debugging the Linux kernel
  3. * under various kernel debuggers.
  4. *
  5. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  6. */
  7. #ifndef _SPARC_KDEBUG_H
  8. #define _SPARC_KDEBUG_H
  9. #include <asm/openprom.h>
  10. #include <asm/vaddrs.h>
  11. /* Breakpoints are enter through trap table entry 126. So in sparc assembly
  12. * if you want to drop into the debugger you do:
  13. *
  14. * t DEBUG_BP_TRAP
  15. */
  16. #define DEBUG_BP_TRAP 126
  17. #ifndef __ASSEMBLY__
  18. /* The debug vector is passed in %o1 at boot time. It is a pointer to
  19. * a structure in the debuggers address space. Here is its format.
  20. */
  21. typedef unsigned int (*debugger_funct)(void);
  22. struct kernel_debug {
  23. /* First the entry point into the debugger. You jump here
  24. * to give control over to the debugger.
  25. */
  26. unsigned long kdebug_entry;
  27. unsigned long kdebug_trapme; /* Figure out later... */
  28. /* The following is the number of pages that the debugger has
  29. * taken from to total pool.
  30. */
  31. unsigned long *kdebug_stolen_pages;
  32. /* Ok, after you remap yourself and/or change the trap table
  33. * from what you were left with at boot time you have to call
  34. * this synchronization function so the debugger can check out
  35. * what you have done.
  36. */
  37. debugger_funct teach_debugger;
  38. }; /* I think that is it... */
  39. extern struct kernel_debug *linux_dbvec;
  40. /* Use this macro in C-code to enter the debugger. */
  41. static inline void sp_enter_debugger(void)
  42. {
  43. __asm__ __volatile__("jmpl %0, %%o7\n\t"
  44. "nop\n\t" : :
  45. "r" (linux_dbvec) : "o7", "memory");
  46. }
  47. #define SP_ENTER_DEBUGGER do { \
  48. if((linux_dbvec!=0) && ((*(short *)linux_dbvec)!=-1)) \
  49. sp_enter_debugger(); \
  50. } while(0)
  51. enum die_val {
  52. DIE_UNUSED,
  53. DIE_OOPS,
  54. };
  55. #endif /* !(__ASSEMBLY__) */
  56. /* Some nice offset defines for assembler code. */
  57. #define KDEBUG_ENTRY_OFF 0x0
  58. #define KDEBUG_DUNNO_OFF 0x4
  59. #define KDEBUG_DUNNO2_OFF 0x8
  60. #define KDEBUG_TEACH_OFF 0xc
  61. #endif /* !(_SPARC_KDEBUG_H) */