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.

179 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Copyright (c) 1993 Digital Equipment Corporation
  4. Module Name:
  5. ipi.c
  6. Abstract:
  7. This module implement Alpha AXP - specific interprocessor interrupt
  8. routines.
  9. Author:
  10. David N. Cutler 24-Apr-1993
  11. Joe Notarangelo 29-Nov-1993
  12. Environment:
  13. Kernel mode only.
  14. Revision History:
  15. --*/
  16. #include "ki.h"
  17. VOID
  18. KiRestoreProcessorState (
  19. IN PKTRAP_FRAME TrapFrame,
  20. IN PKEXCEPTION_FRAME ExceptionFrame
  21. )
  22. /*++
  23. Routine Description:
  24. This function moves processor register state from the current
  25. processor context structure in the processor block to the
  26. specified trap and exception frames.
  27. Arguments:
  28. TrapFrame - Supplies a pointer to a trap frame.
  29. ExceptionFrame - Supplies a pointer to an exception frame.
  30. Return Value:
  31. None.
  32. --*/
  33. {
  34. PKPRCB Prcb;
  35. //
  36. // Get the address of the current processor block and move the
  37. // specified register state from the processor context structure
  38. // to the specified trap and exception frames
  39. //
  40. #if !defined(NT_UP)
  41. Prcb = KeGetCurrentPrcb();
  42. KeContextToKframes(TrapFrame,
  43. ExceptionFrame,
  44. &Prcb->ProcessorState.ContextFrame,
  45. CONTEXT_FULL,
  46. KernelMode);
  47. #endif
  48. return;
  49. }
  50. VOID
  51. KiSaveProcessorState (
  52. IN PKTRAP_FRAME TrapFrame,
  53. IN PKEXCEPTION_FRAME ExceptionFrame
  54. )
  55. /*++
  56. Routine Description:
  57. This function moves processor register state from the specified trap
  58. and exception frames to the processor context structure in the current
  59. processor block.
  60. Arguments:
  61. TrapFrame - Supplies a pointer to a trap frame.
  62. ExceptionFrame - Supplies a pointer to an exception frame.
  63. Return Value:
  64. None.
  65. --*/
  66. {
  67. PKPRCB Prcb;
  68. //
  69. // Get the address of the current processor block and move the
  70. // specified register state from specified trap and exception
  71. // frames to the current processor context structure.
  72. //
  73. #if !defined(NT_UP)
  74. Prcb = KeGetCurrentPrcb();
  75. Prcb->ProcessorState.ContextFrame.ContextFlags = CONTEXT_FULL;
  76. KeContextFromKframes(TrapFrame,
  77. ExceptionFrame,
  78. &Prcb->ProcessorState.ContextFrame);
  79. #endif
  80. return;
  81. }
  82. BOOLEAN
  83. KiIpiServiceRoutine (
  84. IN PKTRAP_FRAME TrapFrame,
  85. IN PKEXCEPTION_FRAME ExceptionFrame
  86. )
  87. /*++
  88. Routine Description:
  89. This function is called at IPI_LEVEL to process any outstanding
  90. interprocess request for the current processor.
  91. Arguments:
  92. TrapFrame - Supplies a pointer to a trap frame.
  93. ExceptionFrame - Supplies a pointer to an exception frame
  94. Return Value:
  95. A value of TRUE is returned, if one of more requests were service.
  96. Otherwise, FALSE is returned.
  97. --*/
  98. {
  99. ULONG RequestSummary;
  100. //
  101. // Process any outstanding interprocessor requests.
  102. //
  103. RequestSummary = KiIpiProcessRequests();
  104. //
  105. // If freeze is requested, then freeze target execution.
  106. //
  107. if ((RequestSummary & IPI_FREEZE) != 0) {
  108. KiFreezeTargetExecution(TrapFrame, ExceptionFrame);
  109. }
  110. //
  111. // Return whether any requests were processed.
  112. //
  113. return (RequestSummary & ~IPI_FREEZE) != 0;
  114. }