mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:13:01 +00:00
added page-aligned allocations ( reworked patch by Mike Nordell )
fixed 2 small probs w/ ntoskrnl.edf svn path=/trunk/; revision=5340
This commit is contained in:
parent
84610d9546
commit
bbb0ecb401
2 changed files with 51 additions and 31 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: pool.c,v 1.19 2003/07/21 21:53:53 royce Exp $
|
/* $Id: pool.c,v 1.20 2003/07/31 01:44:17 royce Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -24,21 +24,31 @@
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
PVOID STDCALL STATIC
|
PVOID STDCALL STATIC
|
||||||
EiAllocatePool(POOL_TYPE PoolType,
|
EiAllocatePool(
|
||||||
ULONG NumberOfBytes,
|
POOL_TYPE PoolType,
|
||||||
ULONG Tag,
|
ULONG NumberOfBytes,
|
||||||
PVOID Caller)
|
ULONG Tag,
|
||||||
|
PVOID Caller)
|
||||||
{
|
{
|
||||||
PVOID Block;
|
PVOID Block;
|
||||||
|
BOOL CacheAligned = FALSE;
|
||||||
|
BOOL MustSucceed = FALSE;
|
||||||
|
static const ULONG nCacheAlignBytes = 31;
|
||||||
|
|
||||||
if (PoolType == NonPagedPoolCacheAligned ||
|
if ( PoolType == NonPagedPoolCacheAligned
|
||||||
PoolType == NonPagedPoolCacheAlignedMustS)
|
|| PoolType == NonPagedPoolCacheAlignedMustS
|
||||||
{
|
|| PoolType == PagedPoolCacheAligned )
|
||||||
UNIMPLEMENTED;
|
{
|
||||||
}
|
CacheAligned = TRUE;
|
||||||
|
NumberOfBytes += nCacheAlignBytes;
|
||||||
|
}
|
||||||
|
|
||||||
switch(PoolType)
|
if ( PoolType == NonPagedPoolMustSucceed
|
||||||
{
|
|| PoolType == NonPagedPoolCacheAlignedMustS )
|
||||||
|
MustSucceed = TRUE;
|
||||||
|
|
||||||
|
switch ( PoolType )
|
||||||
|
{
|
||||||
case NonPagedPool:
|
case NonPagedPool:
|
||||||
case NonPagedPoolMustSucceed:
|
case NonPagedPoolMustSucceed:
|
||||||
case NonPagedPoolCacheAligned:
|
case NonPagedPoolCacheAligned:
|
||||||
|
@ -48,23 +58,33 @@ EiAllocatePool(POOL_TYPE PoolType,
|
||||||
NumberOfBytes,
|
NumberOfBytes,
|
||||||
Tag,
|
Tag,
|
||||||
Caller);
|
Caller);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PagedPool:
|
case PagedPool:
|
||||||
case PagedPoolCacheAligned:
|
case PagedPoolCacheAligned:
|
||||||
Block = ExAllocatePagedPoolWithTag(PoolType,NumberOfBytes,Tag);
|
Block =
|
||||||
|
ExAllocatePagedPoolWithTag(PoolType,
|
||||||
|
NumberOfBytes,
|
||||||
|
Tag);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return(NULL);
|
DbgPrint ( "Unknown PoolType in call to EiAllocatePool!\n" );
|
||||||
};
|
/* a bug check may be overdramatic, but let's catch problems
|
||||||
|
as soon as we detect them, no? */
|
||||||
|
KEBUGCHECK(0);
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
|
||||||
if ((PoolType==NonPagedPoolMustSucceed ||
|
if ( Block == NULL && MustSucceed == TRUE )
|
||||||
PoolType==NonPagedPoolCacheAlignedMustS) && Block==NULL)
|
{
|
||||||
{
|
KEBUGCHECK(MUST_SUCCEED_POOL_EMPTY);
|
||||||
KEBUGCHECK(MUST_SUCCEED_POOL_EMPTY);
|
}
|
||||||
}
|
|
||||||
return(Block);
|
if ( Block != NULL && CacheAligned == TRUE )
|
||||||
|
Block = (PVOID)(((size_t)(Block + nCacheAlignBytes)) & (~nCacheAlignBytes));
|
||||||
|
|
||||||
|
return(Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
; $Id: ntoskrnl.edf,v 1.146 2003/07/25 23:51:23 dwelch Exp $
|
; $Id: ntoskrnl.edf,v 1.147 2003/07/31 01:44:18 royce Exp $
|
||||||
;
|
;
|
||||||
; reactos/ntoskrnl/ntoskrnl.def
|
; reactos/ntoskrnl/ntoskrnl.def
|
||||||
;
|
;
|
||||||
|
@ -217,8 +217,8 @@ InterlockedDecrement=@InterlockedDecrement@4
|
||||||
InterlockedExchange=@InterlockedExchange@8
|
InterlockedExchange=@InterlockedExchange@8
|
||||||
InterlockedExchangeAdd=@InterlockedExchangeAdd@8
|
InterlockedExchangeAdd=@InterlockedExchangeAdd@8
|
||||||
InterlockedIncrement=@InterlockedIncrement@4
|
InterlockedIncrement=@InterlockedIncrement@4
|
||||||
@InterlockedPushEntrySList=@InterlockedPushEntrySList@8
|
InterlockedPushEntrySList=@InterlockedPushEntrySList@8
|
||||||
@InterlockedPopEntrySList=@InterlockedPopEntrySList@4
|
InterlockedPopEntrySList=@InterlockedPopEntrySList@4
|
||||||
IoAcquireCancelSpinLock=IoAcquireCancelSpinLock@4
|
IoAcquireCancelSpinLock=IoAcquireCancelSpinLock@4
|
||||||
IoAcquireVpbSpinLock=IoAcquireVpbSpinLock@4
|
IoAcquireVpbSpinLock=IoAcquireVpbSpinLock@4
|
||||||
IoAdapterObjectType DATA
|
IoAdapterObjectType DATA
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue