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.

157 lines
4.5 KiB

  1. #include "ksia64.h"
  2. .file "pswrap.s"
  3. .text
  4. PublicFunction(PspGetSetContextSpecialApcMain)
  5. PublicFunction(KiRestoreExceptionFrame)
  6. NESTED_ENTRY(PspGetSetContextSpecialApc)
  7. PROLOGUE_BEGIN
  8. .regstk 0, 0, 5, 0
  9. alloc t16 = ar.pfs, 0, 0, 5, 0
  10. mov t17 = brp
  11. .fframe ExceptionFrameLength+0x10
  12. add sp = -ExceptionFrameLength-0x10, sp
  13. ;;
  14. mov t18 = ar.unat
  15. add t3 = STACK_SCRATCH_AREA, sp
  16. ;;
  17. .savepsp ar.unat, 0x10+ExceptionFrameLength-STACK_SCRATCH_AREA
  18. st8 [t3] = t18
  19. add t0 = ExFltS19+0x10+STACK_SCRATCH_AREA, sp
  20. add t1 = ExFltS18+0x10+STACK_SCRATCH_AREA, sp
  21. ;;
  22. .save.gf 0x0, 0xC0000
  23. stf.spill [t0] = fs19, ExFltS17-ExFltS19
  24. stf.spill [t1] = fs18, ExFltS16-ExFltS18
  25. ;;
  26. .save.gf 0x0, 0x30000
  27. stf.spill [t0] = fs17, ExFltS15-ExFltS17
  28. stf.spill [t1] = fs16, ExFltS14-ExFltS16
  29. mov t10 = bs4
  30. ;;
  31. .save.gf 0x0, 0xC000
  32. stf.spill [t0] = fs15, ExFltS13-ExFltS15
  33. stf.spill [t1] = fs14, ExFltS12-ExFltS14
  34. mov t11 = bs3
  35. ;;
  36. .save.gf 0x0, 0x3000
  37. stf.spill [t0] = fs13, ExFltS11-ExFltS13
  38. stf.spill [t1] = fs12, ExFltS10-ExFltS12
  39. mov t12 = bs2
  40. ;;
  41. .save.gf 0x0, 0xC00
  42. stf.spill [t0] = fs11, ExFltS9-ExFltS11
  43. stf.spill [t1] = fs10, ExFltS8-ExFltS10
  44. mov t13 = bs1
  45. ;;
  46. .save.gf 0x0, 0x300
  47. stf.spill [t0] = fs9, ExFltS7-ExFltS9
  48. stf.spill [t1] = fs8, ExFltS6-ExFltS8
  49. mov t14 = bs0
  50. ;;
  51. .save.gf 0x0, 0xC0
  52. stf.spill [t0] = fs7, ExFltS5-ExFltS7
  53. stf.spill [t1] = fs6, ExFltS4-ExFltS6
  54. mov t15 = ar.lc
  55. ;;
  56. .save.gf 0x0, 0x30
  57. stf.spill [t0] = fs5, ExFltS3-ExFltS5
  58. stf.spill [t1] = fs4, ExFltS2-ExFltS4
  59. ;;
  60. .save.f 0xC
  61. stf.spill [t0] = fs3, ExFltS1-ExFltS3 // save fs3
  62. stf.spill [t1] = fs2, ExFltS0-ExFltS2 // save fs2
  63. ;;
  64. .save.f 0x3
  65. stf.spill [t0] = fs1, ExBrS4-ExFltS1 // save fs1
  66. stf.spill [t1] = fs0, ExBrS3-ExFltS0 // save fs0
  67. ;;
  68. .save.b 0x18
  69. st8 [t0] = t10, ExBrS2-ExBrS4 // save bs4
  70. st8 [t1] = t11, ExBrS1-ExBrS3 // save bs3
  71. ;;
  72. .save.b 0x6
  73. st8 [t0] = t12, ExBrS0-ExBrS2 // save bs2
  74. st8 [t1] = t13, ExIntS2-ExBrS1 // save bs1
  75. ;;
  76. .save.b 0x1
  77. st8 [t0] = t14, ExIntS3-ExBrS0 // save bs0
  78. ;;
  79. .save.gf 0xC, 0x0
  80. .mem.offset 0,0
  81. st8.spill [t0] = s3, ExIntS1-ExIntS3 // save s3
  82. .mem.offset 8,0
  83. st8.spill [t1] = s2, ExIntS0-ExIntS2 // save s2
  84. ;;
  85. .save.gf 0x3, 0x0
  86. .mem.offset 0,0
  87. st8.spill [t0] = s1, ExApLC-ExIntS1 // save s1
  88. .mem.offset 8,0
  89. st8.spill [t1] = s0, ExApEC-ExIntS0 // save s0
  90. add t2 = STACK_SCRATCH_AREA+8, sp
  91. ;;
  92. .savepsp ar.pfs, ExceptionFrameLength-ExApEC-STACK_SCRATCH_AREA
  93. st8 [t1] = t16, ExIntNats-ExApEC
  94. mov t4 = ar.unat // captured Nats of s0-s3
  95. ;;
  96. .savepsp ar.lc, ExceptionFrameLength-ExApLC-STACK_SCRATCH_AREA
  97. st8 [t0] = t15
  98. .savepsp @priunat, ExceptionFrameLength-ExIntNats-STACK_SCRATCH_AREA
  99. st8 [t1] = t4 // save Nats of s0-s3
  100. ;;
  101. .savepsp brp, 8+ExceptionFrameLength-STACK_SCRATCH_AREA
  102. st8 [t2] = t17
  103. PROLOGUE_END
  104. br.call.sptk brp = PspGetSetContextSpecialApcMain
  105. ;;
  106. add out0 = 0x10+STACK_SCRATCH_AREA, sp
  107. br.call.sptk brp = KiRestoreExceptionFrame
  108. ;;
  109. add t2 = STACK_SCRATCH_AREA+8, sp
  110. add t3 = STACK_SCRATCH_AREA, sp
  111. add t4 = ExApEC+STACK_SCRATCH_AREA+0x10, sp
  112. ;;
  113. ld8 t2 = [t2]
  114. ld8 t3 = [t3]
  115. ;;
  116. ld8 t4 = [t4]
  117. mov ar.unat = t3
  118. mov brp = t2
  119. ;;
  120. .restore
  121. add sp = ExceptionFrameLength+0x10, sp
  122. mov ar.pfs = t4
  123. br.ret.sptk brp
  124. NESTED_EXIT(PspGetSetContextSpecialApc)