Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation. All Rights Reserved.
  3. Module Name:
  4. rtexcept.h
  5. Abstract:
  6. This header contains defines, globals, and function prototypes related to
  7. the realtime executive interrupt descriptor tables and exception handlers.
  8. Author:
  9. Joseph Ballantyne
  10. Environment:
  11. Kernel Mode
  12. Revision History:
  13. --*/
  14. // This is the number of entries in the real time executive
  15. // interrupt descriptor table (IDT) as well as the number of entries
  16. // in the realtime thread IDT.
  17. // The realtime executive IDT is loaded while the realtime executive is
  18. // switching threads. The realtime thread IDT is loaded whenever a
  19. // non windows realtime thread is running.
  20. #define RTEXECIDTSIZE 0x20
  21. #define RTTHREADSMALLIDTSIZE 0x50
  22. #define RTTHREADLARGEIDTSIZE 0x100
  23. // Here are the locations of a couple of individual IDT entries.
  24. #define BREAKPOINTIDTINDEX 3
  25. #define DOUBLEFAULTIDTINDEX 8
  26. // Global variables that hold various IDT locations. Used for switching
  27. // between the various IDTs.
  28. // This is used to save the location/size of the current IDT when we leave Windows.
  29. extern IDT WindowsIDT;
  30. // This holds the location/size of the IDT that is loaded while running the
  31. // realtime executive thread switching code.
  32. extern IDT RtExecIDT;
  33. // This holds the location/size of the IDT that is loaded while running non
  34. // Windows realtime threads.
  35. extern IDT RtThreadIDT;
  36. // This holds the location/size of the IDT that is loaded just before the realtime
  37. // executive thread switcher returns control to whatever thread it is
  38. // switching to - realtime or Windows. If we are returning to Windows, then
  39. // this variable is loaded with the contents of WindowsIDT. If we are switching
  40. // to a realtime thread, then this variable is loaded with the contents of
  41. // RtThreadIDT.
  42. extern IDT NextIDT;
  43. extern IDT DebugIDT;
  44. #ifdef DEBUG
  45. // These are for debug purposes - to see if either the Windows or RT exec IDT
  46. // addresses change over time. The RT exec IDT should NEVER change. I expect
  47. // the Windows NT IDT to never change. The Win9x IDT may change since who knows
  48. // what 3rd party VxD code does.
  49. // Note that for Windows NT if the IDT never changes we could optimize out the
  50. // saving of the current IDT and simply load the RT idt. That would save a few
  51. // cycles and allow us to do the IDT load as the very first thing in the realtime
  52. // thread switcher.
  53. // HOWEVER, these gains are NOT worth the risk of breaking if the Windows NT IDT
  54. // ever starts changing. For now we always save and restore the IDT whenever we
  55. // leave and return to Windows.
  56. extern IDT LastWindowsIDT;
  57. extern IDT LastRtThreadIDT;
  58. extern ULONG HitInt3InRtThread;
  59. #endif
  60. // These are the realtime executive exception handler prototypes.
  61. // We are NOT defining these with the various parameters that the hardware
  62. // actually passes them.
  63. // Note that IntelReserved is used for a number of different IDT entries.
  64. VOID
  65. DivideByZero (
  66. VOID
  67. );
  68. VOID
  69. DebugExceptions (
  70. VOID
  71. );
  72. VOID
  73. SwitchRealTimeThreads (
  74. VOID
  75. );
  76. VOID
  77. RtThreadPerfCounterNMI (
  78. VOID
  79. );
  80. VOID
  81. RtExecPerfCounterNMI (
  82. VOID
  83. );
  84. VOID
  85. RtExecBreakPoint (
  86. VOID
  87. );
  88. VOID
  89. RtThreadBreakPoint (
  90. VOID
  91. );
  92. VOID
  93. Overflow (
  94. VOID
  95. );
  96. VOID
  97. BoundsCheck (
  98. VOID
  99. );
  100. VOID
  101. InvalidOpcode (
  102. VOID
  103. );
  104. VOID
  105. DeviceNotAvailable (
  106. VOID
  107. );
  108. VOID
  109. DoubleFault (
  110. VOID
  111. );
  112. VOID
  113. IntelReserved (
  114. VOID
  115. );
  116. VOID
  117. InvalidTSS (
  118. VOID
  119. );
  120. VOID
  121. SegmentNotPresent (
  122. VOID
  123. );
  124. VOID
  125. StackException (
  126. VOID
  127. );
  128. VOID
  129. GeneralProtection (
  130. VOID
  131. );
  132. VOID
  133. PageFault (
  134. VOID
  135. );
  136. VOID
  137. FloatingPointError (
  138. VOID
  139. );
  140. VOID
  141. AlignmentCheck (
  142. VOID
  143. );
  144. VOID
  145. MachineCheck (
  146. VOID
  147. );
  148. VOID
  149. RtpLocalApicErrorHandler (
  150. VOID
  151. );
  152. VOID
  153. RtpLocalApicSpuriousHandler (
  154. VOID
  155. );
  156. #ifdef NONMI
  157. VOID
  158. JumpToWindowsNmiHandler (
  159. VOID
  160. );
  161. #endif
  162. // This function initializes the realtime executive IDT and the realtime thread IDT,
  163. // and sets things up for the IDT switch that happens at the beginning and end of
  164. // every real time interrupt.
  165. VOID
  166. RtpSetupIdtSwitch (
  167. ULONG TimerVector,
  168. ULONG PerfVector,
  169. ULONG ErrorVector,
  170. ULONG SpuriousVector
  171. );