Windows NT 4.0 source code leak
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.

117 lines
3.2 KiB

4 years ago
  1. // TITLE("Set Jump")
  2. //++
  3. //
  4. // Copyright (c) 1993 Digital Equipment Corporation
  5. //
  6. // Module Name:
  7. //
  8. // otsjmp.s
  9. //
  10. // Abstract:
  11. //
  12. // This module implements the Alpha C8/GEM C compiler specific routine to
  13. // perform a setjmp.
  14. //
  15. // N.B. This module conditionally provides UNSAFE handling of setjmp and
  16. // which is NOT integrated with structured exception handling. The
  17. // determination is made based on whether an uninitialized variable
  18. // has been set to a nonzero value.
  19. //
  20. // Author:
  21. //
  22. // Thomas Van Baak (tvb) 22-Apr-1993
  23. //
  24. // Environment:
  25. //
  26. // Any mode.
  27. //
  28. // Revision History:
  29. //
  30. //--
  31. #include "ksalpha.h"
  32. //
  33. // Define variable that will cause setjmp/longjmp to be safe or unsafe with
  34. // respect to structured exception handling.
  35. //
  36. .globl _Otssetjmpexused
  37. .comm _Otssetjmpexused, 4
  38. SBTTL("Set Jump - GEM version")
  39. //++
  40. //
  41. // int
  42. // _Otssetjmp3 (
  43. // IN OUT jmp_buf JumpBuffer,
  44. // IN PVOID RealFramePointer,
  45. // IN PVOID SebPointer
  46. // )
  47. //
  48. // Routine Description:
  49. //
  50. // This function saves the current nonvolatile register state in the
  51. // specified jump buffer and returns a function value of zero.
  52. //
  53. // N.B. The name `_Otssetjmp3' was chosen to avoid collision with an
  54. // earlier implementation named _Otssetjmp. This version has three
  55. // arguments.
  56. //
  57. // Arguments:
  58. //
  59. // JumpBuffer (a0) - Supplies the address of a jump buffer to store the
  60. // jump information.
  61. //
  62. // RealFramePointer (a1) - Supplies the real frame pointer value.
  63. //
  64. // SebPointer (a2) - Supplies the pointer to the current SEB or NULL
  65. // if the call was made outside of any SEH scope.
  66. //
  67. // Return Value:
  68. //
  69. // A value of zero is returned.
  70. //
  71. //--
  72. LEAF_ENTRY(_Otssetjmp3)
  73. ldl v0, _Otssetjmpexused // get value of switch variable
  74. bne v0, 10f // if ne, provide safe setjmp
  75. //
  76. // Provide unsafe handling of setjmp.
  77. //
  78. stt f2, JbFltF2(a0) // save floating registers f2 - f9
  79. stt f3, JbFltF3(a0) //
  80. stt f4, JbFltF4(a0) //
  81. stt f5, JbFltF5(a0) //
  82. stt f6, JbFltF6(a0) //
  83. stt f7, JbFltF7(a0) //
  84. stt f8, JbFltF8(a0) //
  85. stt f9, JbFltF9(a0) //
  86. stq s0, JbIntS0(a0) // save integer registers s0 - s6/fp
  87. stq s1, JbIntS1(a0) //
  88. stq s2, JbIntS2(a0) //
  89. stq s3, JbIntS3(a0) //
  90. stq s4, JbIntS4(a0) //
  91. stq s5, JbIntS5(a0) //
  92. stq fp, JbIntS6(a0) //
  93. ldil t0, 1 // get unsafe setjmp flag
  94. stl t0, JbType(a0) // set jump buffer context type
  95. stq sp, JbIntSp(a0) // save stack pointer
  96. stq ra, JbFir(a0) // get setjmp return address
  97. mov zero, v0 // set zero return value
  98. ret zero, (ra) // return
  99. //
  100. // Provide safe handling of setjmp.
  101. //
  102. 10: jmp zero, (v0) // finish in _setjmpex code
  103. .end _Otssetjmp3