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.

100 lines
2.0 KiB

  1. title "pae"
  2. ;++
  3. ;
  4. ; Copyright (c) 1989, 2000 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; pae.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This module implements the code necessary to swap PTEs on a PAE system.
  13. ;
  14. ; Author:
  15. ;
  16. ; Landy Wang (landyw) 15-Nov-1998
  17. ;
  18. ; Environment:
  19. ;
  20. ; Kernel mode only.
  21. ;
  22. ; Revision History:
  23. ;
  24. ;--
  25. .586p
  26. .xlist
  27. include callconv.inc
  28. FPOFRAME macro a, b
  29. .FPO ( a, b, 0, 0, 0, 0 )
  30. endm
  31. .list
  32. _TEXT$00 SEGMENT PARA PUBLIC 'CODE'
  33. ASSUME DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
  34. page , 132
  35. subttl "Interlocked Swap PTE"
  36. ;++
  37. ;
  38. ; VOID
  39. ; InterlockedExchangePte (
  40. ; IN OUT PMMPTE Destination,
  41. ; IN ULONGLONG Exchange
  42. ; )
  43. ;
  44. ; Routine Description:
  45. ;
  46. ; This function performs an interlocked swap of a PTE. This is only needed
  47. ; for the PAE architecture where the PTE width is larger than the register
  48. ; width.
  49. ;
  50. ; Both PTEs must be valid or a careful write would have been done instead.
  51. ;
  52. ; Arguments:
  53. ;
  54. ; PtePointer - Address of PTE to update with new value.
  55. ;
  56. ; NewPteContents - The new value to put in the PTE.
  57. ;
  58. ; Return Value:
  59. ;
  60. ; None.
  61. ;
  62. ;--
  63. cPublicProc _InterlockedExchangePte ,3
  64. push ebx
  65. push esi
  66. mov ebx, [esp] + 16 ; ebx = NewPteContents lowpart
  67. mov ecx, [esp] + 20 ; ebx = NewPteContents highpart
  68. mov esi, [esp] + 12 ; esi = PtePointer
  69. mov edx, [esi] + 4
  70. mov eax, [esi] ; edx:eax = target pte contents
  71. swapagain:
  72. ;
  73. ; cmpxchg loads edx:eax with the new contents of the target quadword
  74. ; in the event of failure
  75. ;
  76. lock cmpxchg8b qword ptr [esi] ; compare and exchange
  77. jnz short swapagain ; if z clear, exchange failed
  78. pop esi
  79. pop ebx
  80. stdRET _InterlockedExchangePte
  81. stdENDP _InterlockedExchangePte
  82. _TEXT$00 ends
  83. end