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.

123 lines
1.7 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. mpswint.c
  5. Abstract:
  6. This module implements the software interrupt handlers
  7. for x86 machines
  8. Author:
  9. John Vert (jvert) 2-Jan-1992
  10. Environment:
  11. Kernel mode only.
  12. Revision History:
  13. Forrest Foltz (forrestf) 23-Oct-2000
  14. Ported from ixswint.asm to ixswint.c
  15. --*/
  16. #include "halcmn.h"
  17. extern UCHAR HalpIRQLtoTPR[];
  18. //
  19. // Array used to look up the correct ICR command based on the requested
  20. // software interrupt
  21. //
  22. const
  23. ULONG
  24. HalpIcrCommandArray[3] = {
  25. 0,
  26. APC_VECTOR | DELIVER_FIXED | ICR_SELF, // APC_LEVEL
  27. DPC_VECTOR | DELIVER_FIXED | ICR_SELF // DISPATCH_LEVEL
  28. };
  29. C_ASSERT(APC_LEVEL == 1);
  30. C_ASSERT(DISPATCH_LEVEL == 2);
  31. VOID
  32. FASTCALL
  33. HalRequestSoftwareInterrupt (
  34. IN KIRQL RequestIrql
  35. )
  36. /*++
  37. Routine Description:
  38. This routine is used to request a software interrupt of
  39. the system.
  40. Arguments:
  41. RequestIrql - Supplies the request IRQL value
  42. Return Value:
  43. None.
  44. --*/
  45. {
  46. ULONG icrCommand;
  47. ULONG flags;
  48. ASSERT(RequestIrql == APC_LEVEL || RequestIrql == DISPATCH_LEVEL);
  49. icrCommand = HalpIcrCommandArray[RequestIrql];
  50. flags = HalpDisableInterrupts();
  51. HalpStallWhileApicBusy();
  52. LOCAL_APIC(LU_INT_CMD_LOW) = icrCommand;
  53. HalpStallWhileApicBusy();
  54. HalpRestoreInterrupts(flags);
  55. }
  56. VOID
  57. HalClearSoftwareInterrupt (
  58. IN KIRQL RequestIrql
  59. )
  60. /*++
  61. Routine Description:
  62. This routine is used to clear a possible pending software interrupt.
  63. Support for this function is optional, and allows the kernel to
  64. reduce the number of spurious software interrupts it receives/
  65. Arguments:
  66. RequestIrql - Supplies the request IRQL value
  67. Return Value:
  68. None.
  69. --*/
  70. {
  71. }