Leaked source code of windows server 2003
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.

297 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. kiamd64.h
  5. Abstract:
  6. This module contains the private (internal) platform specific header file
  7. for the kernel.
  8. Author:
  9. David N. Cutler (davec) 15-May-2000
  10. Revision History:
  11. --*/
  12. #if !defined(_KIAMD64_)
  13. #define _KIAMD64_
  14. VOID
  15. KiAcquireSpinLockCheckForFreeze (
  16. IN PKSPIN_LOCK SpinLock,
  17. IN PKTRAP_FRAME TrapFrame,
  18. IN PKEXCEPTION_FRAME ExceptionFrame
  19. );
  20. VOID
  21. KiInitializeBootStructures (
  22. PLOADER_PARAMETER_BLOCK LoaderBlock
  23. );
  24. ULONG
  25. KiCopyInformation (
  26. IN OUT PEXCEPTION_RECORD ExceptionRecord1,
  27. IN PEXCEPTION_RECORD ExceptionRecord2
  28. );
  29. extern KIRQL KiProfileIrql;
  30. //
  31. // Define function prototypes for trap processing functions.
  32. //
  33. VOID
  34. KiDivideErrorFault (
  35. VOID
  36. );
  37. VOID
  38. KiDebugTrapOrFault (
  39. VOID
  40. );
  41. VOID
  42. KiNmiInterrupt (
  43. VOID
  44. );
  45. VOID
  46. KiBreakpointTrap (
  47. VOID
  48. );
  49. VOID
  50. KiOverflowTrap (
  51. VOID
  52. );
  53. VOID
  54. KiBoundFault (
  55. VOID
  56. );
  57. VOID
  58. KiInvalidOpcodeFault (
  59. VOID
  60. );
  61. VOID
  62. KiNpxNotAvailableFault (
  63. VOID
  64. );
  65. VOID
  66. KiDoubleFaultAbort (
  67. VOID
  68. );
  69. VOID
  70. KiNpxSegmentOverrunAbort (
  71. VOID
  72. );
  73. VOID
  74. KiInvalidTssFault (
  75. VOID
  76. );
  77. VOID
  78. KiSegmentNotPresentFault (
  79. VOID
  80. );
  81. VOID
  82. KiSetPageAttributesTable (
  83. VOID
  84. );
  85. VOID
  86. KiStackFault (
  87. VOID
  88. );
  89. VOID
  90. KiGeneralProtectionFault (
  91. VOID
  92. );
  93. VOID
  94. KiPageFault (
  95. VOID
  96. );
  97. VOID
  98. KiFloatingErrorFault (
  99. VOID
  100. );
  101. VOID
  102. KiAlignmentFault (
  103. VOID
  104. );
  105. VOID
  106. KiMcheckAbort (
  107. VOID
  108. );
  109. VOID
  110. KiXmmException (
  111. VOID
  112. );
  113. VOID
  114. KiApcInterrupt (
  115. VOID
  116. );
  117. VOID
  118. KiDebugServiceTrap (
  119. VOID
  120. );
  121. VOID
  122. KiDpcInterrupt (
  123. VOID
  124. );
  125. VOID
  126. KiSystemCall32 (
  127. VOID
  128. );
  129. VOID
  130. KiSystemCall64 (
  131. VOID
  132. );
  133. VOID
  134. KiInterruptDispatchNoLock (
  135. VOID
  136. );
  137. __forceinline
  138. BOOLEAN
  139. KiSwapProcess (
  140. IN PKPROCESS NewProcess,
  141. IN PKPROCESS OldProcess
  142. )
  143. /*++
  144. Routine Description:
  145. This function swaps the address space to another process by flushing the
  146. the translation buffer and establishings a new directory table base. It
  147. also swaps the I/O permission map to the new process.
  148. N.B. There is code similar to this code in swap context.
  149. N.B. This code is executed at DPC level.
  150. Arguments:
  151. NewProcess - Supplies a pointer to the new process object.
  152. Oldprocess - Supplies a pointer to the old process object.
  153. Return Value:
  154. None.
  155. --*/
  156. {
  157. //
  158. // Clear the processor bit in the old process.
  159. //
  160. #if !defined(NT_UP)
  161. PKPRCB Prcb;
  162. KAFFINITY SetMember;
  163. Prcb = KeGetCurrentPrcb();
  164. SetMember = Prcb->SetMember;
  165. InterlockedXor64((LONG64 volatile *)&OldProcess->ActiveProcessors, SetMember);
  166. ASSERT((OldProcess->ActiveProcessors & SetMember) == 0);
  167. //
  168. // Set the processor bit in the new process.
  169. //
  170. InterlockedXor64((LONG64 volatile *)&NewProcess->ActiveProcessors, SetMember);
  171. ASSERT((NewProcess->ActiveProcessors & SetMember) != 0);
  172. #endif
  173. //
  174. // Load the new directory table base.
  175. //
  176. WriteCR3(NewProcess->DirectoryTableBase[0]);
  177. #if defined(NT_UP)
  178. UNREFERENCED_PARAMETER(OldProcess);
  179. #endif // !defined(NT_UP)
  180. return TRUE;
  181. }
  182. //
  183. // Define thread startup routine prototypes.
  184. //
  185. VOID
  186. KiStartSystemThread (
  187. VOID
  188. );
  189. VOID
  190. KiStartUserThread (
  191. VOID
  192. );
  193. VOID
  194. KiStartUserThreadReturn (
  195. VOID
  196. );
  197. //
  198. // Define unexpected interrupt structure and table.
  199. //
  200. // N.B. The actual table is generated in assembler.
  201. //
  202. typedef struct _UNEXPECTED_INTERRUPT {
  203. ULONG Array[4];
  204. } UNEXPECTED_INTERRUPT, *PUNEXPECTED_INTERRUPT;
  205. UNEXPECTED_INTERRUPT KxUnexpectedInterrupt0[];
  206. #define PPI_BITS 2
  207. #define PDI_BITS 9
  208. #define PTI_BITS 9
  209. #define PDI_MASK ((1 << PDI_BITS) - 1)
  210. #define PTI_MASK ((1 << PTI_BITS) - 1)
  211. #define KiGetPpeIndex(va) ((((ULONG)(va)) >> PPI_SHIFT) & PPI_MASK)
  212. #define KiGetPdeIndex(va) ((((ULONG)(va)) >> PDI_SHIFT) & PDI_MASK)
  213. #define KiGetPteIndex(va) ((((ULONG)(va)) >> PTI_SHIFT) & PTI_MASK)
  214. extern KSPIN_LOCK KiNMILock;
  215. extern ULONG KeAmd64MachineType;
  216. #endif // !defined(_KIAMD64_)