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.

109 lines
1.7 KiB

  1. TITLE STACK - Kernel stack switching code
  2. include kernel.inc
  3. ifdef WOW
  4. include vint.inc
  5. endif
  6. ;------------------------------------------------------------------------
  7. ; T M P S T A C K S E G M E N T V A R I A B L E S
  8. ;------------------------------------------------------------------------
  9. sBegin DATA
  10. assumes CS,CODE
  11. assumes DS,NOTHING
  12. assumes ES,NOTHING
  13. assumes SS,NOTHING
  14. EVEN
  15. if KDEBUG
  16. externW gmove_stack_sig
  17. endif
  18. externW gmove_stack
  19. externW prev_gmove_SP
  20. externW prev_gmove_SS
  21. externW ss_sel
  22. sEnd DATA
  23. ;------------------------------------------------------------------------
  24. sBegin CODE
  25. assumes CS,CODE
  26. assumes SS,NOTHING
  27. assumes ds,nothing
  28. assumes es,nothing
  29. cProc Enter_gmove_stack,<PUBLIC,NEAR>
  30. cBegin nogen
  31. mov ax,ds
  32. SetKernelDS
  33. cmp prev_gmove_SS,0
  34. jne gs_fail
  35. FCLI
  36. pop gmove_stack
  37. mov prev_gmove_SS,cx
  38. mov prev_gmove_SP,sp
  39. if KDEBUG
  40. mov gmove_stack_sig,STACK_SIGNATURE
  41. endif
  42. smov ss,ds
  43. mov sp,dataOffset gmove_stack
  44. FSTI
  45. mov ds,ax
  46. ret
  47. cEnd nogen
  48. gs_fail:
  49. kerror ERR_GMEM,<gmove_stack usage error>,prev_gmove_SS,prev_gmove_SP
  50. jmp gs_fail
  51. assumes ds,nothing
  52. assumes es,nothing
  53. cProc Leave_gmove_stack,<PUBLIC,NEAR>
  54. cBegin nogen
  55. mov ax,ds
  56. SetKernelDS
  57. cmp prev_gmove_SS,0
  58. je gs_fail
  59. if KDEBUG
  60. push ax
  61. push cx
  62. push es
  63. push di
  64. lea di, gmove_stack_sig
  65. smov es, ss
  66. mov ax, STACK_SIGNATURE
  67. mov cx, 16
  68. cld
  69. repe scasw
  70. pop di
  71. pop es
  72. pop cx
  73. pop ax
  74. jne gs_fail
  75. cmp sp,dataOffset gmove_stack
  76. jne gs_fail
  77. endif
  78. FCLI
  79. mov ss,prev_gmove_SS
  80. mov sp,prev_gmove_SP
  81. push gmove_stack
  82. mov prev_gmove_SS,0
  83. FSTI
  84. mov ds,ax
  85. ret
  86. cEnd nogen
  87. sEND CODE
  88. end