home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / UNIX3862.ZIP / U386-06.ZIP / U386-6.TD0 / usr / include / sys / debugreg.h < prev    next >
Encoding:
Text File  |  1988-06-26  |  2.8 KB  |  65 lines

  1. /*    Copyright (c) 1984, 1986, 1987, 1988 AT&T    */
  2. /*      All Rights Reserved      */
  3.  
  4. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T    */
  5. /*    The copyright notice above does not evidence any       */
  6. /*    actual or intended publication of such source code.    */
  7.  
  8.  
  9. #ident    "@(#)head.sys:debugreg.h    1.3"
  10.  
  11. /*
  12. ** Specify masks for accessing the i386 debug registers.
  13. */
  14.  
  15. /*
  16. ** The debug registers are found in an array (debugreg) in the u block.
  17. ** On the i386, there are 4 registers to specify linear addresses.
  18. ** dr4 and dr5 are reserved.
  19. */
  20. #define DR_FIRSTADDR 0  /* u.u_debugreg[DR_FIRSTADDR] */
  21. #define DR_LASTADDR 3   /* u.u_debugreg[DR_LASTADDR]  */
  22.  
  23. /*
  24. ** The debug status is found in dr6 after a debug trap.
  25. */
  26. #define DR_STATUS 6           /* u.u_debugreg[DR_STATUS]     */
  27. #define DR_TRAP0 0x1          /* Trap from debug register #0 */
  28. #define DR_TRAP1 0x2          /* Trap from debug register #1 */
  29. #define DR_TRAP2 0x4          /* Trap from debug register #2 */
  30. #define DR_TRAP3 0x8          /* Trap from debug register #3 */
  31. #define DR_ICEALSO   0x2000   /* Flag bit reserved for the in-circuit-emulator*/
  32. #define DR_SINGLESTEP 0x4000  /* Trap resulting from the single-step flag */
  33. #define DR_TASKSWITCH 0x8000  /* Trap resulting from a task-switch */
  34.  
  35. /*
  36. ** dr7 controls the rest of the debug registers.
  37. ** use shifts and masks because arrays of fields tend to get aligned.
  38. ** For example,
  39. **    dr7 & DR_LOCAL_ENABLE_MASK
  40. **    dr7 >> (DR_LOCAL_ENABLE_SHIFT + r# * DR_ENABLE_SIZE) & 0x1
  41. **    dr7 >> (DR_CONTROL_SHIFT + r# * DR_CONTROL_SIZE) & DR_RW_MASK
  42. ** Note that the GLOBAL bits below and always turned off by the kernel.
  43. */
  44. #define DR_CONTROL 7               /* u.u_debugreg[DR_CONTROL] */
  45. #define DR_LOCAL_ENABLE_MASK 0x55  /* Enable all 4 regs for ldt addresses   */
  46. #define DR_GLOBAL_ENABLE_MASK 0xAA /* Enable all 4 regs for gdt addresses   */
  47. #define DR_CONTROL_RESERVED 0xFC00 /* Bits reserved by Intel                */
  48. #define DR_LOCAL_SLOWDOWN 0x100    /* Slow the pipeline for ldt addresses   */
  49. #define DR_GLOBAL_SLOWDOWN 0x200   /* Slow the pipeline for gdt addresses   */
  50.  
  51. #define DR_LOCAL_ENABLE_SHIFT 0    /* Additional shift to the local enable  */
  52. #define DR_GLOBAL_ENABLE_SHIFT 1   /* Additional shift to the global enable */
  53. #define DR_ENABLE_SIZE 2           /* There are 2 enable bits per register  */
  54.  
  55. #define DR_CONTROL_SHIFT 16        /* Shift to get to register control bits */
  56. #define DR_CONTROL_SIZE 4          /* There are 4 control bits per register */
  57. #define DR_RW_MASK 0x3             /* Two of these bits specify r/w access  */
  58. #define DR_RW_EXECUTE 0x0          /* Settings for the read/write mask      */
  59. #define DR_RW_WRITE 0x1
  60. #define DR_RW_READ 0x3
  61. #define DR_LEN_MASK 0xC            /* Two of these bits specify data length */
  62. #define DR_LEN_1 0x0               /* Settings for data length              */
  63. #define DR_LEN_2 0x4
  64. #define DR_LEN_4 0xC
  65.