mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 08:25:53 +00:00
Some clean-up in ntoskrnl/mm. MmAllocateSection prototype moved in
internal/mm.h. svn path=/trunk/; revision=1081
This commit is contained in:
parent
56132bfb44
commit
bc30557a61
|
@ -63,28 +63,17 @@ extern inline unsigned int ADDRESS_AND_SIZE_TO_SPAN_PAGES(PVOID Va,
|
|||
*/
|
||||
#define BYTES_TO_PAGES(size) (?)
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates a range of physically contiguous cache aligned
|
||||
* memory from the non-paged pool
|
||||
* ARGUMENTS:
|
||||
* NumberOfBytes = Size of the memory block to allocate
|
||||
* HighestAcceptableAddress = Highest address valid for the caller
|
||||
* RETURNS: The virtual address of the memory block on success
|
||||
* NULL on error
|
||||
*/
|
||||
PVOID MmAllocateContiguousMemory(ULONG NumberOfBytes,
|
||||
PHYSICAL_ADDRESS HighestAcceptableAddress);
|
||||
|
||||
/*
|
||||
* FUNCTION: Allocates a virtual address range of noncached and cache
|
||||
* aligned memory
|
||||
* ARGUMENTS:
|
||||
* NumberOfBytes = Size of region to allocate
|
||||
* RETURNS: The base address of the range on success
|
||||
* NULL on failure
|
||||
*/
|
||||
PVOID MmAllocateNonCachedMemory(ULONG NumberOfBytes);
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
MmAllocateContiguousMemory (
|
||||
IN ULONG NumberOfBytes,
|
||||
IN PHYSICAL_ADDRESS HighestAcceptableAddress
|
||||
);
|
||||
PVOID
|
||||
STDCALL
|
||||
MmAllocateNonCachedMemory (
|
||||
IN ULONG NumberOfBytes
|
||||
);
|
||||
/*
|
||||
* FUNCTION: Fills in the corresponding physical page array for a given MDL
|
||||
* for a buffer in nonpaged system space
|
||||
|
@ -102,24 +91,17 @@ VOID MmBuildMdlForNonPagedPool(PMDL MemoryDescriptorList);
|
|||
* RETURNS: A pointer to the initalized MDL
|
||||
*/
|
||||
PMDL MmCreateMdl(PMDL MemoryDescriptorList, PVOID Base, ULONG Length);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases a range of physically contiguous memory allocated
|
||||
* with MmAllocateContiguousMemory
|
||||
* ARGUMENTS:
|
||||
* BaseAddress = Vritual address of the memory to be freed
|
||||
*/
|
||||
VOID MmFreeContiguousMemory(PVOID BaseAddress);
|
||||
|
||||
/*
|
||||
* FUNCTION: Releases a range of noncached memory allocated with
|
||||
* MmAllocateNonCachedMemory
|
||||
* ARGUMENTS:
|
||||
* BaseAddress = Virtual address to be freed
|
||||
* NumberOfBytes = size of the region to be freed
|
||||
*/
|
||||
VOID MmFreeNonCachedMemory(PVOID BaseAddress, ULONG NumberOfBytes);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
MmFreeContiguousMemory (
|
||||
IN OUT PVOID BaseAddress
|
||||
);
|
||||
VOID
|
||||
STDCALL
|
||||
MmFreeNonCachedMemory (
|
||||
IN PVOID BaseAddress,
|
||||
IN ULONG NumberOfBytes
|
||||
);
|
||||
/*
|
||||
* FUNCTION: Returns the length in bytes of a buffer described by an MDL
|
||||
* ARGUMENTS:
|
||||
|
@ -212,17 +194,19 @@ PVOID MmLockPagableDataSection(PVOID AddressWithinSection);
|
|||
*/
|
||||
VOID MmLockPagableSectionByHandle(PVOID ImageSectionHandle);
|
||||
|
||||
/*
|
||||
* FUNCTION: Maps a physical memory range into system space
|
||||
* ARGUMENTS:
|
||||
* PhysicalAddress = First physical address to map
|
||||
* NumberOfBytes = Number of bytes to map
|
||||
* CacheEnable = TRUE if the range can be cached
|
||||
* RETURNS: The base virtual address which maps the region
|
||||
*/
|
||||
PVOID MmMapIoSpace(PHYSICAL_ADDRESS PhysicalAddress, ULONG NumberOfBytes,
|
||||
BOOLEAN CacheEnable);
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
MmMapIoSpace (
|
||||
PHYSICAL_ADDRESS PhysicalAddress,
|
||||
ULONG NumberOfBytes,
|
||||
BOOLEAN CacheEnable
|
||||
);
|
||||
VOID
|
||||
STDCALL
|
||||
MmUnmapIoSpace (
|
||||
PVOID BaseAddress,
|
||||
ULONG NumberOfBytes
|
||||
);
|
||||
/*
|
||||
* FUNCTION: Maps the pages described by a given MDL
|
||||
* ARGUMENTS:
|
||||
|
@ -299,6 +283,5 @@ VOID MmUnlockPages(PMDL Mdl);
|
|||
*/
|
||||
VOID MmUnlockPagableImageSection(PVOID ImageSectionHandle);
|
||||
|
||||
VOID MmUnmapIoSpace(PVOID BaseAddress, ULONG NumberOfBytes);
|
||||
VOID MmUnmapLockedPages(PVOID BaseAddress, PMDL MemoryDescriptorList);
|
||||
PVOID MmAllocateSection(ULONG Length);
|
||||
|
||||
|
|
|
@ -35,11 +35,6 @@ LdrpMapSystemDll (
|
|||
HANDLE ProcessHandle,
|
||||
PVOID * LdrStartupAddress
|
||||
);
|
||||
PIMAGE_NT_HEADERS
|
||||
STDCALL
|
||||
RtlImageNtHeader (
|
||||
IN PVOID BaseAddress
|
||||
);
|
||||
PVOID
|
||||
LdrpGetSystemDllEntryPoint (
|
||||
VOID
|
||||
|
|
|
@ -59,6 +59,13 @@ typedef struct
|
|||
} MEMORY_AREA, *PMEMORY_AREA;
|
||||
|
||||
|
||||
/* FUNCTIONS */
|
||||
|
||||
PVOID
|
||||
STDCALL
|
||||
MmAllocateSection (
|
||||
IN ULONG Length
|
||||
);
|
||||
NTSTATUS MmCreateMemoryArea(KPROCESSOR_MODE Mode,
|
||||
PEPROCESS Process,
|
||||
ULONG Type,
|
||||
|
@ -78,7 +85,7 @@ NTSTATUS MmLockMemoryArea(MEMORY_AREA* MemoryArea);
|
|||
NTSTATUS MmUnlockMemoryArea(MEMORY_AREA* MemoryArea);
|
||||
NTSTATUS MmInitSectionImplementation(VOID);
|
||||
|
||||
void VirtualInit(boot_param* bp);
|
||||
/*void VirtualInit(boot_param* bp);*/
|
||||
|
||||
#define MM_LOWEST_USER_ADDRESS (4096)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: loader.c,v 1.49 2000/03/17 21:02:56 jfilby Exp $
|
||||
/* $Id: loader.c,v 1.50 2000/03/19 09:14:50 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -24,6 +24,7 @@
|
|||
#include <internal/linkage.h>
|
||||
#include <internal/module.h>
|
||||
#include <internal/ntoskrnl.h>
|
||||
#include <internal/mm.h>
|
||||
#include <internal/mmhal.h>
|
||||
#include <internal/ob.h>
|
||||
#include <internal/ps.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile_rex,v 1.61 2000/03/18 15:12:18 ea Exp $
|
||||
# $Id: makefile_rex,v 1.62 2000/03/19 09:14:49 ea Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
|
@ -35,8 +35,10 @@ KE_OBJECTS = ke/head.o ke/main.o ke/timer.o ke/error.o ke/catch.o \
|
|||
KE_I386_OBJECTS = ke/i386/thread.o ke/i386/usercall.o ke/i386/exp.o
|
||||
|
||||
MM_OBJECTS = mm/mm.o mm/freelist.o mm/pool.o mm/virtual.o \
|
||||
mm/mdl.o mm/zone.o mm/special.o mm/paging.o \
|
||||
mm/section.o mm/marea.o mm/ppool.o mm/npool.o mm/pagefile.o
|
||||
mm/mdl.o mm/zone.o mm/paging.o mm/section.o \
|
||||
mm/marea.o mm/ppool.o mm/npool.o mm/pagefile.o \
|
||||
mm/cont.o mm/iospace.o mm/ncache.o
|
||||
|
||||
|
||||
MM_I386_OBJECTS = mm/i386/page.o mm/i386/memsafe.o
|
||||
|
||||
|
@ -192,7 +194,8 @@ $(TARGET).exe: $(OBJECTS) $(TARGET).def
|
|||
--dllname $(TARGET).exe \
|
||||
--base-file base.tmp \
|
||||
--output-exp temp.exp \
|
||||
--def $(TARGET).edf
|
||||
--def $(TARGET).edf \
|
||||
--kill-at
|
||||
- $(RM) base.tmp
|
||||
$(CC) \
|
||||
$(TARGET).o \
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: cont.c,v 1.3 2000/03/19 09:14:51 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/cont.c
|
||||
|
@ -16,13 +17,74 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PVOID MmAllocateContiguousMemory(ULONG NumberOfBytes,
|
||||
PHYSICAL_ADDRESS HighestAcceptableAddress)
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MmAllocateContiguousMemory@12
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocates a range of physically contiguous cache aligned
|
||||
* memory from the non-paged pool.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* NumberOfBytes
|
||||
* Size of the memory block to allocate;
|
||||
*
|
||||
* HighestAcceptableAddress
|
||||
* Highest address valid for the caller.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* The virtual address of the memory block on success;
|
||||
* NULL on error.
|
||||
*
|
||||
* NOTE
|
||||
* Description taken from include/ddk/mmfuncs.h.
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
PVOID
|
||||
STDCALL
|
||||
MmAllocateContiguousMemory (
|
||||
IN ULONG NumberOfBytes,
|
||||
IN PHYSICAL_ADDRESS HighestAcceptableAddress
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID MmFreeContiguousMemory(PVOID BaseAddress)
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MmFreeContiguousMemory@4
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Releases a range of physically contiguous memory allocated
|
||||
* with MmAllocateContiguousMemory.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* BaseAddress
|
||||
* Virtual address of the memory to be freed.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* None.
|
||||
*
|
||||
* NOTE
|
||||
* Description taken from include/ddk/mmfuncs.h.
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
MmFreeContiguousMemory (
|
||||
IN OUT PVOID BaseAddress
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
/* $Id: iospace.c,v 1.2 2000/03/19 09:14:51 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/iospace.c
|
||||
* PURPOSE: Mapping io space
|
||||
* PURPOSE: Mapping I/O space
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* Created 22/05/98
|
||||
|
@ -11,19 +12,133 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/mm.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PVOID MmMapIoSpace(PHYSICAL_ADDRESS PhysicalAddress,
|
||||
ULONG NumberOfBytes,
|
||||
BOOLEAN CacheEnable)
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MmMapIoSpace@16
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Maps a physical memory range into system space.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* PhysicalAddress
|
||||
* First physical address to map;
|
||||
*
|
||||
* NumberOfBytes
|
||||
* Number of bytes to map;
|
||||
*
|
||||
* CacheEnable
|
||||
* TRUE if the range can be cached.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* The base virtual address which maps the region.
|
||||
*
|
||||
* NOTE
|
||||
* Description moved here from include/ddk/mmfuncs.h.
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
PVOID
|
||||
STDCALL
|
||||
MmMapIoSpace (
|
||||
IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||
IN ULONG NumberOfBytes,
|
||||
IN BOOLEAN CacheEnable
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
PVOID Result;
|
||||
MEMORY_AREA * marea;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
ULONG Attributes;
|
||||
|
||||
Result = NULL;
|
||||
Status = MmCreateMemoryArea (
|
||||
KernelMode,
|
||||
PsGetCurrentProcess (),
|
||||
MEMORY_AREA_IO_MAPPING,
|
||||
& Result,
|
||||
NumberOfBytes,
|
||||
0,
|
||||
& marea
|
||||
);
|
||||
if (STATUS_SUCCESS != Status)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
Attributes = ( PA_WRITE
|
||||
| PA_READ
|
||||
| PA_EXECUTE
|
||||
| PA_SYSTEM
|
||||
);
|
||||
if (!CacheEnable)
|
||||
{
|
||||
Attributes |= (PA_PWT | PA_PCD);
|
||||
}
|
||||
for ( i = 0;
|
||||
(i <= (NumberOfBytes / PAGESIZE));
|
||||
i ++
|
||||
)
|
||||
{
|
||||
MmSetPage (
|
||||
NULL,
|
||||
(Result + (i * PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
( PhysicalAddress.u.LowPart
|
||||
+ (i * PAGESIZE)
|
||||
)
|
||||
);
|
||||
}
|
||||
return ((PVOID) Result);
|
||||
}
|
||||
|
||||
VOID MmUnmapIoSpace(PVOID BaseAddress, ULONG NumberOfBytes)
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MmUnmapIoSpace@8
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Unmaps a physical memory range from system space.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* BaseAddress
|
||||
* The base virtual address which maps the region;
|
||||
*
|
||||
* NumberOfBytes
|
||||
* Number of bytes to unmap.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* None.
|
||||
*
|
||||
* NOTE
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
MmUnmapIoSpace (
|
||||
IN PVOID BaseAddress,
|
||||
IN ULONG NumberOfBytes
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
(VOID) MmFreeMemoryArea (
|
||||
PsGetCurrentProcess (),
|
||||
BaseAddress,
|
||||
NumberOfBytes,
|
||||
FALSE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
/* $Id: ncache.c,v 1.3 2000/03/19 09:14:51 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/cont.c
|
||||
|
@ -11,17 +12,118 @@
|
|||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/mm.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PVOID MmAllocateNonCachedMemory(ULONG NumberOfBytes)
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MmAllocateNonCachedMemory@4
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Allocates a virtual address range of noncached and cache
|
||||
* aligned memory.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* NumberOfBytes
|
||||
* Size of region to allocate.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* The base address of the range on success;
|
||||
* NULL on failure.
|
||||
*
|
||||
* NOTE
|
||||
* Description taken from include/ddk/mmfuncs.h.
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
PVOID
|
||||
STDCALL
|
||||
MmAllocateNonCachedMemory (
|
||||
IN ULONG NumberOfBytes
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
PVOID Result;
|
||||
MEMORY_AREA * marea;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
||||
Result = NULL;
|
||||
Status = MmCreateMemoryArea (
|
||||
KernelMode,
|
||||
PsGetCurrentProcess (),
|
||||
MEMORY_AREA_NO_CACHE,
|
||||
& Result,
|
||||
NumberOfBytes,
|
||||
0,
|
||||
& marea
|
||||
);
|
||||
if (STATUS_SUCCESS != Status)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
for ( i = 0;
|
||||
(i <= (NumberOfBytes / PAGESIZE));
|
||||
i ++
|
||||
)
|
||||
{
|
||||
MmSetPage (
|
||||
NULL,
|
||||
(Result + (i * PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
(ULONG) MmAllocPage ()
|
||||
);
|
||||
}
|
||||
return ((PVOID) Result);
|
||||
}
|
||||
|
||||
VOID MmFreeNonCachedMemory(PVOID BaseAddress, ULONG NumberOfBytes)
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME EXPORTED
|
||||
* MmFreeNonCachedMemory@8
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Releases a range of noncached memory allocated with
|
||||
* MmAllocateNonCachedMemory.
|
||||
*
|
||||
* ARGUMENTS
|
||||
* BaseAddress
|
||||
* Virtual address to be freed;
|
||||
*
|
||||
* NumberOfBytes
|
||||
* Size of the region to be freed.
|
||||
*
|
||||
* RETURN VALUE
|
||||
* None.
|
||||
*
|
||||
* NOTE
|
||||
* Description taken from include/ddk/mmfuncs.h.
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
VOID
|
||||
STDCALL
|
||||
MmFreeNonCachedMemory (
|
||||
IN PVOID BaseAddress,
|
||||
IN ULONG NumberOfBytes
|
||||
)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
MmFreeMemoryArea (
|
||||
PsGetCurrentProcess (),
|
||||
BaseAddress,
|
||||
NumberOfBytes,
|
||||
TRUE
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: section.c,v 1.23 2000/02/13 16:05:18 dwelch Exp $
|
||||
/* $Id: section.c,v 1.24 2000/03/19 09:14:51 ea Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -540,4 +540,65 @@ NTSTATUS STDCALL NtExtendSection(IN HANDLE SectionHandle,
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* NAME INTERNAL
|
||||
* MmAllocateSection@4
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* ARGUMENTS
|
||||
* Length
|
||||
*
|
||||
* RETURN VALUE
|
||||
*
|
||||
* NOTE
|
||||
* Code taken from ntoskrnl/mm/special.c.
|
||||
*
|
||||
* REVISIONS
|
||||
*
|
||||
*/
|
||||
PVOID
|
||||
STDCALL
|
||||
MmAllocateSection (
|
||||
IN ULONG Length
|
||||
)
|
||||
{
|
||||
PVOID Result;
|
||||
MEMORY_AREA * marea;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
||||
DPRINT("MmAllocateSection(Length %x)\n",Length);
|
||||
|
||||
Result = NULL;
|
||||
Status = MmCreateMemoryArea (
|
||||
KernelMode,
|
||||
PsGetCurrentProcess (),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
& Result,
|
||||
Length,
|
||||
0,
|
||||
& marea
|
||||
);
|
||||
if (STATUS_SUCCESS != Status)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
DPRINT("Result %p\n",Result);
|
||||
for ( i = 0;
|
||||
(i <= (Length / PAGESIZE));
|
||||
i ++
|
||||
)
|
||||
{
|
||||
MmSetPage (
|
||||
NULL,
|
||||
(Result + (i * PAGESIZE)),
|
||||
PAGE_READWRITE,
|
||||
(ULONG) MmAllocPage ()
|
||||
);
|
||||
}
|
||||
return ((PVOID) Result);
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/special.c
|
||||
* PURPOSE: Special types of memory region
|
||||
* PROGRAMMER: David Welch (welch@mcmail.com)
|
||||
* UPDATE HISTORY:
|
||||
* Created 22/05/98
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <internal/mm.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
PVOID MmAllocateSection(ULONG Length)
|
||||
{
|
||||
PVOID Result;
|
||||
MEMORY_AREA* marea;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
||||
DPRINT("MmAllocateSection(Length %x)\n",Length);
|
||||
|
||||
Result = 0;
|
||||
Status = MmCreateMemoryArea(KernelMode,
|
||||
PsGetCurrentProcess(),
|
||||
MEMORY_AREA_SYSTEM,
|
||||
&Result,
|
||||
Length,
|
||||
0,
|
||||
&marea);
|
||||
if (Status!=STATUS_SUCCESS)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
DPRINT("Result %p\n",Result);
|
||||
for (i=0;i<=(Length/PAGESIZE);i++)
|
||||
{
|
||||
MmSetPage(NULL,
|
||||
Result+(i*PAGESIZE),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)MmAllocPage());
|
||||
}
|
||||
return((PVOID)Result);
|
||||
}
|
||||
|
||||
PVOID MmAllocateContiguousMemory(ULONG NumberOfBytes,
|
||||
PHYSICAL_ADDRESS HighestAcceptableAddress)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID MmFreeContiguousMemory(PVOID BaseAddress)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
PVOID MmMapIoSpace(PHYSICAL_ADDRESS PhysicalAddress,
|
||||
ULONG NumberOfBytes,
|
||||
BOOLEAN CacheEnable)
|
||||
{
|
||||
PVOID Result;
|
||||
MEMORY_AREA* marea;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
ULONG Attributes;
|
||||
|
||||
Result = 0;
|
||||
Status = MmCreateMemoryArea(KernelMode,
|
||||
PsGetCurrentProcess(),
|
||||
MEMORY_AREA_IO_MAPPING,
|
||||
&Result,
|
||||
NumberOfBytes,
|
||||
0,
|
||||
&marea);
|
||||
if (Status!=STATUS_SUCCESS)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
Attributes = PA_WRITE | PA_READ | PA_EXECUTE | PA_SYSTEM;
|
||||
if (!CacheEnable)
|
||||
{
|
||||
Attributes = Attributes | PA_PWT | PA_PCD;
|
||||
}
|
||||
for (i=0;i<=(NumberOfBytes/PAGESIZE);i++)
|
||||
{
|
||||
MmSetPage(NULL,
|
||||
Result + (i * PAGESIZE),
|
||||
PAGE_READWRITE,
|
||||
PhysicalAddress.u.LowPart +
|
||||
(i * PAGESIZE));
|
||||
}
|
||||
return((PVOID)Result);
|
||||
}
|
||||
|
||||
VOID MmUnmapIoSpace(PVOID BaseAddress, ULONG NumberOfBytes)
|
||||
{
|
||||
(void)MmFreeMemoryArea(PsGetCurrentProcess(),BaseAddress,NumberOfBytes,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
PVOID MmAllocateNonCachedMemory(ULONG NumberOfBytes)
|
||||
{
|
||||
PVOID Result;
|
||||
MEMORY_AREA* marea;
|
||||
NTSTATUS Status;
|
||||
ULONG i;
|
||||
|
||||
Result = 0;
|
||||
Status = MmCreateMemoryArea(KernelMode,
|
||||
PsGetCurrentProcess(),
|
||||
MEMORY_AREA_NO_CACHE,
|
||||
&Result,
|
||||
NumberOfBytes,
|
||||
0,
|
||||
&marea);
|
||||
if (Status!=STATUS_SUCCESS)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
for (i=0;i<=(NumberOfBytes/PAGESIZE);i++)
|
||||
{
|
||||
MmSetPage(NULL,
|
||||
Result+(i*PAGESIZE),
|
||||
PAGE_READWRITE,
|
||||
(ULONG)MmAllocPage());
|
||||
}
|
||||
return((PVOID)Result);
|
||||
}
|
||||
|
||||
VOID MmFreeNonCachedMemory(PVOID BaseAddress, ULONG NumberOfBytes)
|
||||
{
|
||||
MmFreeMemoryArea(PsGetCurrentProcess(),BaseAddress,NumberOfBytes,TRUE);
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.60 2000/03/18 15:12:18 ea Exp $
|
||||
; $Id: ntoskrnl.def,v 1.61 2000/03/19 09:14:49 ea Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -227,8 +227,13 @@ KeSetEvent
|
|||
KeSetTimer
|
||||
KeSynchronizeExecution
|
||||
KeWaitForSingleObject
|
||||
MmAllocateContiguousMemory@12
|
||||
MmAllocateNonCachedMemory@4
|
||||
MmFreeContiguousMemory@4
|
||||
MmFreeNonCachedMemory@8
|
||||
MmGetSystemAddressForMdl
|
||||
MmMapIoSpace
|
||||
MmMapIoSpace@16
|
||||
MmUnmapIoSpace@8
|
||||
NlsAnsiCodePage DATA
|
||||
NlsLeadByteInfo DATA
|
||||
NlsMbCodePageTag DATA
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.47 2000/03/18 15:12:18 ea Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.48 2000/03/19 09:14:50 ea Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -227,8 +227,13 @@ KeSetEvent
|
|||
KeSetTimer
|
||||
KeSynchronizeExecution
|
||||
KeWaitForSingleObject
|
||||
MmAllocateContiguousMemory=MmAllocateContiguousMemory@12
|
||||
MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4
|
||||
MmFreeContiguousMemory=MmFreeContiguousMemory@4
|
||||
MmFreeNonCachedMemory=MmFreeNonCachedMemory@8
|
||||
MmGetSystemAddressForMdl
|
||||
MmMapIoSpace
|
||||
MmMapIoSpace=MmMapIoSpace@16
|
||||
MmUnmapIoSpace=MmUnmapIoSpace@8
|
||||
NlsAnsiCodePage DATA
|
||||
NlsLeadByteInfo DATA
|
||||
NlsMbCodePageTag DATA
|
||||
|
|
Loading…
Reference in a new issue