Don't use MmLowestUserAddress as a ULONG!

svn path=/trunk/; revision=12712
This commit is contained in:
Alex Ionescu 2005-01-02 01:06:17 +00:00
parent 6a5aa2060e
commit 28dff13100
3 changed files with 12 additions and 12 deletions

View file

@ -47,7 +47,7 @@ typedef ULONG PFN_TYPE, *PPFN_TYPE;
#define NR_SECTION_PAGE_ENTRIES (1024) #define NR_SECTION_PAGE_ENTRIES (1024)
#ifndef __USE_W32API #ifndef __USE_W32API
#define MM_LOWEST_USER_ADDRESS (4096) #define MM_LOWEST_USER_ADDRESS (PVOID)0x10000
#endif #endif
#define MM_VIRTMEM_GRANULARITY (64 * 1024) /* Although Microsoft says this isn't hardcoded anymore, #define MM_VIRTMEM_GRANULARITY (64 * 1024) /* Although Microsoft says this isn't hardcoded anymore,
@ -217,7 +217,7 @@ typedef struct _MADDRESS_SPACE
{ {
LIST_ENTRY MAreaListHead; LIST_ENTRY MAreaListHead;
FAST_MUTEX Lock; FAST_MUTEX Lock;
ULONG LowestAddress; PVOID LowestAddress;
struct _EPROCESS* Process; struct _EPROCESS* Process;
PUSHORT PageTableRefCountTable; PUSHORT PageTableRefCountTable;
ULONG PageTableRefCountTableSize; ULONG PageTableRefCountTableSize;

View file

@ -1,4 +1,4 @@
/* $Id: aspace.c,v 1.19 2004/09/09 20:42:33 hbirr Exp $ /* $Id$
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -76,7 +76,7 @@ MmInitializeAddressSpace(PEPROCESS Process,
} }
else else
{ {
AddressSpace->LowestAddress = KERNEL_BASE; AddressSpace->LowestAddress = (PVOID)KERNEL_BASE;
} }
AddressSpace->Process = Process; AddressSpace->Process = Process;
if (Process != NULL) if (Process != NULL)

View file

@ -253,7 +253,7 @@ static PVOID MmFindGapBottomUp(PMADDRESS_SPACE AddressSpace, ULONG Length, ULONG
Address = (PVOID) MM_ROUND_UP(Address, Granularity); Address = (PVOID) MM_ROUND_UP(Address, Granularity);
} }
/* Check if enough space for the block */ /* Check if enough space for the block */
if (AddressSpace->LowestAddress < KERNEL_BASE) if (AddressSpace->LowestAddress < (PVOID)KERNEL_BASE)
{ {
if ((ULONG_PTR) Address >= KERNEL_BASE || Length > KERNEL_BASE - (ULONG_PTR) Address) if ((ULONG_PTR) Address >= KERNEL_BASE || Length > KERNEL_BASE - (ULONG_PTR) Address)
{ {
@ -290,7 +290,7 @@ static PVOID MmFindGapTopDown(PMADDRESS_SPACE AddressSpace, ULONG Length, ULONG
Length += PAGE_SIZE; /* For a guard page following the area */ Length += PAGE_SIZE; /* For a guard page following the area */
#endif #endif
if (AddressSpace->LowestAddress < KERNEL_BASE) //(ULONG_PTR)MmSystemRangeStart) if (AddressSpace->LowestAddress < (PVOID)KERNEL_BASE) //(ULONG_PTR)MmSystemRangeStart)
{ {
HighestAddress = MmHighestUserAddress; HighestAddress = MmHighestUserAddress;
} }
@ -337,7 +337,7 @@ static PVOID MmFindGapTopDown(PMADDRESS_SPACE AddressSpace, ULONG Length, ULONG
} }
/* Check if enough space for the block */ /* Check if enough space for the block */
if (AddressSpace->LowestAddress < KERNEL_BASE) if (AddressSpace->LowestAddress < (PVOID)KERNEL_BASE)
{ {
if ((ULONG_PTR) Address >= KERNEL_BASE || Length > KERNEL_BASE - (ULONG_PTR) Address) if ((ULONG_PTR) Address >= KERNEL_BASE || Length > KERNEL_BASE - (ULONG_PTR) Address)
{ {
@ -374,7 +374,7 @@ ULONG MmFindGapAtAddress(PMADDRESS_SPACE AddressSpace, PVOID Address)
Address = (PVOID)PAGE_ROUND_DOWN(Address); Address = (PVOID)PAGE_ROUND_DOWN(Address);
if (AddressSpace->LowestAddress < KERNEL_BASE) if (AddressSpace->LowestAddress < (PVOID)KERNEL_BASE)
{ {
if (Address >= (PVOID)KERNEL_BASE) if (Address >= (PVOID)KERNEL_BASE)
{ {
@ -383,7 +383,7 @@ ULONG MmFindGapAtAddress(PMADDRESS_SPACE AddressSpace, PVOID Address)
} }
else else
{ {
if ((ULONG_PTR)Address < AddressSpace->LowestAddress) if ((ULONG_PTR)Address < (ULONG_PTR)AddressSpace->LowestAddress)
{ {
return 0; return 0;
} }
@ -405,7 +405,7 @@ ULONG MmFindGapAtAddress(PMADDRESS_SPACE AddressSpace, PVOID Address)
} }
current_entry = current_entry->Flink; current_entry = current_entry->Flink;
} }
if (AddressSpace->LowestAddress < KERNEL_BASE) if (AddressSpace->LowestAddress < (PVOID)KERNEL_BASE)
{ {
return KERNEL_BASE - (ULONG_PTR)Address; return KERNEL_BASE - (ULONG_PTR)Address;
} }
@ -548,13 +548,13 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
- (ULONG_PTR) MM_ROUND_DOWN(*BaseAddress, Granularity)); - (ULONG_PTR) MM_ROUND_DOWN(*BaseAddress, Granularity));
*BaseAddress = MM_ROUND_DOWN(*BaseAddress, Granularity); *BaseAddress = MM_ROUND_DOWN(*BaseAddress, Granularity);
if (AddressSpace->LowestAddress == KERNEL_BASE && if (AddressSpace->LowestAddress == (PVOID)KERNEL_BASE &&
(*BaseAddress) < (PVOID)KERNEL_BASE) (*BaseAddress) < (PVOID)KERNEL_BASE)
{ {
return STATUS_ACCESS_VIOLATION; return STATUS_ACCESS_VIOLATION;
} }
if (AddressSpace->LowestAddress < KERNEL_BASE && if (AddressSpace->LowestAddress < (PVOID)KERNEL_BASE &&
(PVOID)((char*)(*BaseAddress) + tmpLength) > (PVOID)KERNEL_BASE) (PVOID)((char*)(*BaseAddress) + tmpLength) > (PVOID)KERNEL_BASE)
{ {
return STATUS_ACCESS_VIOLATION; return STATUS_ACCESS_VIOLATION;