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.

72 lines
1.7 KiB

  1. title "Zero Page"
  2. ;++
  3. ;
  4. ; Copyright (c) 2001 Microsoft Corporation
  5. ;
  6. ; Module Name:
  7. ;
  8. ; zero.asm
  9. ;
  10. ; Abstract:
  11. ;
  12. ; This module implements the architecture dependent code necessary to
  13. ; zero pages of memory in the fastest possible way.
  14. ;
  15. ; Author:
  16. ;
  17. ; David N. Cutler (davec) 9-Jan-2001
  18. ;
  19. ; Environment:
  20. ;
  21. ; Kernel mode only.
  22. ;
  23. ;--
  24. include ksamd64.inc
  25. subttl "Zero Page"
  26. ;++
  27. ;
  28. ; VOID
  29. ; KeZeroPages (
  30. ; IN PVOID PageBase,
  31. ; IN SIZE_T NumberOfBytes
  32. ; )
  33. ;
  34. ; Routine Description:
  35. ;
  36. ; This routine zeros the specified pages of memory using nontemporal moves.
  37. ;
  38. ; Arguments:
  39. ;
  40. ; PageBase (rcx) - Supplies the address of the pages to zero.
  41. ;
  42. ; NumberOfBytes (rdx) - Supplies the number of bytes to zero. Always a PAGE_SIZE multiple.
  43. ;
  44. ; Return Value:
  45. ;
  46. ; None.
  47. ;
  48. ;--
  49. LEAF_ENTRY KeZeroPages, _TEXT$00
  50. pxor xmm0, xmm0 ; clear register
  51. shr rdx, 7 ; number of 128 byte chunks (loop count)
  52. KeZP10: movntdq 0[rcx], xmm0 ; zero 128-byte block
  53. movntdq 16[rcx], xmm0 ;
  54. movntdq 32[rcx], xmm0 ;
  55. movntdq 48[rcx], xmm0 ;
  56. movntdq 64[rcx], xmm0 ;
  57. movntdq 80[rcx], xmm0 ;
  58. movntdq 96[rcx], xmm0 ;
  59. movntdq 112[rcx], xmm0 ;
  60. add rcx, 128 ; advance to next block
  61. dec rdx ; decrement loop count
  62. jnz short KeZP10 ; if nz, more bytes to zero
  63. sfence ; force stores to complete
  64. ret ;
  65. LEAF_END KeZeroPages, _TEXT$00
  66. end