[NTOS:KE] Rewrite KeZeroPages in assembly

We spend a lot of time in this function, let's optimize it.
This commit is contained in:
Jérôme Gardou 2021-06-24 11:41:24 +02:00 committed by Jérôme Gardou
parent 240dc77e42
commit 51258295bd
3 changed files with 33 additions and 9 deletions

View file

@ -1133,15 +1133,6 @@ KeInvalidateAllCaches(VOID)
return TRUE; return TRUE;
} }
VOID
FASTCALL
KeZeroPages(IN PVOID Address,
IN ULONG Size)
{
/* Not using XMMI in this routine */
RtlZeroMemory(Address, Size);
}
VOID VOID
NTAPI NTAPI
KiSaveProcessorState(IN PKTRAP_FRAME TrapFrame, KiSaveProcessorState(IN PKTRAP_FRAME TrapFrame,

View file

@ -0,0 +1,32 @@
/*
* PROJECT: ReactOS Kernel
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
* PURPOSE: Fast zeroing of pages
* COPYRIGHT: Copyright 2021 Jérôme Gardou <jerome.gardou@reactos.org>
*/
#include <asm.inc>
/* FUNCTIONS ****************************************************************/
.code
/*
* VOID
* FASTCALL
* KeZeroPages(void* ptr, ULONG Size)
*/
PUBLIC @KeZeroPages@8
FUNC @KeZeroPages@8
FPO 0, 0, 0, 0, 0, FRAME_FPO
push edi
mov edi, ecx
mov ecx, edx
shr ecx, 2
xor eax, eax
rep stosd
pop edi
ret
ENDFUNC
END

View file

@ -298,6 +298,7 @@ if(ARCH STREQUAL "i386")
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/ctxswitch.S ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/ctxswitch.S
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/trap.s ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/trap.s
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/usercall_asm.S ${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/usercall_asm.S
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/zeropage.S
${REACTOS_SOURCE_DIR}/ntoskrnl/rtl/i386/stack.S) ${REACTOS_SOURCE_DIR}/ntoskrnl/rtl/i386/stack.S)
list(APPEND SOURCE list(APPEND SOURCE
${REACTOS_SOURCE_DIR}/ntoskrnl/config/i386/cmhardwr.c ${REACTOS_SOURCE_DIR}/ntoskrnl/config/i386/cmhardwr.c