home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / debugreg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.1 KB  |  71 lines

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