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.

70 lines
1.5 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 a page of memory is 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. ; KeZeroPage (
  30. ; IN PVOID PageBase
  31. ; )
  32. ;
  33. ; Routine Description:
  34. ;
  35. ; This routine zeros the specfied page of memory using nontemporal moves.
  36. ;
  37. ; Arguments:
  38. ;
  39. ; PageBase (rcx) - Supplies the address of the page to zero.
  40. ;
  41. ; Return Value:
  42. ;
  43. ; None.
  44. ;
  45. ;--
  46. LEAF_ENTRY KeZeroPage, _TEXT$00
  47. pxor xmm0, xmm0 ; clear register
  48. mov eax, PAGE_SIZE / 128 ; compute loop count
  49. KeZP10: movntdq 0[rcx], xmm0 ; zero 128-byte block
  50. movntdq 16[rcx], xmm0 ;
  51. movntdq 32[rcx], xmm0 ;
  52. movntdq 48[rcx], xmm0 ;
  53. movntdq 64[rcx], xmm0 ;
  54. movntdq 80[rcx], xmm0 ;
  55. movntdq 96[rcx], xmm0 ;
  56. movntdq 112[rcx], xmm0 ;
  57. add rcx, 128 ; advance to next block
  58. dec eax ; decrement loop count
  59. jnz short KeZP10 ; if nz, more bytes to zero
  60. sfence ; force stores to complete
  61. ret ;
  62. LEAF_END KeZeroPage, _TEXT$00
  63. end