diff --git a/reactos/hal/halx86/adapter.c b/reactos/hal/halx86/adapter.c index b989635b3a0..581d1e240a9 100644 --- a/reactos/hal/halx86/adapter.c +++ b/reactos/hal/halx86/adapter.c @@ -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 * PROJECT: ReactOS kernel @@ -49,7 +49,9 @@ HalAllocateAdapterChannel( * - there are many unhandled cases */ { + LARGE_INTEGER MinAddress; LARGE_INTEGER MaxAddress; + LARGE_INTEGER BoundryAddressMultiple; IO_ALLOCATION_ACTION Retval; assert(KeGetCurrentIrql() == DISPATCH_LEVEL); @@ -68,7 +70,9 @@ HalAllocateAdapterChannel( return STATUS_SUCCESS; /* 24-bit max address due to 16-bit dma controllers */ + MinAddress.QuadPart = 0x0000000; MaxAddress.QuadPart = 0x1000000; + BoundryAddressMultiple.QuadPart = 0; /* why 64K alignment? */ /* @@ -77,7 +81,12 @@ HalAllocateAdapterChannel( * that. This can be optimized. */ AdapterObject->MapRegisterBase = MmAllocateContiguousAlignedMemory( - NumberOfMapRegisters * PAGE_SIZE, MaxAddress, 0x10000 ); + NumberOfMapRegisters * PAGE_SIZE, + MinAddress, + MaxAddress, + BoundryAddressMultiple, + MmCached, + 0x10000 ); if(!AdapterObject->MapRegisterBase) return STATUS_INSUFFICIENT_RESOURCES; @@ -188,6 +197,8 @@ IoFreeAdapterChannel (PADAPTER_OBJECT AdapterObject) */ { LARGE_INTEGER MaxAddress; + LARGE_INTEGER MinAddress; + LARGE_INTEGER BoundryAddressMultiple; PWAIT_CONTEXT_BLOCK WaitContextBlock; IO_ALLOCATION_ACTION Retval; @@ -206,10 +217,17 @@ IoFreeAdapterChannel (PADAPTER_OBJECT AdapterObject) */ /* 24-bit max address due to 16-bit dma controllers */ + MinAddress.QuadPart = 0x0000000; MaxAddress.QuadPart = 0x1000000; + BoundryAddressMultiple.QuadPart = 0; AdapterObject->MapRegisterBase = MmAllocateContiguousAlignedMemory( - WaitContextBlock->NumberOfMapRegisters * PAGE_SIZE, MaxAddress, 0x10000 ); + WaitContextBlock->NumberOfMapRegisters * PAGE_SIZE, + MinAddress, + MaxAddress, + BoundryAddressMultiple, + MmCached, + 0x10000 ); if(!AdapterObject->MapRegisterBase) return; diff --git a/reactos/include/ddk/mmfuncs.h b/reactos/include/ddk/mmfuncs.h index 1d3cfe7bd6c..44f6930e431 100644 --- a/reactos/include/ddk/mmfuncs.h +++ b/reactos/include/ddk/mmfuncs.h @@ -1,6 +1,6 @@ #ifndef _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 ******************************************************/ @@ -72,10 +72,21 @@ MmAllocateContiguousMemory ( 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 MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes, + IN PHYSICAL_ADDRESS LowestAcceptableAddress, IN PHYSICAL_ADDRESS HighestAcceptableAddress, - IN ULONG Alignment); + IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, + IN MEMORY_CACHING_TYPE CacheType OPTIONAL, + IN ULONG Alignment); PVOID STDCALL @@ -158,6 +169,12 @@ MmFreeContiguousMemory ( ); VOID STDCALL +MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, + IN ULONG NumberOfBytes, + IN MEMORY_CACHING_TYPE CacheType + ); +VOID +STDCALL MmFreeNonCachedMemory ( IN PVOID BaseAddress, IN ULONG NumberOfBytes diff --git a/reactos/include/ddk/mmtypes.h b/reactos/include/ddk/mmtypes.h index b2d03ae1032..d403ca7ec93 100644 --- a/reactos/include/ddk/mmtypes.h +++ b/reactos/include/ddk/mmtypes.h @@ -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 #define _INCLUDE_DDK_MMTYPES_H @@ -76,11 +76,15 @@ typedef enum _MMFLUSH_TYPE MmFlushForWrite } MMFLUSH_TYPE; +typedef enum _MEMORY_CACHING_TYPE_ORIG { + MmFrameBufferCached = 2 +} MEMORY_CACHING_TYPE_ORIG; + typedef enum _MEMORY_CACHING_TYPE { MmNonCached = FALSE, MmCached = TRUE, - MmFrameBufferCached, + MmWriteCombined = MmFrameBufferCached, MmHardwareCoherentCached, MmMaximumCacheType } MEMORY_CACHING_TYPE; diff --git a/reactos/include/ntos/mm.h b/reactos/include/ntos/mm.h index 2c97e1409ef..77f7970fe1a 100644 --- a/reactos/include/ntos/mm.h +++ b/reactos/include/ntos/mm.h @@ -22,6 +22,7 @@ #define SEC_RESERVE (0x04000000) #define SEC_COMMIT (0x08000000) #define SEC_NOCACHE (0x10000000) +#define PAGE_NOACCESS (1) #define PAGE_READONLY (2) #define PAGE_READWRITE (4) #define PAGE_WRITECOPY (8) @@ -30,8 +31,8 @@ #define PAGE_EXECUTE_READWRITE (64) #define PAGE_EXECUTE_WRITECOPY (128) #define PAGE_GUARD (256) -#define PAGE_NOACCESS (1) #define PAGE_NOCACHE (512) +#define PAGE_WRITECOMBINE (1024) #define MEM_COMMIT (4096) #define MEM_FREE (65536) #define MEM_RESERVE (8192) diff --git a/reactos/ntoskrnl/cc/view.c b/reactos/ntoskrnl/cc/view.c index 512c2058c9b..c9ba56ff38d 100644 --- a/reactos/ntoskrnl/cc/view.c +++ b/reactos/ntoskrnl/cc/view.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: ntoskrnl/cc/view.c @@ -489,11 +489,13 @@ CcRosCreateCacheSegment(PBCB Bcb, #ifdef CACHE_BITMAP ULONG StartingOffset; #endif - + PHYSICAL_ADDRESS BoundaryAddressMultiple; + assert(Bcb); DPRINT("CcRosCreateCacheSegment()\n"); + BoundaryAddressMultiple.QuadPart = 0; if (FileOffset >= Bcb->FileSize.u.LowPart) { CacheSeg = NULL; @@ -598,7 +600,8 @@ CcRosCreateCacheSegment(PBCB Bcb, PAGE_READWRITE, (PMEMORY_AREA*)¤t->MemoryArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) { @@ -1273,12 +1276,14 @@ CcInitView(VOID) #ifdef CACHE_BITMAP PMEMORY_AREA marea; PVOID Buffer; + PHYSICAL_ADDRESS BoundaryAddressMultiple; #endif NTSTATUS Status; KPRIORITY Priority; - + DPRINT("CcInitView()\n"); #ifdef CACHE_BITMAP + BoundaryAddressMultiple.QuadPart = 0; CiCacheSegMappingRegionHint = 0; CiCacheSegMappingRegionBase = NULL; @@ -1292,7 +1297,8 @@ CcInitView(VOID) 0, &marea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) { diff --git a/reactos/ntoskrnl/include/internal/mm.h b/reactos/ntoskrnl/include/internal/mm.h index c819c4292d8..a21bf7e3355 100644 --- a/reactos/ntoskrnl/include/internal/mm.h +++ b/reactos/ntoskrnl/include/internal/mm.h @@ -194,7 +194,8 @@ NTSTATUS MmCreateMemoryArea(struct _EPROCESS* Process, ULONG Attributes, MEMORY_AREA** Result, BOOL FixedAddress, - BOOL TopDown); + BOOL TopDown, + PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL); MEMORY_AREA* MmOpenMemoryAreaByAddress(PMADDRESS_SPACE AddressSpace, PVOID Address); NTSTATUS MmInitMemoryAreas(VOID); @@ -383,6 +384,7 @@ NTSTATUS MmCreatePhysicalMemorySection(VOID); PHYSICAL_ADDRESS MmGetContinuousPages(ULONG NumberOfBytes, + PHYSICAL_ADDRESS LowestAcceptableAddress, PHYSICAL_ADDRESS HighestAcceptableAddress, ULONG Alignment); diff --git a/reactos/ntoskrnl/ke/kthread.c b/reactos/ntoskrnl/ke/kthread.c index c718417897c..f28a4dd76cc 100644 --- a/reactos/ntoskrnl/ke/kthread.c +++ b/reactos/ntoskrnl/ke/kthread.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * PURPOSE: Microkernel thread support @@ -88,6 +88,9 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First) extern unsigned int init_stack; PMEMORY_AREA StackArea; ULONG i; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + + BoundaryAddressMultiple.QuadPart = 0; KeInitializeDispatcherHeader(&Thread->DispatcherHeader, InternalThreadType, @@ -107,7 +110,8 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First) 0, &StackArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/mm/anonmem.c b/reactos/ntoskrnl/mm/anonmem.c index 526ea6c58a0..ada600cd796 100644 --- a/reactos/ntoskrnl/mm/anonmem.c +++ b/reactos/ntoskrnl/mm/anonmem.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: ntoskrnl/mm/anonmem.c @@ -548,6 +548,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle, ULONG RegionSize; PVOID PBaseAddress; ULONG PRegionSize; + PHYSICAL_ADDRESS BoundaryAddressMultiple; DPRINT("NtAllocateVirtualMemory(*UBaseAddress %x, " "ZeroBits %d, *URegionSize %x, AllocationType %x, Protect %x)\n", @@ -568,6 +569,7 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle, PBaseAddress = *UBaseAddress; PRegionSize = *URegionSize; + BoundaryAddressMultiple.QuadPart = 0; BaseAddress = (PVOID)PAGE_ROUND_DOWN(PBaseAddress); RegionSize = PAGE_ROUND_UP(PBaseAddress + PRegionSize) - @@ -627,7 +629,8 @@ NtAllocateVirtualMemory(IN HANDLE ProcessHandle, Protect, &MemoryArea, PBaseAddress != 0, - (AllocationType & MEM_TOP_DOWN)); + (AllocationType & MEM_TOP_DOWN), + BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { MmUnlockAddressSpace(AddressSpace); diff --git a/reactos/ntoskrnl/mm/cont.c b/reactos/ntoskrnl/mm/cont.c index a0b804bc405..03493ce7de3 100644 --- a/reactos/ntoskrnl/mm/cont.c +++ b/reactos/ntoskrnl/mm/cont.c @@ -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 * PROJECT: ReactOS kernel @@ -33,15 +33,29 @@ MmFreeContinuousPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address, PVOID STDCALL MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes, - IN PHYSICAL_ADDRESS HighestAcceptableAddress, - IN ULONG Alignment) + IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, + IN PHYSICAL_ADDRESS HighestAcceptableAddress, + IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, + IN MEMORY_CACHING_TYPE CacheType OPTIONAL, + IN ULONG Alignment) { PMEMORY_AREA MArea; NTSTATUS Status; PVOID BaseAddress = 0; PHYSICAL_ADDRESS PBase; + ULONG Attributes; ULONG i; + Attributes = PAGE_EXECUTE_READWRITE | PAGE_SYSTEM; + if (CacheType == MmNonCached || CacheType == MmWriteCombined) + { + Attributes |= PAGE_NOCACHE; + } + if (CacheType == MmWriteCombined) + { + Attributes |= PAGE_WRITECOMBINE; + } + MmLockAddressSpace(MmGetKernelAddressSpace()); Status = MmCreateMemoryArea(NULL, MmGetKernelAddressSpace(), @@ -51,7 +65,8 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes, 0, &MArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) @@ -60,6 +75,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes, } DPRINT( "Base = %x\n", BaseAddress ); PBase = MmGetContinuousPages(NumberOfBytes, + LowestAcceptableAddress, HighestAcceptableAddress, Alignment); #if defined(__GNUC__) @@ -85,7 +101,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes, #endif MmCreateVirtualMapping(NULL, (char*)BaseAddress + (i * 4096), - PAGE_EXECUTE_READWRITE | PAGE_SYSTEM, + Attributes, #if defined(__GNUC__) (LARGE_INTEGER)(PBase.QuadPart + (i * 4096)), #else @@ -127,8 +143,17 @@ PVOID STDCALL MmAllocateContiguousMemory (IN ULONG NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress) { + PHYSICAL_ADDRESS LowestAcceptableAddress; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + + LowestAcceptableAddress.QuadPart = 0; + BoundaryAddressMultiple.QuadPart = 0; + return(MmAllocateContiguousAlignedMemory(NumberOfBytes, + LowestAcceptableAddress, HighestAcceptableAddress, + BoundaryAddressMultiple, + MmCached, PAGE_SIZE)); } @@ -168,4 +193,91 @@ MmFreeContiguousMemory(IN PVOID BaseAddress) 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 */ diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 3abc7165b0b..7f10f7e5698 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -169,6 +169,7 @@ MmGetLRUNextUserPage(PHYSICAL_ADDRESS PreviousPhysicalAddress) PHYSICAL_ADDRESS MmGetContinuousPages(ULONG NumberOfBytes, + PHYSICAL_ADDRESS LowestAcceptableAddress, PHYSICAL_ADDRESS HighestAcceptableAddress, ULONG Alignment) { @@ -184,7 +185,7 @@ MmGetContinuousPages(ULONG NumberOfBytes, start = -1; 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) { diff --git a/reactos/ntoskrnl/mm/iospace.c b/reactos/ntoskrnl/mm/iospace.c index 3009877b9b5..562e7520e58 100644 --- a/reactos/ntoskrnl/mm/iospace.c +++ b/reactos/ntoskrnl/mm/iospace.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: ntoskrnl/mm/iospace.c @@ -75,9 +75,11 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress, NTSTATUS Status; ULONG i; ULONG Attributes; + PHYSICAL_ADDRESS BoundaryAddressMultiple; DPRINT("MmMapIoSpace(%lx, %d, %d)\n", PhysicalAddress, NumberOfBytes, CacheEnable); + BoundaryAddressMultiple.QuadPart = 0; MmLockAddressSpace(MmGetKernelAddressSpace()); Result = NULL; Status = MmCreateMemoryArea (NULL, @@ -88,7 +90,8 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress, 0, &marea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/mm/marea.c b/reactos/ntoskrnl/mm/marea.c index e42af299d1b..e39c51a0f7a 100644 --- a/reactos/ntoskrnl/mm/marea.c +++ b/reactos/ntoskrnl/mm/marea.c @@ -487,7 +487,8 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process, ULONG Attributes, MEMORY_AREA** Result, BOOL FixedAddress, - BOOL TopDown) + BOOL TopDown, + PHYSICAL_ADDRESS BoundaryAddressMultiple) /* * FUNCTION: Create a memory area * ARGUMENTS: @@ -501,6 +502,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process, * NOTES: Lock the address space before calling this function */ { + PVOID EndAddress; ULONG tmpLength; DPRINT("MmCreateMemoryArea(Type %d, BaseAddress %x," "*BaseAddress %x, Length %x, Attributes %x, Result %x)\n", @@ -543,6 +545,13 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process, { return STATUS_ACCESS_VIOLATION; } + + if (BoundaryAddressMultiple.QuadPart != 0) + { + EndAddress = *BaseAddress + tmpLength-1; + assert((*BaseAddress/BoundaryAddressMultiple) == (EndAddress/BoundaryAddressMultiple)); + } + if (MmOpenMemoryAreaByRegion(AddressSpace, *BaseAddress, tmpLength)!=NULL) @@ -551,7 +560,7 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process, return(STATUS_CONFLICTING_ADDRESSES); } } - + *Result = ExAllocatePoolWithTag(NonPagedPool, sizeof(MEMORY_AREA), TAG_MAREA); RtlZeroMemory(*Result,sizeof(MEMORY_AREA)); diff --git a/reactos/ntoskrnl/mm/mdl.c b/reactos/ntoskrnl/mm/mdl.c index 6db8c53772d..26d042d1d93 100644 --- a/reactos/ntoskrnl/mm/mdl.c +++ b/reactos/ntoskrnl/mm/mdl.c @@ -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 * PROJECT: ReactOS kernel @@ -39,7 +39,9 @@ MmInitializeMdlImplementation(VOID) MEMORY_AREA* Result; NTSTATUS Status; PVOID Buffer; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + BoundaryAddressMultiple.QuadPart = 0; MiMdlMappingRegionHint = 0; MiMdlMappingRegionBase = NULL; @@ -52,7 +54,8 @@ MmInitializeMdlImplementation(VOID) 0, &Result, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { MmUnlockAddressSpace(MmGetKernelAddressSpace()); diff --git a/reactos/ntoskrnl/mm/mminit.c b/reactos/ntoskrnl/mm/mminit.c index 1fb3b7dc4a5..759bc0f663a 100644 --- a/reactos/ntoskrnl/mm/mminit.c +++ b/reactos/ntoskrnl/mm/mminit.c @@ -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 * PROJECT: ReactOS kernel @@ -105,10 +105,12 @@ MmInitVirtualMemory(ULONG LastKernelAddress, ULONG Length; ULONG ParamLength = KernelLength; NTSTATUS Status; + PHYSICAL_ADDRESS BoundaryAddressMultiple; //ULONG i; DPRINT("MmInitVirtualMemory(%x, %x)\n",LastKernelAddress, KernelLength); + BoundaryAddressMultiple.QuadPart = 0; LastKernelAddress = PAGE_ROUND_UP(LastKernelAddress); MmInitMemoryAreas(); @@ -139,7 +141,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_map_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = (PVOID)KPCR_BASE; MmCreateMemoryArea(NULL, @@ -150,7 +153,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_kpcr_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = (PVOID)0xd0000000; MmCreateMemoryArea(NULL, @@ -161,7 +165,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_mapped_low_mem_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = (PVOID)KERNEL_BASE; Length = PAGE_ROUND_UP(((ULONG)&_text_end__)) - KERNEL_BASE; @@ -179,7 +184,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_text_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)&_text_end__)); assert (BaseAddress == (PVOID)&_init_start__); @@ -195,7 +201,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_init_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); Length = PAGE_ROUND_UP(((ULONG)&_bss_end__)) - PAGE_ROUND_UP(((ULONG)&_init_end__)); @@ -216,7 +223,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_data_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = (PVOID)PAGE_ROUND_UP(((ULONG)&_bss_end__)); Length = LastKernelAddress - (ULONG)BaseAddress; @@ -228,7 +236,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_param_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = MiNonPagedPoolStart; MmCreateMemoryArea(NULL, @@ -239,7 +248,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_pool_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = MiKernelMapStart; Status = MmCreateMemoryArea(NULL, @@ -250,7 +260,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &MiKernelMapDescriptor, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); BaseAddress = MmPagedPoolBase; Status = MmCreateMemoryArea(NULL, @@ -261,7 +272,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &MiPagedPoolDescriptor, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmInitializePagedPool(); @@ -278,7 +290,8 @@ MmInitVirtualMemory(ULONG LastKernelAddress, 0, &kernel_shared_data_desc, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); Status = MmRequestPageMemoryConsumer(MC_NPPOOL, TRUE, &MmSharedDataPagePhysicalAddress); Status = MmCreateVirtualMapping(NULL, diff --git a/reactos/ntoskrnl/mm/ncache.c b/reactos/ntoskrnl/mm/ncache.c index b448337d5d0..b488d62eaa7 100644 --- a/reactos/ntoskrnl/mm/ncache.c +++ b/reactos/ntoskrnl/mm/ncache.c @@ -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 * PROJECT: ReactOS kernel @@ -53,7 +53,9 @@ MmAllocateNonCachedMemory(IN ULONG NumberOfBytes) NTSTATUS Status; ULONG i; ULONG Attributes; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + BoundaryAddressMultiple.QuadPart = 0; MmLockAddressSpace(MmGetKernelAddressSpace()); Result = NULL; Status = MmCreateMemoryArea (NULL, @@ -64,7 +66,8 @@ MmAllocateNonCachedMemory(IN ULONG NumberOfBytes) 0, &marea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 9c7e0c7790c..601f3cf3b6f 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * 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 * FILE: ntoskrnl/mm/section.c @@ -3096,6 +3096,9 @@ MmMapViewOfSegment(PEPROCESS Process, PMEMORY_AREA MArea; NTSTATUS Status; KIRQL oldIrql; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + + BoundaryAddressMultiple.QuadPart = 0; Status = MmCreateMemoryArea(Process, AddressSpace, @@ -3105,7 +3108,8 @@ MmMapViewOfSegment(PEPROCESS Process, Protect, &MArea, FALSE, - TopDown); + TopDown, + BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { DPRINT1("Mapping between 0x%.8X and 0x%.8X failed.\n", @@ -3665,9 +3669,11 @@ MmAllocateSection (IN ULONG Length) NTSTATUS Status; ULONG i; PMADDRESS_SPACE AddressSpace; + PHYSICAL_ADDRESS BoundaryAddressMultiple; DPRINT("MmAllocateSection(Length %x)\n",Length); + BoundaryAddressMultiple.QuadPart = 0; AddressSpace = MmGetKernelAddressSpace(); Result = NULL; MmLockAddressSpace(AddressSpace); @@ -3679,7 +3685,8 @@ MmAllocateSection (IN ULONG Length) 0, &marea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(AddressSpace); if (!NT_SUCCESS(Status)) { diff --git a/reactos/ntoskrnl/ntoskrnl.def b/reactos/ntoskrnl/ntoskrnl.def index 53af695b5ff..329426af368 100644 --- a/reactos/ntoskrnl/ntoskrnl.def +++ b/reactos/ntoskrnl/ntoskrnl.def @@ -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 ; @@ -498,8 +498,9 @@ LsaLogonUser@56 LsaLookupAuthenticationPackage@12 LsaRegisterLogonProcess@12 MmAdjustWorkingSetSize@12 -MmAllocateContiguousAlignedMemory@16 +MmAllocateContiguousAlignedMemory@36 MmAllocateContiguousMemory@12 +MmAllocateContiguousMemorySpecifyCache@32 MmAllocateNonCachedMemory@4 MmBuildMdlForNonPagedPool@4 MmCanFileBeTruncated@8 @@ -512,6 +513,7 @@ MmDisableModifiedWriteOfSection@4 MmFlushImageSection@8 MmForceSectionClosed@8 MmFreeContiguousMemory@4 +MmFreeContiguousMemorySpecifyCache@12 MmFreeNonCachedMemory@8 MmGetPhysicalAddress@4 MmGrowKernelStack@4 diff --git a/reactos/ntoskrnl/ntoskrnl.edf b/reactos/ntoskrnl/ntoskrnl.edf index 08ad44b75aa..25021e2ad7e 100644 --- a/reactos/ntoskrnl/ntoskrnl.edf +++ b/reactos/ntoskrnl/ntoskrnl.edf @@ -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 ; @@ -499,8 +499,9 @@ LsaLogonUser=LsaLogonUser@56 LsaLookupAuthenticationPackage=LsaLookupAuthenticationPackage@12 LsaRegisterLogonProcess=LsaRegisterLogonProcess@12 MmAdjustWorkingSetSize=MmAdjustWorkingSetSize@12 -MmAllocateContiguousAlignedMemory=MmAllocateContiguousAlignedMemory@16 +MmAllocateContiguousAlignedMemory=MmAllocateContiguousAlignedMemory@36 MmAllocateContiguousMemory=MmAllocateContiguousMemory@12 +MmAllocateContiguousMemorySpecifyCache=MmAllocateContiguousMemorySpecifyCache@32 MmAllocateNonCachedMemory=MmAllocateNonCachedMemory@4 MmBuildMdlForNonPagedPool=MmBuildMdlForNonPagedPool@4 MmCanFileBeTruncated=MmCanFileBeTruncated@8 @@ -513,6 +514,7 @@ MmDisableModifiedWriteOfSection=MmDisableModifiedWriteOfSection@4 MmFlushImageSection=MmFlushImageSection@8 MmForceSectionClosed=MmForceSectionClosed@8 MmFreeContiguousMemory=MmFreeContiguousMemory@4 +MmFreeContiguousMemorySpecifyCache=MmFreeContiguousMemorySpecifyCache@12 MmFreeNonCachedMemory=MmFreeNonCachedMemory@8 MmGetPhysicalAddress=MmGetPhysicalAddress@4 MmGrowKernelStack=MmGrowKernelStack@4 diff --git a/reactos/ntoskrnl/ps/process.c b/reactos/ntoskrnl/ps/process.c index a4fbfe518a6..83648ce7ae2 100644 --- a/reactos/ntoskrnl/ps/process.c +++ b/reactos/ntoskrnl/ps/process.c @@ -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 * PROJECT: ReactOS kernel @@ -578,9 +578,12 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, PEPORT ExceptionPort; PVOID BaseAddress; PMEMORY_AREA MemoryArea; + PHYSICAL_ADDRESS BoundaryAddressMultiple; DPRINT("NtCreateProcess(ObjectAttributes %x)\n",ObjectAttributes); + BoundaryAddressMultiple.QuadPart = 0; + Status = ObReferenceObjectByHandle(ParentProcessHandle, PROCESS_CREATE_PROCESS, PsProcessType, @@ -751,7 +754,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, PAGE_NOACCESS, &MemoryArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { MmUnlockAddressSpace(&Process->AddressSpace); @@ -770,7 +774,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, PAGE_NOACCESS, &MemoryArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { MmUnlockAddressSpace(&Process->AddressSpace); @@ -789,7 +794,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, PAGE_NOACCESS, &MemoryArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); if (!NT_SUCCESS(Status)) { MmUnlockAddressSpace(&Process->AddressSpace); @@ -807,7 +813,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle, PAGE_READONLY, &MemoryArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(&Process->AddressSpace); if (!NT_SUCCESS(Status)) { diff --git a/reactos/ntoskrnl/ps/w32call.c b/reactos/ntoskrnl/ps/w32call.c index ce729e9e6c3..b1b88de6bbf 100644 --- a/reactos/ntoskrnl/ps/w32call.c +++ b/reactos/ntoskrnl/ps/w32call.c @@ -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 * PROJECT: ReactOS kernel @@ -182,7 +182,9 @@ PsAllocateCallbackStack(ULONG StackSize) NTSTATUS Status; PMEMORY_AREA StackArea; ULONG i; + PHYSICAL_ADDRESS BoundaryAddressMultiple; + BoundaryAddressMultiple.QuadPart = 0; StackSize = PAGE_ROUND_UP(StackSize); MmLockAddressSpace(MmGetKernelAddressSpace()); Status = MmCreateMemoryArea(NULL, @@ -193,7 +195,8 @@ PsAllocateCallbackStack(ULONG StackSize) 0, &StackArea, FALSE, - FALSE); + FALSE, + BoundaryAddressMultiple); MmUnlockAddressSpace(MmGetKernelAddressSpace()); if (!NT_SUCCESS(Status)) {