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.

137 lines
2.8 KiB

  1. TITLE "Trap Frame Test Program"
  2. ;++
  3. ;
  4. ; Copyright (c) 2001 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; tf.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This is a test program that generates a trap frame with and without an
  13. ; error code.
  14. ;
  15. ; Author:
  16. ;
  17. ; David N. Cutler (davec) 11-Feb-2001
  18. ;
  19. ; Environment:
  20. ;
  21. ; Kernel mode only.
  22. ;
  23. ;--
  24. include ksamd64.inc
  25. LEAF_ENTRY KiInitiateUserApc, _TEXT$00
  26. retq ;
  27. LEAF_END KiInitiateUserApc, _TEXT$00
  28. subttl "Exception Handler"
  29. ;++
  30. ;
  31. ; EXCEPTION_DISPOSITION
  32. ; ExceptionHandler (
  33. ; IN PEXCEPTION_RECORD ExceptionRecord,
  34. ; IN PVOID EstablisherFrame,
  35. ; IN OUT PCONTEXT ContextRecord,
  36. ; IN OUT PDISPATCHER_CONTEXT DispatcherContext
  37. ; )
  38. ;
  39. ; Routine Description:
  40. ;
  41. ; This routine is an exception handler for the trap frame below with a
  42. ; handler.
  43. ;
  44. ; Arguments:
  45. ;
  46. ; ExceptionRecord (rcx) - Supplies a pointer to an exception record.
  47. ;
  48. ; EstablisherFrame (rdx) - Supplies the frame pointer of the establisher
  49. ; of this exception handler.
  50. ;
  51. ; ContextRecord (r8) - Supplies a pointer to a context record.
  52. ;
  53. ; DispatcherContext (r9) - Supplies a pointer to the dispatcher context
  54. ; record.
  55. ;
  56. ; Return Value:
  57. ;
  58. ; The exception disposition.
  59. ;
  60. ;--
  61. LEAF_ENTRY ExceptionHandler, _TEXT$00
  62. mov eax, EXCEPTION_CONTINUE_SEARCH ; assume continue search
  63. test dword ptr ErExceptionFlags[rcx], EXCEPTION_UNWIND ; test for unwind
  64. jnz short Eh10 ; if nz, unwind in progress
  65. mov eax, EXCEPTION_CONTINUE_EXECUTION ; set to continue execution
  66. Eh10: ret ; return
  67. LEAF_END ExceptionHandler, _TEXT$00
  68. subttl "Frame Without Error Code - With Handler"
  69. ;++
  70. ;
  71. ; VOID
  72. ; FrameNoCode (
  73. ; VOID
  74. ; );
  75. ;
  76. ; Routine Description:
  77. ;
  78. ; This routine generates a trap frame without an error, but with a handler.
  79. ;
  80. ; Arguments:
  81. ;
  82. ; None.
  83. ;
  84. ; Return Value:
  85. ;
  86. ; None.
  87. ;
  88. ;--
  89. NESTED_ENTRY FrameNoCode, _TEXT$00, ExceptionHandler
  90. GENERATE_TRAP_FRAME ; generate trap frame
  91. RESTORE_TRAP_STATE <Volatile> ; restore trap state
  92. NESTED_END FrameNoCode, _TEXT$00
  93. subttl "Frame With Code - Without Handler"
  94. ;++
  95. ;
  96. ; VOID
  97. ; FrameWithCode (
  98. ; VOID
  99. ; );
  100. ;
  101. ; Routine Description:
  102. ;
  103. ; This routine generates a trap frame with an error code.
  104. ;
  105. ; Arguments:
  106. ;
  107. ; None.
  108. ;
  109. ; Return Value:
  110. ;
  111. ; None.
  112. ;
  113. ;--
  114. NESTED_ENTRY FrameWithCode, _TEXT$00
  115. GENERATE_TRAP_FRAME code ; generate trap frame
  116. RESTORE_TRAP_STATE <Service> ; restore trap state
  117. NESTED_END FrameWithCode, _TEXT$00
  118. end