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.

119 lines
2.9 KiB

  1. // TITLE("Asynchronous Procedure Call (APC) Interrupt")
  2. //++
  3. //
  4. // Copyright (c) 1990 Microsoft Corporation
  5. //
  6. // Module Name:
  7. //
  8. // apcint.s
  9. //
  10. // Abstract:
  11. //
  12. // This module implements the code necessary to field and process the
  13. // Asynchronous Procedure Call (APC) interrupt.
  14. //
  15. // Author:
  16. //
  17. // William K. Cheung (wcheung) 1-Nov-1995
  18. //
  19. // Environment:
  20. //
  21. // Kernel mode only, IRQL APC_LEVEL.
  22. //
  23. // Revision History:
  24. //
  25. // 08-Feb-1996 Updated to EAS2.1
  26. //
  27. //--
  28. #include "ksia64.h"
  29. .file "apcint.s"
  30. //++
  31. // Routine
  32. //
  33. // VOID
  34. // KiApcInterrupt(PKINTERRUPT, PKTRAP_FRAME)
  35. //
  36. // Routine Description:
  37. //
  38. // This routine is entered as the result of a software interrupt generated
  39. // at APC_LEVEL. Its function is to allocate an exception frame and call
  40. // the kernel APC delivery routine to deliver kernel mode APCs and to check
  41. // if a user mode APC should be delivered. If a user mode APC should be
  42. // delivered, then the kernel APC delivery routine constructs a context
  43. // frame on the user stack and alters the exception and trap frames so that
  44. // control will be transfered to the user APC dispatcher on return from the
  45. // interrupt.
  46. //
  47. // Arguments:
  48. //
  49. // a0 - Supplies a pointer to interrupt object.
  50. //
  51. // a1 - Supplies a pointer to a trap frame.
  52. //
  53. // Return Value:
  54. //
  55. // None.
  56. //
  57. //--
  58. .global KiSaveExceptionFrame
  59. .type KiSaveExceptionFrame, @function
  60. .global KiDeliverApc
  61. .type KiDeliverApc, @function
  62. NESTED_ENTRY(KiApcInterrupt)
  63. .regstk 2, 3, 3, 0
  64. .prologue 0xC, savedpfs
  65. alloc savedpfs = ar.pfs, 2, 3, 3, 0
  66. mov savedbrp = brp
  67. add t0 = TrPreviousMode, a1
  68. ;;
  69. .fframe ExceptionFrameLength
  70. add sp = -ExceptionFrameLength, sp
  71. ld4 loc2 = [t0] // PreviousMode'size = 4-byte
  72. ;;
  73. PROLOGUE_END
  74. //
  75. // Register definitions
  76. //
  77. pKern = pt0
  78. pUser = pt1
  79. //
  80. // Save the nonvolatile machine state so a context record can be
  81. // properly constructed to deliver an APC to user mode if required.
  82. //
  83. cmp.eq pUser = UserMode, loc2
  84. add out0 = STACK_SCRATCH_AREA, sp
  85. (pUser) br.call.spnt brp = KiSaveExceptionFrame
  86. ;;
  87. mov out0 = loc2
  88. add out1 = STACK_SCRATCH_AREA, sp // -> exception frame
  89. mov out2 = a1 // -> trap frame
  90. br.call.sptk.many brp = KiDeliverApc
  91. ;;
  92. //
  93. // deallocate exception frame and high floating pointer register save area
  94. //
  95. .restore
  96. add sp = ExceptionFrameLength, sp
  97. NESTED_RETURN
  98. NESTED_EXIT(KiApcInterrupt)