mirror of
https://github.com/reactos/reactos.git
synced 2025-03-27 15:40:45 +00:00
Initial implementaions of MmAllocateContiguousMemorySpecifyCache() and MmFreeContiguousMemorySpecifyCache()
svn path=/trunk/; revision=7360
This commit is contained in:
parent
6ba4d142ab
commit
633f796e40
20 changed files with 278 additions and 58 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: adapter.c,v 1.9 2003/12/28 22:38:09 fireball Exp $
|
/* $Id: adapter.c,v 1.10 2003/12/31 05:33:03 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -49,7 +49,9 @@ HalAllocateAdapterChannel(
|
||||||
* - there are many unhandled cases
|
* - there are many unhandled cases
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
LARGE_INTEGER MinAddress;
|
||||||
LARGE_INTEGER MaxAddress;
|
LARGE_INTEGER MaxAddress;
|
||||||
|
LARGE_INTEGER BoundryAddressMultiple;
|
||||||
IO_ALLOCATION_ACTION Retval;
|
IO_ALLOCATION_ACTION Retval;
|
||||||
|
|
||||||
assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
assert(KeGetCurrentIrql() == DISPATCH_LEVEL);
|
||||||
|
@ -68,7 +70,9 @@ HalAllocateAdapterChannel(
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
||||||
/* 24-bit max address due to 16-bit dma controllers */
|
/* 24-bit max address due to 16-bit dma controllers */
|
||||||
|
MinAddress.QuadPart = 0x0000000;
|
||||||
MaxAddress.QuadPart = 0x1000000;
|
MaxAddress.QuadPart = 0x1000000;
|
||||||
|
BoundryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
/* why 64K alignment? */
|
/* why 64K alignment? */
|
||||||
/*
|
/*
|
||||||
|
@ -77,7 +81,12 @@ HalAllocateAdapterChannel(
|
||||||
* that. This can be optimized.
|
* that. This can be optimized.
|
||||||
*/
|
*/
|
||||||
AdapterObject->MapRegisterBase = MmAllocateContiguousAlignedMemory(
|
AdapterObject->MapRegisterBase = MmAllocateContiguousAlignedMemory(
|
||||||
NumberOfMapRegisters * PAGE_SIZE, MaxAddress, 0x10000 );
|
NumberOfMapRegisters * PAGE_SIZE,
|
||||||
|
MinAddress,
|
||||||
|
MaxAddress,
|
||||||
|
BoundryAddressMultiple,
|
||||||
|
MmCached,
|
||||||
|
0x10000 );
|
||||||
|
|
||||||
if(!AdapterObject->MapRegisterBase)
|
if(!AdapterObject->MapRegisterBase)
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -188,6 +197,8 @@ IoFreeAdapterChannel (PADAPTER_OBJECT AdapterObject)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
LARGE_INTEGER MaxAddress;
|
LARGE_INTEGER MaxAddress;
|
||||||
|
LARGE_INTEGER MinAddress;
|
||||||
|
LARGE_INTEGER BoundryAddressMultiple;
|
||||||
PWAIT_CONTEXT_BLOCK WaitContextBlock;
|
PWAIT_CONTEXT_BLOCK WaitContextBlock;
|
||||||
IO_ALLOCATION_ACTION Retval;
|
IO_ALLOCATION_ACTION Retval;
|
||||||
|
|
||||||
|
@ -206,10 +217,17 @@ IoFreeAdapterChannel (PADAPTER_OBJECT AdapterObject)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* 24-bit max address due to 16-bit dma controllers */
|
/* 24-bit max address due to 16-bit dma controllers */
|
||||||
|
MinAddress.QuadPart = 0x0000000;
|
||||||
MaxAddress.QuadPart = 0x1000000;
|
MaxAddress.QuadPart = 0x1000000;
|
||||||
|
BoundryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
AdapterObject->MapRegisterBase = MmAllocateContiguousAlignedMemory(
|
AdapterObject->MapRegisterBase = MmAllocateContiguousAlignedMemory(
|
||||||
WaitContextBlock->NumberOfMapRegisters * PAGE_SIZE, MaxAddress, 0x10000 );
|
WaitContextBlock->NumberOfMapRegisters * PAGE_SIZE,
|
||||||
|
MinAddress,
|
||||||
|
MaxAddress,
|
||||||
|
BoundryAddressMultiple,
|
||||||
|
MmCached,
|
||||||
|
0x10000 );
|
||||||
|
|
||||||
if(!AdapterObject->MapRegisterBase)
|
if(!AdapterObject->MapRegisterBase)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _INCLUDE_DDK_MMFUNCS_H
|
#ifndef _INCLUDE_DDK_MMFUNCS_H
|
||||||
#define _INCLUDE_DDK_MMFUNCS_H
|
#define _INCLUDE_DDK_MMFUNCS_H
|
||||||
/* $Id: mmfuncs.h,v 1.18 2003/11/18 05:11:41 royce Exp $ */
|
/* $Id: mmfuncs.h,v 1.19 2003/12/31 05:33:03 jfilby Exp $ */
|
||||||
/* MEMORY MANAGMENT ******************************************************/
|
/* MEMORY MANAGMENT ******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,10 +72,21 @@ MmAllocateContiguousMemory (
|
||||||
IN PHYSICAL_ADDRESS HighestAcceptableAddress
|
IN PHYSICAL_ADDRESS HighestAcceptableAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
|
PVOID STDCALL
|
||||||
|
MmAllocateContiguousMemorySpecifyCache (IN ULONG NumberOfBytes,
|
||||||
|
IN PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||||
|
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||||
|
IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
|
||||||
|
IN MEMORY_CACHING_TYPE CacheType
|
||||||
|
);
|
||||||
|
|
||||||
PVOID STDCALL
|
PVOID STDCALL
|
||||||
MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
||||||
|
IN PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||||
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
|
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||||
IN ULONG Alignment);
|
IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
|
||||||
|
IN MEMORY_CACHING_TYPE CacheType OPTIONAL,
|
||||||
|
IN ULONG Alignment);
|
||||||
|
|
||||||
PVOID
|
PVOID
|
||||||
STDCALL
|
STDCALL
|
||||||
|
@ -158,6 +169,12 @@ MmFreeContiguousMemory (
|
||||||
);
|
);
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
|
MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress,
|
||||||
|
IN ULONG NumberOfBytes,
|
||||||
|
IN MEMORY_CACHING_TYPE CacheType
|
||||||
|
);
|
||||||
|
VOID
|
||||||
|
STDCALL
|
||||||
MmFreeNonCachedMemory (
|
MmFreeNonCachedMemory (
|
||||||
IN PVOID BaseAddress,
|
IN PVOID BaseAddress,
|
||||||
IN ULONG NumberOfBytes
|
IN ULONG NumberOfBytes
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mmtypes.h,v 1.17 2003/11/03 20:27:51 gdalsnes Exp $ */
|
/* $Id: mmtypes.h,v 1.18 2003/12/31 05:33:03 jfilby Exp $ */
|
||||||
|
|
||||||
#ifndef _INCLUDE_DDK_MMTYPES_H
|
#ifndef _INCLUDE_DDK_MMTYPES_H
|
||||||
#define _INCLUDE_DDK_MMTYPES_H
|
#define _INCLUDE_DDK_MMTYPES_H
|
||||||
|
@ -76,11 +76,15 @@ typedef enum _MMFLUSH_TYPE
|
||||||
MmFlushForWrite
|
MmFlushForWrite
|
||||||
} MMFLUSH_TYPE;
|
} MMFLUSH_TYPE;
|
||||||
|
|
||||||
|
typedef enum _MEMORY_CACHING_TYPE_ORIG {
|
||||||
|
MmFrameBufferCached = 2
|
||||||
|
} MEMORY_CACHING_TYPE_ORIG;
|
||||||
|
|
||||||
typedef enum _MEMORY_CACHING_TYPE
|
typedef enum _MEMORY_CACHING_TYPE
|
||||||
{
|
{
|
||||||
MmNonCached = FALSE,
|
MmNonCached = FALSE,
|
||||||
MmCached = TRUE,
|
MmCached = TRUE,
|
||||||
MmFrameBufferCached,
|
MmWriteCombined = MmFrameBufferCached,
|
||||||
MmHardwareCoherentCached,
|
MmHardwareCoherentCached,
|
||||||
MmMaximumCacheType
|
MmMaximumCacheType
|
||||||
} MEMORY_CACHING_TYPE;
|
} MEMORY_CACHING_TYPE;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#define SEC_RESERVE (0x04000000)
|
#define SEC_RESERVE (0x04000000)
|
||||||
#define SEC_COMMIT (0x08000000)
|
#define SEC_COMMIT (0x08000000)
|
||||||
#define SEC_NOCACHE (0x10000000)
|
#define SEC_NOCACHE (0x10000000)
|
||||||
|
#define PAGE_NOACCESS (1)
|
||||||
#define PAGE_READONLY (2)
|
#define PAGE_READONLY (2)
|
||||||
#define PAGE_READWRITE (4)
|
#define PAGE_READWRITE (4)
|
||||||
#define PAGE_WRITECOPY (8)
|
#define PAGE_WRITECOPY (8)
|
||||||
|
@ -30,8 +31,8 @@
|
||||||
#define PAGE_EXECUTE_READWRITE (64)
|
#define PAGE_EXECUTE_READWRITE (64)
|
||||||
#define PAGE_EXECUTE_WRITECOPY (128)
|
#define PAGE_EXECUTE_WRITECOPY (128)
|
||||||
#define PAGE_GUARD (256)
|
#define PAGE_GUARD (256)
|
||||||
#define PAGE_NOACCESS (1)
|
|
||||||
#define PAGE_NOCACHE (512)
|
#define PAGE_NOCACHE (512)
|
||||||
|
#define PAGE_WRITECOMBINE (1024)
|
||||||
#define MEM_COMMIT (4096)
|
#define MEM_COMMIT (4096)
|
||||||
#define MEM_FREE (65536)
|
#define MEM_FREE (65536)
|
||||||
#define MEM_RESERVE (8192)
|
#define MEM_RESERVE (8192)
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: view.c,v 1.70 2003/12/30 18:52:03 fireball Exp $
|
/* $Id: view.c,v 1.71 2003/12/31 05:33:03 jfilby Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/cc/view.c
|
* FILE: ntoskrnl/cc/view.c
|
||||||
|
@ -489,11 +489,13 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
||||||
#ifdef CACHE_BITMAP
|
#ifdef CACHE_BITMAP
|
||||||
ULONG StartingOffset;
|
ULONG StartingOffset;
|
||||||
#endif
|
#endif
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
assert(Bcb);
|
assert(Bcb);
|
||||||
|
|
||||||
DPRINT("CcRosCreateCacheSegment()\n");
|
DPRINT("CcRosCreateCacheSegment()\n");
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
if (FileOffset >= Bcb->FileSize.u.LowPart)
|
if (FileOffset >= Bcb->FileSize.u.LowPart)
|
||||||
{
|
{
|
||||||
CacheSeg = NULL;
|
CacheSeg = NULL;
|
||||||
|
@ -598,7 +600,8 @@ CcRosCreateCacheSegment(PBCB Bcb,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
(PMEMORY_AREA*)¤t->MemoryArea,
|
(PMEMORY_AREA*)¤t->MemoryArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -1273,12 +1276,14 @@ CcInitView(VOID)
|
||||||
#ifdef CACHE_BITMAP
|
#ifdef CACHE_BITMAP
|
||||||
PMEMORY_AREA marea;
|
PMEMORY_AREA marea;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
#endif
|
#endif
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KPRIORITY Priority;
|
KPRIORITY Priority;
|
||||||
|
|
||||||
DPRINT("CcInitView()\n");
|
DPRINT("CcInitView()\n");
|
||||||
#ifdef CACHE_BITMAP
|
#ifdef CACHE_BITMAP
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
CiCacheSegMappingRegionHint = 0;
|
CiCacheSegMappingRegionHint = 0;
|
||||||
CiCacheSegMappingRegionBase = NULL;
|
CiCacheSegMappingRegionBase = NULL;
|
||||||
|
|
||||||
|
@ -1292,7 +1297,8 @@ CcInitView(VOID)
|
||||||
0,
|
0,
|
||||||
&marea,
|
&marea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,7 +194,8 @@ NTSTATUS MmCreateMemoryArea(struct _EPROCESS* Process,
|
||||||
ULONG Attributes,
|
ULONG Attributes,
|
||||||
MEMORY_AREA** Result,
|
MEMORY_AREA** Result,
|
||||||
BOOL FixedAddress,
|
BOOL FixedAddress,
|
||||||
BOOL TopDown);
|
BOOL TopDown,
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL);
|
||||||
MEMORY_AREA* MmOpenMemoryAreaByAddress(PMADDRESS_SPACE AddressSpace,
|
MEMORY_AREA* MmOpenMemoryAreaByAddress(PMADDRESS_SPACE AddressSpace,
|
||||||
PVOID Address);
|
PVOID Address);
|
||||||
NTSTATUS MmInitMemoryAreas(VOID);
|
NTSTATUS MmInitMemoryAreas(VOID);
|
||||||
|
@ -383,6 +384,7 @@ NTSTATUS
|
||||||
MmCreatePhysicalMemorySection(VOID);
|
MmCreatePhysicalMemorySection(VOID);
|
||||||
PHYSICAL_ADDRESS
|
PHYSICAL_ADDRESS
|
||||||
MmGetContinuousPages(ULONG NumberOfBytes,
|
MmGetContinuousPages(ULONG NumberOfBytes,
|
||||||
|
PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||||
PHYSICAL_ADDRESS HighestAcceptableAddress,
|
PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||||
ULONG Alignment);
|
ULONG Alignment);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: kthread.c,v 1.45 2003/12/30 18:52:04 fireball Exp $
|
/* $Id: kthread.c,v 1.46 2003/12/31 05:33:03 jfilby Exp $
|
||||||
*
|
*
|
||||||
* FILE: ntoskrnl/ke/kthread.c
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Microkernel thread support
|
* PURPOSE: Microkernel thread support
|
||||||
|
@ -88,6 +88,9 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
|
||||||
extern unsigned int init_stack;
|
extern unsigned int init_stack;
|
||||||
PMEMORY_AREA StackArea;
|
PMEMORY_AREA StackArea;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
KeInitializeDispatcherHeader(&Thread->DispatcherHeader,
|
KeInitializeDispatcherHeader(&Thread->DispatcherHeader,
|
||||||
InternalThreadType,
|
InternalThreadType,
|
||||||
|
@ -107,7 +110,8 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
|
||||||
0,
|
0,
|
||||||
&StackArea,
|
&StackArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: anonmem.c,v 1.23 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: anonmem.c,v 1.24 2003/12/31 05:33:03 jfilby Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/anonmem.c
|
* FILE: ntoskrnl/mm/anonmem.c
|
||||||
|
@ -548,6 +548,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
ULONG RegionSize;
|
ULONG RegionSize;
|
||||||
PVOID PBaseAddress;
|
PVOID PBaseAddress;
|
||||||
ULONG PRegionSize;
|
ULONG PRegionSize;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
DPRINT("NtAllocateVirtualMemory(*UBaseAddress %x, "
|
DPRINT("NtAllocateVirtualMemory(*UBaseAddress %x, "
|
||||||
"ZeroBits %d, *URegionSize %x, AllocationType %x, Protect %x)\n",
|
"ZeroBits %d, *URegionSize %x, AllocationType %x, Protect %x)\n",
|
||||||
|
@ -568,6 +569,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
|
|
||||||
PBaseAddress = *UBaseAddress;
|
PBaseAddress = *UBaseAddress;
|
||||||
PRegionSize = *URegionSize;
|
PRegionSize = *URegionSize;
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
BaseAddress = (PVOID)PAGE_ROUND_DOWN(PBaseAddress);
|
BaseAddress = (PVOID)PAGE_ROUND_DOWN(PBaseAddress);
|
||||||
RegionSize = PAGE_ROUND_UP(PBaseAddress + PRegionSize) -
|
RegionSize = PAGE_ROUND_UP(PBaseAddress + PRegionSize) -
|
||||||
|
@ -627,7 +629,8 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
Protect,
|
Protect,
|
||||||
&MemoryArea,
|
&MemoryArea,
|
||||||
PBaseAddress != 0,
|
PBaseAddress != 0,
|
||||||
(AllocationType & MEM_TOP_DOWN));
|
(AllocationType & MEM_TOP_DOWN),
|
||||||
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: cont.c,v 1.29 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: cont.c,v 1.30 2003/12/31 05:33:03 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -33,15 +33,29 @@ MmFreeContinuousPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
|
|
||||||
PVOID STDCALL
|
PVOID STDCALL
|
||||||
MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
||||||
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
|
IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL,
|
||||||
IN ULONG Alignment)
|
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||||
|
IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
|
||||||
|
IN MEMORY_CACHING_TYPE CacheType OPTIONAL,
|
||||||
|
IN ULONG Alignment)
|
||||||
{
|
{
|
||||||
PMEMORY_AREA MArea;
|
PMEMORY_AREA MArea;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID BaseAddress = 0;
|
PVOID BaseAddress = 0;
|
||||||
PHYSICAL_ADDRESS PBase;
|
PHYSICAL_ADDRESS PBase;
|
||||||
|
ULONG Attributes;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
|
Attributes = PAGE_EXECUTE_READWRITE | PAGE_SYSTEM;
|
||||||
|
if (CacheType == MmNonCached || CacheType == MmWriteCombined)
|
||||||
|
{
|
||||||
|
Attributes |= PAGE_NOCACHE;
|
||||||
|
}
|
||||||
|
if (CacheType == MmWriteCombined)
|
||||||
|
{
|
||||||
|
Attributes |= PAGE_WRITECOMBINE;
|
||||||
|
}
|
||||||
|
|
||||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
Status = MmCreateMemoryArea(NULL,
|
Status = MmCreateMemoryArea(NULL,
|
||||||
MmGetKernelAddressSpace(),
|
MmGetKernelAddressSpace(),
|
||||||
|
@ -51,7 +65,8 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
||||||
0,
|
0,
|
||||||
&MArea,
|
&MArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -60,6 +75,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
||||||
}
|
}
|
||||||
DPRINT( "Base = %x\n", BaseAddress );
|
DPRINT( "Base = %x\n", BaseAddress );
|
||||||
PBase = MmGetContinuousPages(NumberOfBytes,
|
PBase = MmGetContinuousPages(NumberOfBytes,
|
||||||
|
LowestAcceptableAddress,
|
||||||
HighestAcceptableAddress,
|
HighestAcceptableAddress,
|
||||||
Alignment);
|
Alignment);
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
|
@ -85,7 +101,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
|
||||||
#endif
|
#endif
|
||||||
MmCreateVirtualMapping(NULL,
|
MmCreateVirtualMapping(NULL,
|
||||||
(char*)BaseAddress + (i * 4096),
|
(char*)BaseAddress + (i * 4096),
|
||||||
PAGE_EXECUTE_READWRITE | PAGE_SYSTEM,
|
Attributes,
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
(LARGE_INTEGER)(PBase.QuadPart + (i * 4096)),
|
(LARGE_INTEGER)(PBase.QuadPart + (i * 4096)),
|
||||||
#else
|
#else
|
||||||
|
@ -127,8 +143,17 @@ PVOID STDCALL
|
||||||
MmAllocateContiguousMemory (IN ULONG NumberOfBytes,
|
MmAllocateContiguousMemory (IN ULONG NumberOfBytes,
|
||||||
IN PHYSICAL_ADDRESS HighestAcceptableAddress)
|
IN PHYSICAL_ADDRESS HighestAcceptableAddress)
|
||||||
{
|
{
|
||||||
|
PHYSICAL_ADDRESS LowestAcceptableAddress;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
|
LowestAcceptableAddress.QuadPart = 0;
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
return(MmAllocateContiguousAlignedMemory(NumberOfBytes,
|
return(MmAllocateContiguousAlignedMemory(NumberOfBytes,
|
||||||
|
LowestAcceptableAddress,
|
||||||
HighestAcceptableAddress,
|
HighestAcceptableAddress,
|
||||||
|
BoundaryAddressMultiple,
|
||||||
|
MmCached,
|
||||||
PAGE_SIZE));
|
PAGE_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,4 +193,91 @@ MmFreeContiguousMemory(IN PVOID BaseAddress)
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* MmAllocateContiguousMemorySpecifyCache@32
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Allocates a range of physically contiguous memory
|
||||||
|
* with a cache parameter.
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* NumberOfBytes
|
||||||
|
* Size of the memory block to allocate;
|
||||||
|
*
|
||||||
|
* LowestAcceptableAddress
|
||||||
|
* Lowest address valid for the caller.
|
||||||
|
*
|
||||||
|
* HighestAcceptableAddress
|
||||||
|
* Highest address valid for the caller.
|
||||||
|
*
|
||||||
|
* BoundaryAddressMultiple
|
||||||
|
* Address multiple not to be crossed by allocated buffer (optional).
|
||||||
|
*
|
||||||
|
* CacheType
|
||||||
|
* Type of caching to use.
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* The virtual address of the memory block on success;
|
||||||
|
* NULL on error.
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PVOID STDCALL
|
||||||
|
MmAllocateContiguousMemorySpecifyCache (IN ULONG NumberOfBytes,
|
||||||
|
IN PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||||
|
IN PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||||
|
IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL,
|
||||||
|
IN MEMORY_CACHING_TYPE CacheType)
|
||||||
|
{
|
||||||
|
return(MmAllocateContiguousAlignedMemory(NumberOfBytes,
|
||||||
|
LowestAcceptableAddress,
|
||||||
|
HighestAcceptableAddress,
|
||||||
|
BoundaryAddressMultiple,
|
||||||
|
CacheType,
|
||||||
|
PAGE_SIZE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* MmFreeContiguousMemorySpecifyCache@12
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Releases a range of physically contiguous memory allocated
|
||||||
|
* with MmAllocateContiguousMemorySpecifyCache.
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* BaseAddress
|
||||||
|
* Virtual address of the memory to be freed.
|
||||||
|
*
|
||||||
|
* NumberOfBytes
|
||||||
|
* Size of the memory block to free.
|
||||||
|
*
|
||||||
|
* CacheType
|
||||||
|
* Type of caching used.
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* None.
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID STDCALL
|
||||||
|
MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress,
|
||||||
|
IN ULONG NumberOfBytes,
|
||||||
|
IN MEMORY_CACHING_TYPE CacheType)
|
||||||
|
{
|
||||||
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
MmFreeMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
BaseAddress,
|
||||||
|
NumberOfBytes,
|
||||||
|
MmFreeContinuousPage,
|
||||||
|
NULL);
|
||||||
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -169,6 +169,7 @@ MmGetLRUNextUserPage(PHYSICAL_ADDRESS PreviousPhysicalAddress)
|
||||||
|
|
||||||
PHYSICAL_ADDRESS
|
PHYSICAL_ADDRESS
|
||||||
MmGetContinuousPages(ULONG NumberOfBytes,
|
MmGetContinuousPages(ULONG NumberOfBytes,
|
||||||
|
PHYSICAL_ADDRESS LowestAcceptableAddress,
|
||||||
PHYSICAL_ADDRESS HighestAcceptableAddress,
|
PHYSICAL_ADDRESS HighestAcceptableAddress,
|
||||||
ULONG Alignment)
|
ULONG Alignment)
|
||||||
{
|
{
|
||||||
|
@ -184,7 +185,7 @@ MmGetContinuousPages(ULONG NumberOfBytes,
|
||||||
|
|
||||||
start = -1;
|
start = -1;
|
||||||
length = 0;
|
length = 0;
|
||||||
for (i = 0; i < (HighestAcceptableAddress.QuadPart / PAGE_SIZE); )
|
for (i = (LowestAcceptableAddress.QuadPart / PAGE_SIZE); i < (HighestAcceptableAddress.QuadPart / PAGE_SIZE); )
|
||||||
{
|
{
|
||||||
if (MmPageArray[i].Flags.Type == MM_PHYSICAL_PAGE_FREE)
|
if (MmPageArray[i].Flags.Type == MM_PHYSICAL_PAGE_FREE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: iospace.c,v 1.23 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: iospace.c,v 1.24 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/iospace.c
|
* FILE: ntoskrnl/mm/iospace.c
|
||||||
|
@ -75,9 +75,11 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONG Attributes;
|
ULONG Attributes;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
DPRINT("MmMapIoSpace(%lx, %d, %d)\n", PhysicalAddress, NumberOfBytes, CacheEnable);
|
DPRINT("MmMapIoSpace(%lx, %d, %d)\n", PhysicalAddress, NumberOfBytes, CacheEnable);
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
Result = NULL;
|
Result = NULL;
|
||||||
Status = MmCreateMemoryArea (NULL,
|
Status = MmCreateMemoryArea (NULL,
|
||||||
|
@ -88,7 +90,8 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
|
||||||
0,
|
0,
|
||||||
&marea,
|
&marea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -487,7 +487,8 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
|
||||||
ULONG Attributes,
|
ULONG Attributes,
|
||||||
MEMORY_AREA** Result,
|
MEMORY_AREA** Result,
|
||||||
BOOL FixedAddress,
|
BOOL FixedAddress,
|
||||||
BOOL TopDown)
|
BOOL TopDown,
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Create a memory area
|
* FUNCTION: Create a memory area
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -501,6 +502,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
|
||||||
* NOTES: Lock the address space before calling this function
|
* NOTES: Lock the address space before calling this function
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
PVOID EndAddress;
|
||||||
ULONG tmpLength;
|
ULONG tmpLength;
|
||||||
DPRINT("MmCreateMemoryArea(Type %d, BaseAddress %x,"
|
DPRINT("MmCreateMemoryArea(Type %d, BaseAddress %x,"
|
||||||
"*BaseAddress %x, Length %x, Attributes %x, Result %x)\n",
|
"*BaseAddress %x, Length %x, Attributes %x, Result %x)\n",
|
||||||
|
@ -543,6 +545,13 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
|
||||||
{
|
{
|
||||||
return STATUS_ACCESS_VIOLATION;
|
return STATUS_ACCESS_VIOLATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (BoundaryAddressMultiple.QuadPart != 0)
|
||||||
|
{
|
||||||
|
EndAddress = *BaseAddress + tmpLength-1;
|
||||||
|
assert((*BaseAddress/BoundaryAddressMultiple) == (EndAddress/BoundaryAddressMultiple));
|
||||||
|
}
|
||||||
|
|
||||||
if (MmOpenMemoryAreaByRegion(AddressSpace,
|
if (MmOpenMemoryAreaByRegion(AddressSpace,
|
||||||
*BaseAddress,
|
*BaseAddress,
|
||||||
tmpLength)!=NULL)
|
tmpLength)!=NULL)
|
||||||
|
@ -551,7 +560,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
|
||||||
return(STATUS_CONFLICTING_ADDRESSES);
|
return(STATUS_CONFLICTING_ADDRESSES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*Result = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
|
*Result = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA),
|
||||||
TAG_MAREA);
|
TAG_MAREA);
|
||||||
RtlZeroMemory(*Result,sizeof(MEMORY_AREA));
|
RtlZeroMemory(*Result,sizeof(MEMORY_AREA));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mdl.c,v 1.55 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: mdl.c,v 1.56 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -39,7 +39,9 @@ MmInitializeMdlImplementation(VOID)
|
||||||
MEMORY_AREA* Result;
|
MEMORY_AREA* Result;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
MiMdlMappingRegionHint = 0;
|
MiMdlMappingRegionHint = 0;
|
||||||
MiMdlMappingRegionBase = NULL;
|
MiMdlMappingRegionBase = NULL;
|
||||||
|
|
||||||
|
@ -52,7 +54,8 @@ MmInitializeMdlImplementation(VOID)
|
||||||
0,
|
0,
|
||||||
&Result,
|
&Result,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: mminit.c,v 1.58 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: mminit.c,v 1.59 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top directory
|
* COPYRIGHT: See COPYING in the top directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -105,10 +105,12 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
ULONG ParamLength = KernelLength;
|
ULONG ParamLength = KernelLength;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
//ULONG i;
|
//ULONG i;
|
||||||
|
|
||||||
DPRINT("MmInitVirtualMemory(%x, %x)\n",LastKernelAddress, KernelLength);
|
DPRINT("MmInitVirtualMemory(%x, %x)\n",LastKernelAddress, KernelLength);
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
|
LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress);
|
||||||
|
|
||||||
MmInitMemoryAreas();
|
MmInitMemoryAreas();
|
||||||
|
@ -139,7 +141,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_map_desc,
|
&kernel_map_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = (PVOID)KPCR_BASE;
|
BaseAddress = (PVOID)KPCR_BASE;
|
||||||
MmCreateMemoryArea(NULL,
|
MmCreateMemoryArea(NULL,
|
||||||
|
@ -150,7 +153,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_kpcr_desc,
|
&kernel_kpcr_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = (PVOID)0xd0000000;
|
BaseAddress = (PVOID)0xd0000000;
|
||||||
MmCreateMemoryArea(NULL,
|
MmCreateMemoryArea(NULL,
|
||||||
|
@ -161,7 +165,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_mapped_low_mem_desc,
|
&kernel_mapped_low_mem_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = (PVOID)KERNEL_BASE;
|
BaseAddress = (PVOID)KERNEL_BASE;
|
||||||
Length = PAGE_ROUND_UP(((ULONG)&_text_end__)) - KERNEL_BASE;
|
Length = PAGE_ROUND_UP(((ULONG)&_text_end__)) - KERNEL_BASE;
|
||||||
|
@ -179,7 +184,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_text_desc,
|
&kernel_text_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)&_text_end__));
|
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)&_text_end__));
|
||||||
assert (BaseAddress == (PVOID)&_init_start__);
|
assert (BaseAddress == (PVOID)&_init_start__);
|
||||||
|
@ -195,7 +201,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_init_desc,
|
&kernel_init_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
Length = PAGE_ROUND_UP(((ULONG)&_bss_end__)) -
|
Length = PAGE_ROUND_UP(((ULONG)&_bss_end__)) -
|
||||||
PAGE_ROUND_UP(((ULONG)&_init_end__));
|
PAGE_ROUND_UP(((ULONG)&_init_end__));
|
||||||
|
@ -216,7 +223,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_data_desc,
|
&kernel_data_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)&_bss_end__));
|
BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)&_bss_end__));
|
||||||
Length = LastKernelAddress - (ULONG)BaseAddress;
|
Length = LastKernelAddress - (ULONG)BaseAddress;
|
||||||
|
@ -228,7 +236,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_param_desc,
|
&kernel_param_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = MiNonPagedPoolStart;
|
BaseAddress = MiNonPagedPoolStart;
|
||||||
MmCreateMemoryArea(NULL,
|
MmCreateMemoryArea(NULL,
|
||||||
|
@ -239,7 +248,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_pool_desc,
|
&kernel_pool_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = MiKernelMapStart;
|
BaseAddress = MiKernelMapStart;
|
||||||
Status = MmCreateMemoryArea(NULL,
|
Status = MmCreateMemoryArea(NULL,
|
||||||
|
@ -250,7 +260,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&MiKernelMapDescriptor,
|
&MiKernelMapDescriptor,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
BaseAddress = MmPagedPoolBase;
|
BaseAddress = MmPagedPoolBase;
|
||||||
Status = MmCreateMemoryArea(NULL,
|
Status = MmCreateMemoryArea(NULL,
|
||||||
|
@ -261,7 +272,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&MiPagedPoolDescriptor,
|
&MiPagedPoolDescriptor,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
|
|
||||||
MmInitializePagedPool();
|
MmInitializePagedPool();
|
||||||
|
|
||||||
|
@ -278,7 +290,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress,
|
||||||
0,
|
0,
|
||||||
&kernel_shared_data_desc,
|
&kernel_shared_data_desc,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE,
|
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE,
|
||||||
&MmSharedDataPagePhysicalAddress);
|
&MmSharedDataPagePhysicalAddress);
|
||||||
Status = MmCreateVirtualMapping(NULL,
|
Status = MmCreateVirtualMapping(NULL,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ncache.c,v 1.26 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: ncache.c,v 1.27 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -53,7 +53,9 @@ MmAllocateNonCachedMemory(IN ULONG NumberOfBytes)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONG Attributes;
|
ULONG Attributes;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
Result = NULL;
|
Result = NULL;
|
||||||
Status = MmCreateMemoryArea (NULL,
|
Status = MmCreateMemoryArea (NULL,
|
||||||
|
@ -64,7 +66,8 @@ MmAllocateNonCachedMemory(IN ULONG NumberOfBytes)
|
||||||
0,
|
0,
|
||||||
&marea,
|
&marea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: section.c,v 1.138 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: section.c,v 1.139 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/section.c
|
* FILE: ntoskrnl/mm/section.c
|
||||||
|
@ -3096,6 +3096,9 @@ MmMapViewOfSegment(PEPROCESS Process,
|
||||||
PMEMORY_AREA MArea;
|
PMEMORY_AREA MArea;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
Status = MmCreateMemoryArea(Process,
|
Status = MmCreateMemoryArea(Process,
|
||||||
AddressSpace,
|
AddressSpace,
|
||||||
|
@ -3105,7 +3108,8 @@ MmMapViewOfSegment(PEPROCESS Process,
|
||||||
Protect,
|
Protect,
|
||||||
&MArea,
|
&MArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
TopDown);
|
TopDown,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Mapping between 0x%.8X and 0x%.8X failed.\n",
|
DPRINT1("Mapping between 0x%.8X and 0x%.8X failed.\n",
|
||||||
|
@ -3665,9 +3669,11 @@ MmAllocateSection (IN ULONG Length)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PMADDRESS_SPACE AddressSpace;
|
PMADDRESS_SPACE AddressSpace;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
DPRINT("MmAllocateSection(Length %x)\n",Length);
|
DPRINT("MmAllocateSection(Length %x)\n",Length);
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
AddressSpace = MmGetKernelAddressSpace();
|
AddressSpace = MmGetKernelAddressSpace();
|
||||||
Result = NULL;
|
Result = NULL;
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
@ -3679,7 +3685,8 @@ MmAllocateSection (IN ULONG Length)
|
||||||
0,
|
0,
|
||||||
&marea,
|
&marea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.def,v 1.170 2003/11/22 11:56:17 ekohl Exp $
|
; $Id: ntoskrnl.def,v 1.171 2003/12/31 05:33:03 jfilby Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -498,8 +498,9 @@ LsaLogonUser@56
|
||||||
LsaLookupAuthenticationPackage@12
|
LsaLookupAuthenticationPackage@12
|
||||||
LsaRegisterLogonProcess@12
|
LsaRegisterLogonProcess@12
|
||||||
MmAdjustWorkingSetSize@12
|
MmAdjustWorkingSetSize@12
|
||||||
MmAllocateContiguousAlignedMemory@16
|
MmAllocateContiguousAlignedMemory@36
|
||||||
MmAllocateContiguousMemory@12
|
MmAllocateContiguousMemory@12
|
||||||
|
MmAllocateContiguousMemorySpecifyCache@32
|
||||||
MmAllocateNonCachedMemory@4
|
MmAllocateNonCachedMemory@4
|
||||||
MmBuildMdlForNonPagedPool@4
|
MmBuildMdlForNonPagedPool@4
|
||||||
MmCanFileBeTruncated@8
|
MmCanFileBeTruncated@8
|
||||||
|
@ -512,6 +513,7 @@ MmDisableModifiedWriteOfSection@4
|
||||||
MmFlushImageSection@8
|
MmFlushImageSection@8
|
||||||
MmForceSectionClosed@8
|
MmForceSectionClosed@8
|
||||||
MmFreeContiguousMemory@4
|
MmFreeContiguousMemory@4
|
||||||
|
MmFreeContiguousMemorySpecifyCache@12
|
||||||
MmFreeNonCachedMemory@8
|
MmFreeNonCachedMemory@8
|
||||||
MmGetPhysicalAddress@4
|
MmGetPhysicalAddress@4
|
||||||
MmGrowKernelStack@4
|
MmGrowKernelStack@4
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.edf,v 1.157 2003/11/22 11:56:17 ekohl Exp $
|
; $Id: ntoskrnl.edf,v 1.158 2003/12/31 05:33:03 jfilby Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -499,8 +499,9 @@ LsaLogonUser=LsaLogonUser@56
|
||||||
LsaLookupAuthenticationPackage=LsaLookupAuthenticationPackage@12
|
LsaLookupAuthenticationPackage=LsaLookupAuthenticationPackage@12
|
||||||
LsaRegisterLogonProcess=LsaRegisterLogonProcess@12
|
LsaRegisterLogonProcess=LsaRegisterLogonProcess@12
|
||||||
MmAdjustWorkingSetSize=MmAdjustWorkingSetSize@12
|
MmAdjustWorkingSetSize=MmAdjustWorkingSetSize@12
|
||||||
MmAllocateContiguousAlignedMemory=MmAllocateContiguousAlignedMemory@16
|
MmAllocateContiguousAlignedMemory=MmAllocateContiguousAlignedMemory@36
|
||||||
MmAllocateContiguousMemory=MmAllocateContiguousMemory@12
|
MmAllocateContiguousMemory=MmAllocateContiguousMemory@12
|
||||||
|
MmAllocateContiguousMemorySpecifyCache=MmAllocateContiguousMemorySpecifyCache@32
|
||||||
MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4
|
MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4
|
||||||
MmBuildMdlForNonPagedPool=MmBuildMdlForNonPagedPool@4
|
MmBuildMdlForNonPagedPool=MmBuildMdlForNonPagedPool@4
|
||||||
MmCanFileBeTruncated=MmCanFileBeTruncated@8
|
MmCanFileBeTruncated=MmCanFileBeTruncated@8
|
||||||
|
@ -513,6 +514,7 @@ MmDisableModifiedWriteOfSection=MmDisableModifiedWriteOfSection@4
|
||||||
MmFlushImageSection=MmFlushImageSection@8
|
MmFlushImageSection=MmFlushImageSection@8
|
||||||
MmForceSectionClosed=MmForceSectionClosed@8
|
MmForceSectionClosed=MmForceSectionClosed@8
|
||||||
MmFreeContiguousMemory=MmFreeContiguousMemory@4
|
MmFreeContiguousMemory=MmFreeContiguousMemory@4
|
||||||
|
MmFreeContiguousMemorySpecifyCache=MmFreeContiguousMemorySpecifyCache@12
|
||||||
MmFreeNonCachedMemory=MmFreeNonCachedMemory@8
|
MmFreeNonCachedMemory=MmFreeNonCachedMemory@8
|
||||||
MmGetPhysicalAddress=MmGetPhysicalAddress@4
|
MmGetPhysicalAddress=MmGetPhysicalAddress@4
|
||||||
MmGrowKernelStack=MmGrowKernelStack@4
|
MmGrowKernelStack=MmGrowKernelStack@4
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: process.c,v 1.122 2003/12/30 22:18:12 fireball Exp $
|
/* $Id: process.c,v 1.123 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -578,9 +578,12 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PEPORT ExceptionPort;
|
PEPORT ExceptionPort;
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
PMEMORY_AREA MemoryArea;
|
PMEMORY_AREA MemoryArea;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
DPRINT("NtCreateProcess(ObjectAttributes %x)\n",ObjectAttributes);
|
DPRINT("NtCreateProcess(ObjectAttributes %x)\n",ObjectAttributes);
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(ParentProcessHandle,
|
Status = ObReferenceObjectByHandle(ParentProcessHandle,
|
||||||
PROCESS_CREATE_PROCESS,
|
PROCESS_CREATE_PROCESS,
|
||||||
PsProcessType,
|
PsProcessType,
|
||||||
|
@ -751,7 +754,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PAGE_NOACCESS,
|
PAGE_NOACCESS,
|
||||||
&MemoryArea,
|
&MemoryArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(&Process->AddressSpace);
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
||||||
|
@ -770,7 +774,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PAGE_NOACCESS,
|
PAGE_NOACCESS,
|
||||||
&MemoryArea,
|
&MemoryArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(&Process->AddressSpace);
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
||||||
|
@ -789,7 +794,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PAGE_NOACCESS,
|
PAGE_NOACCESS,
|
||||||
&MemoryArea,
|
&MemoryArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(&Process->AddressSpace);
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
||||||
|
@ -807,7 +813,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
PAGE_READONLY,
|
PAGE_READONLY,
|
||||||
&MemoryArea,
|
&MemoryArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(&Process->AddressSpace);
|
MmUnlockAddressSpace(&Process->AddressSpace);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: w32call.c,v 1.10 2003/12/30 18:52:05 fireball Exp $
|
/* $Id: w32call.c,v 1.11 2003/12/31 05:33:04 jfilby Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -182,7 +182,9 @@ PsAllocateCallbackStack(ULONG StackSize)
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PMEMORY_AREA StackArea;
|
PMEMORY_AREA StackArea;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
PHYSICAL_ADDRESS BoundaryAddressMultiple;
|
||||||
|
|
||||||
|
BoundaryAddressMultiple.QuadPart = 0;
|
||||||
StackSize = PAGE_ROUND_UP(StackSize);
|
StackSize = PAGE_ROUND_UP(StackSize);
|
||||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||||
Status = MmCreateMemoryArea(NULL,
|
Status = MmCreateMemoryArea(NULL,
|
||||||
|
@ -193,7 +195,8 @@ PsAllocateCallbackStack(ULONG StackSize)
|
||||||
0,
|
0,
|
||||||
&StackArea,
|
&StackArea,
|
||||||
FALSE,
|
FALSE,
|
||||||
FALSE);
|
FALSE,
|
||||||
|
BoundaryAddressMultiple);
|
||||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue