b7a089b8419865142f0b677f689206766bd1ac2e
[reactos.git] / reactos / ntoskrnl / mm / kmap.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/mm/kmap.c
6 * PURPOSE: Implements the kernel memory pool
7 * PROGRAMMER: David Welch (welch@cwcom.net)
8 */
9
10 /* INCLUDES ****************************************************************/
11
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <internal/debug.h>
15
16 /* GLOBALS *****************************************************************/
17
18 /* FUNCTIONS ***************************************************************/
19 NTSTATUS
20 MiZeroPage(PFN_TYPE Page)
21 {
22 PVOID TempAddress;
23
24 TempAddress = MmCreateHyperspaceMapping(Page);
25 if (TempAddress == NULL)
26 {
27 return(STATUS_NO_MEMORY);
28 }
29 memset(TempAddress, 0, PAGE_SIZE);
30 MmDeleteHyperspaceMapping(TempAddress);
31 return(STATUS_SUCCESS);
32 }
33
34 NTSTATUS
35 MiCopyFromUserPage(PFN_TYPE DestPage, PVOID SourceAddress)
36 {
37 PVOID TempAddress;
38
39 TempAddress = MmCreateHyperspaceMapping(DestPage);
40 if (TempAddress == NULL)
41 {
42 return(STATUS_NO_MEMORY);
43 }
44 memcpy(TempAddress, SourceAddress, PAGE_SIZE);
45 MmDeleteHyperspaceMapping(TempAddress);
46 return(STATUS_SUCCESS);
47 }
48