xref: /reactos/ntoskrnl/ke/amd64/zeropage.S (revision 84344399)
1/*
2 * PROJECT:     ReactOS Kernel
3 * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE:     Fast zeroing of pages
5 * COPYRIGHT:   Copyright 2021 Jérôme Gardou <jerome.gardou@reactos.org>
6 */
7
8#include <asm.inc>
9
10/* FUNCTIONS ****************************************************************/
11.code
12
13/* Benchmarking from Timo on some AMD machine:
14    rep movsq : 128
15    movaps 175
16    movnti 620
17    movntdq: 620
18    movntps: 620
19    MS KeZeroPages (movnti unrolled): 883
20    MS KeZeroSinglePage (mov): 346
21
22    whole discussion in https://github.com/reactos/reactos/pull/3765
23    We stick with rep stosq.
24*/
25
26/*
27 * VOID
28 * KeZeroPages(PVOID Ptr, ULONG Size);
29 */
30PUBLIC KeZeroPages
31FUNC KeZeroPages
32    push rdi
33    .PUSHREG rdi
34    .ENDPROLOG
35
36    mov rdi, rcx
37    mov ecx, edx
38    shr ecx, 3
39    xor rax, rax
40    rep stosq
41    pop rdi
42    ret
43ENDFUNC
44
45END
46