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.

48 lines
1.5 KiB

  1. page ,132
  2. ;-----------------------------Module-Header-----------------------------;
  3. ; Module Name: CLISTI.ASM - Enter/leave critical sections
  4. ;
  5. ; Created: 18 April 1994
  6. ; Author: Jim Geist [jimge]
  7. ;
  8. ; Copyright (c) 1984-1995 Microsoft Corporation
  9. ;
  10. ;-----------------------------------------------------------------------;
  11. ?PLM = 1
  12. ?WIN = 0
  13. PMODE = 1
  14. .xlist
  15. include cmacros.inc
  16. .list
  17. createSeg %SEGNAME, CodeSeg, word, public, CODE
  18. sBegin CodeSeg
  19. assumes cs, CodeSeg
  20. public EnterCrit
  21. EnterCrit proc near
  22. pop ax ; Near return address
  23. pushf ; Save flags
  24. cli ; Interrupts off
  25. push ax ; Near return address
  26. ret ; and return
  27. EnterCrit endp
  28. public LeaveCrit
  29. LeaveCrit proc near
  30. pop ax ; Near return address
  31. pop bx ; Flag state
  32. test bx, 0200h ; Interrupts should be on?
  33. jz short @F ; Nope
  34. sti ; Yep
  35. @@: push ax ; Near return address
  36. ret ; and return
  37. LeaveCrit endp
  38. sEnd CodeSeg
  39. end