Implement MmZeroPages() routine
ci/woodpecker/push/build Pipeline was successful
Details
ci/woodpecker/push/build Pipeline was successful
Details
This commit is contained in:
parent
b1c2b209e3
commit
9ea1be96db
|
@ -21,6 +21,7 @@ list(APPEND XTOSKRNL_SOURCE
|
|||
${XTOSKRNL_SOURCE_DIR}/ke/${ARCH}/krnlinit.c
|
||||
${XTOSKRNL_SOURCE_DIR}/ke/${ARCH}/proc.c
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/kpools.c
|
||||
${XTOSKRNL_SOURCE_DIR}/mm/${ARCH}/pages.c
|
||||
${XTOSKRNL_SOURCE_DIR}/rtl/atomic.c
|
||||
${XTOSKRNL_SOURCE_DIR}/rtl/byteswap.c
|
||||
${XTOSKRNL_SOURCE_DIR}/rtl/memory.c
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/mm/amd64/pages.c
|
||||
* DESCRIPTION: Architecture dependent paging support
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtos.h>
|
||||
|
||||
|
||||
/**
|
||||
* Fills a section of memory with zeroes like RtlZeroMemory(), but in more efficient way.
|
||||
*
|
||||
* @param Address
|
||||
* Supplies an address of the page to be filled with zeroes.
|
||||
*
|
||||
* @param Size
|
||||
* Number of bytes to be filled with zeros. This always should be a multiply of page size.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTFASTCALL
|
||||
VOID
|
||||
MmZeroPages(IN PVOID Address,
|
||||
IN ULONG Size)
|
||||
{
|
||||
asm volatile("xor %%rax, %%rax\n"
|
||||
"mov %0, %%rdi\n"
|
||||
"mov %1, %%ecx\n"
|
||||
"shr $3, %%ecx\n"
|
||||
"rep stosq\n"
|
||||
:
|
||||
: "m" (Address),
|
||||
"m" (Size)
|
||||
: "rax",
|
||||
"rdi",
|
||||
"ecx",
|
||||
"memory");
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/**
|
||||
* PROJECT: ExectOS
|
||||
* COPYRIGHT: See COPYING.md in the top level directory
|
||||
* FILE: xtoskrnl/mm/i686/pages.c
|
||||
* DESCRIPTION: Architecture dependent paging support
|
||||
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
|
||||
*/
|
||||
|
||||
#include <xtos.h>
|
||||
|
||||
|
||||
/**
|
||||
* Fills a section of memory with zeroes like RtlZeroMemory(), but in more efficient way.
|
||||
*
|
||||
* @param Address
|
||||
* Supplies an address of the page to be filled with zeroes.
|
||||
*
|
||||
* @param Size
|
||||
* Number of bytes to be filled with zeros. This always should be a multiply of page size.
|
||||
*
|
||||
* @return This routine does not return any value.
|
||||
*
|
||||
* @since XT 1.0
|
||||
*/
|
||||
XTFASTCALL
|
||||
VOID
|
||||
MmZeroPages(IN PVOID Address,
|
||||
IN ULONG Size)
|
||||
{
|
||||
asm volatile("xor %%eax, %%eax\n"
|
||||
"rep stosb"
|
||||
: "=D"(Address),
|
||||
"=c"(Size)
|
||||
: "0"(Address),
|
||||
"1"(Size),
|
||||
"a"(0)
|
||||
: "memory");
|
||||
}
|
Loading…
Reference in New Issue