kdebug_32.h 2.0 KB

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