indent using astyle v1.15.3: astyle --style=ansi -c -s3 -S --convert-tabs %1

svn path=/trunk/; revision=9077
This commit is contained in:
Gunnar Dalsnes 2004-04-10 22:36:07 +00:00
parent 4a875cac12
commit dbb520a63f
29 changed files with 9925 additions and 9777 deletions

View File

@ -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.26 2004/03/07 17:48:41 arty Exp $
/* $Id: anonmem.c,v 1.27 2004/04/10 22:35:25 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/anonmem.c

View File

@ -1,4 +1,4 @@
/* $Id: aspace.c,v 1.16 2004/03/04 00:07:01 navaraf Exp $
/* $Id: aspace.c,v 1.17 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel

View File

@ -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: balance.c,v 1.26 2004/03/05 11:31:59 hbirr Exp $
/* $Id: balance.c,v 1.27 2004/04/10 22:35:25 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/balance.c
@ -42,14 +42,16 @@ typedef struct _MM_MEMORY_CONSUMER
ULONG PagesUsed;
ULONG PagesTarget;
NTSTATUS (*Trim)(ULONG Target, ULONG Priority, PULONG NrFreed);
} MM_MEMORY_CONSUMER, *PMM_MEMORY_CONSUMER;
}
MM_MEMORY_CONSUMER, *PMM_MEMORY_CONSUMER;
typedef struct _MM_ALLOCATION_REQUEST
{
PHYSICAL_ADDRESS Page;
LIST_ENTRY ListEntry;
KEVENT Event;
} MM_ALLOCATION_REQUEST, *PMM_ALLOCATION_REQUEST;
}
MM_ALLOCATION_REQUEST, *PMM_ALLOCATION_REQUEST;
/* GLOBALS ******************************************************************/
@ -114,10 +116,13 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PHYSICAL_ADDRESS Page)
ULONG OldAvailable;
#if defined(__GNUC__)
if (Page.QuadPart == 0LL)
#else
if (Page.QuadPart == 0)
#endif
{
DPRINT1("Tried to release page zero.\n");
KEBUGCHECK(0);
@ -234,10 +239,13 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
{
Page = MmAllocPage(Consumer, 0);
#if defined(__GNUC__)
if (Page.QuadPart == 0LL)
#else
if (Page.QuadPart == 0)
#endif
{
KEBUGCHECK(0);
}
@ -268,8 +276,10 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
#if defined(__GNUC__)
Request.Page.QuadPart = 0LL;
#else
Request.Page.QuadPart = 0;
#endif
KeInitializeEvent(&Request.Event, NotificationEvent, FALSE);
InterlockedIncrement((LONG *)&MiPagesRequired);
@ -290,10 +300,13 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
Page = Request.Page;
#if defined(__GNUC__)
if (Page.QuadPart == 0LL)
#else
if (Page.QuadPart == 0)
#endif
{
KEBUGCHECK(0);
}
@ -308,10 +321,13 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
*/
Page = MmAllocPage(Consumer, 0);
#if defined(__GNUC__)
if (Page.QuadPart == 0LL)
#else
if (Page.QuadPart == 0)
#endif
{
KEBUGCHECK(0);
}
@ -412,8 +428,10 @@ MiInitBalancerThread(VOID)
KPRIORITY Priority;
NTSTATUS Status;
#if !defined(__GNUC__)
LARGE_INTEGER dummyJunkNeeded;
dummyJunkNeeded.QuadPart = -20000000; /* 2 sec */;
dummyJunkNeeded.QuadPart = -20000000; /* 2 sec */
;
#endif
CHECKPOINT;

View File

@ -1,4 +1,4 @@
/* $Id: cont.c,v 1.30 2003/12/31 05:33:03 jfilby Exp $
/* $Id: cont.c,v 1.31 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -79,10 +79,13 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
HighestAcceptableAddress,
Alignment);
#if defined(__GNUC__)
if (PBase.QuadPart == 0LL)
#else
if (PBase.QuadPart == 0)
#endif
{
MmLockAddressSpace(MmGetKernelAddressSpace());
MmFreeMemoryArea(MmGetKernelAddressSpace(),
@ -99,6 +102,7 @@ MmAllocateContiguousAlignedMemory(IN ULONG NumberOfBytes,
LARGE_INTEGER dummyJunkNeeded;
dummyJunkNeeded.QuadPart = PBase.QuadPart + (i * 4096);
#endif
MmCreateVirtualMapping(NULL,
(char*)BaseAddress + (i * 4096),
Attributes,

View File

@ -1,4 +1,4 @@
/* $Id: drvlck.c,v 1.4 2003/07/10 21:05:03 royce Exp $
/* $Id: drvlck.c,v 1.5 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -77,8 +77,7 @@ MmLockPagableDataSection(IN PVOID AddressWithinSection)
*/
VOID STDCALL
MmUnlockPagableImageSection(IN PVOID ImageSectionHandle)
{
}
{}
/*
@ -86,8 +85,7 @@ MmUnlockPagableImageSection(IN PVOID ImageSectionHandle)
*/
VOID STDCALL
MmPageEntireDriver(IN PVOID AddressWithinSection)
{
}
{}
/*
@ -95,7 +93,6 @@ MmPageEntireDriver(IN PVOID AddressWithinSection)
*/
VOID STDCALL
MmResetDriverPaging(IN PVOID AddressWithinSection)
{
}
{}
/* EOF */

View File

@ -30,9 +30,12 @@ typedef struct _PHYSICAL_PAGE
{
struct
{
ULONG Type:2;
ULONG Consumer:3;
}Flags;
ULONG Type:
2;
ULONG Consumer:
3;
}
Flags;
ULONG AllFlags;
};
@ -42,7 +45,8 @@ typedef struct _PHYSICAL_PAGE
ULONG LockCount;
ULONG MapCount;
struct _MM_RMAP_ENTRY* RmapListHead;
} PHYSICAL_PAGE, *PPHYSICAL_PAGE;
}
PHYSICAL_PAGE, *PPHYSICAL_PAGE;
/* GLOBALS ****************************************************************/
@ -98,13 +102,19 @@ MmGetLRUFirstUserPage(VOID)
{
KeReleaseSpinLock(&PageListLock, oldIrql);
#if defined(__GNUC__)
return((PHYSICAL_ADDRESS)0LL);
#else
{
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
const PHYSICAL_ADDRESS dummyJunkNeeded =
{
0
};
return dummyJunkNeeded;
}
#endif
}
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
Next.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
@ -153,13 +163,19 @@ MmGetLRUNextUserPage(PHYSICAL_ADDRESS PreviousPhysicalAddress)
{
KeReleaseSpinLock(&PageListLock, oldIrql);
#if defined(__GNUC__)
return((PHYSICAL_ADDRESS)0LL);
#else
{
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
const PHYSICAL_ADDRESS dummyJunkNeeded =
{
0
};
return dummyJunkNeeded;
}
#endif
}
PageDescriptor = CONTAINING_RECORD(NextListEntry, PHYSICAL_PAGE, ListEntry);
Next.QuadPart = (ULONG)((ULONG)PageDescriptor - (ULONG)MmPageArray);
@ -218,13 +234,19 @@ MmGetContinuousPages(ULONG NumberOfBytes,
{
KeReleaseSpinLock(&PageListLock, oldIrql);
#if defined(__GNUC__)
return((PHYSICAL_ADDRESS)(LONGLONG)0);
#else
{
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
const PHYSICAL_ADDRESS dummyJunkNeeded =
{
0
};
return dummyJunkNeeded;
}
#endif
}
for (i = start; i < (start + length); i++)
{
@ -240,10 +262,15 @@ MmGetContinuousPages(ULONG NumberOfBytes,
}
KeReleaseSpinLock(&PageListLock, oldIrql);
#if defined(__GNUC__)
return((PHYSICAL_ADDRESS)((LONGLONG)start * PAGE_SIZE));
#else
{
const PHYSICAL_ADDRESS dummyJunkNeeded = { start * PAGE_SIZE };
const PHYSICAL_ADDRESS dummyJunkNeeded =
{
start * PAGE_SIZE
};
return dummyJunkNeeded;
}
#endif
@ -394,11 +421,13 @@ MmInitializePageList(PVOID FirstPhysKernelAddress,
if (!MmIsPagePresent(NULL, Address))
{
#if !defined(__GNUC__)
const PHYSICAL_ADDRESS dummyJunkNeeded = {
const PHYSICAL_ADDRESS dummyJunkNeeded =
{
(ULONG)LastPhysKernelAddress -
(Reserved * PAGE_SIZE) + (i * PAGE_SIZE)
};
#endif
ULONG PhysicalAddress = (ULONG)LastPhysKernelAddress -
(Reserved * PAGE_SIZE) + (i * PAGE_SIZE);
Status =
@ -898,13 +927,19 @@ MmAllocPage(ULONG Consumer, SWAPENTRY SavedSwapEntry)
DPRINT1("MmAllocPage(): Out of memory\n");
KeReleaseSpinLock(&PageListLock, oldIrql);
#if defined(__GNUC__)
return((PHYSICAL_ADDRESS)0LL);
#else
{
const PHYSICAL_ADDRESS dummyJunkNeeded = { 0 };
const PHYSICAL_ADDRESS dummyJunkNeeded =
{
0
};
return dummyJunkNeeded;
}
#endif
}
ListEntry = RemoveTailList(&FreeUnzeroedPageListHead);
UnzeroedPageCount--;

View File

@ -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: page.c,v 1.63 2004/03/09 21:49:53 dwelch Exp $
/* $Id: page.c,v 1.64 2004/04/10 22:36:07 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/i386/page.c
@ -149,8 +149,10 @@ NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process)
MmReleasePageMemoryConsumer(MC_NPPOOL, Process->Pcb.DirectoryTableBase);
#if defined(__GNUC__)
Process->Pcb.DirectoryTableBase.QuadPart = 0LL;
#else
Process->Pcb.DirectoryTableBase.QuadPart = 0;
#endif
@ -397,11 +399,13 @@ MmGetPhysicalAddressForProcess(PEPROCESS Process,
#if defined(__GNUC__)
return((LARGE_INTEGER)0LL);
#else
{
PHYSICAL_ADDRESS dummy = { 0 };
return dummy;
}
#endif
}
return(PTE_TO_PAGE(PageEntry));
}
@ -559,8 +563,10 @@ MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage,
#if defined(__GNUC__)
*PhysicalAddr = (LARGE_INTEGER)0LL;
#else
PhysicalAddr->QuadPart = 0;
#endif
}
return;
}

View File

@ -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.25 2004/01/09 22:52:30 gvg Exp $
/* $Id: iospace.c,v 1.26 2004/04/10 22:35:25 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/iospace.c
@ -110,6 +110,7 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
PHYSICAL_ADDRESS dummyJunkNeeded;
dummyJunkNeeded.QuadPart = PhysicalAddress.QuadPart + (i * PAGE_SIZE);
#endif
Status =
MmCreateVirtualMappingForKernel((char*)Result + (i * PAGE_SIZE),
Attributes,
@ -130,8 +131,10 @@ MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
MmMarkPageMapped((PHYSICAL_ADDRESS) (PhysicalAddress.QuadPart +
(i * PAGE_SIZE)));
#else
MmMarkPageMapped(dummyJunkNeeded);
#endif
}
return ((PVOID)((char*)Result + PhysicalAddress.QuadPart % PAGE_SIZE));
}

View File

@ -1,4 +1,4 @@
/* $Id: kmap.c,v 1.31 2004/01/05 14:28:21 weiden Exp $
/* $Id: kmap.c,v 1.32 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel

View File

@ -391,8 +391,10 @@ MmFreeMemoryArea(PMADDRESS_SPACE AddressSpace,
#if defined(__GNUC__)
PHYSICAL_ADDRESS PhysAddr = (PHYSICAL_ADDRESS)0LL;
#else
PHYSICAL_ADDRESS PhysAddr = { 0 };
#endif
BOOL Dirty = FALSE;
SWAPENTRY SwapEntry = 0;
@ -522,12 +524,14 @@ NTSTATUS MmCreateMemoryArea(PEPROCESS Process,
#if defined(__GNUC__)
(*BaseAddress)=(*BaseAddress)+PAGE_SIZE;
#else
{
char* pTemp = *BaseAddress;
pTemp += PAGE_SIZE;
*BaseAddress = pTemp;
}
#endif
}
else
{

View File

@ -1,4 +1,4 @@
/* $Id: mdl.c,v 1.60 2004/03/13 19:14:16 dwelch Exp $
/* $Id: mdl.c,v 1.61 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -122,11 +122,13 @@ MmUnlockPages(PMDL Mdl)
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
MmDereferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
#else
PHYSICAL_ADDRESS dummyJunkNeeded;
dummyJunkNeeded.QuadPart = MdlPages[i];
MmUnlockPage(dummyJunkNeeded);
MmDereferencePage(dummyJunkNeeded);
#endif
}
Mdl->MdlFlags = Mdl->MdlFlags & (~MDL_PAGES_LOCKED);
}
@ -231,9 +233,11 @@ MmMapLockedPages(PMDL Mdl, KPROCESSOR_MODE AccessMode)
{
NTSTATUS Status;
#if !defined(__GNUC__)
PHYSICAL_ADDRESS dummyJunkNeeded;
dummyJunkNeeded.QuadPart = MdlPages[i];
#endif
Status = MmCreateVirtualMapping(CurrentProcess,
(PVOID)((ULONG)Base+(i*PAGE_SIZE)),
PAGE_READWRITE,
@ -308,8 +312,10 @@ MmUnmapLockedPages(PVOID BaseAddress, PMDL Mdl)
/* Calculate the number of pages we mapped. */
RegionSize = PAGE_ROUND_UP(Mdl->ByteCount + Mdl->ByteOffset) / PAGE_SIZE;
#if defined(__GNUC__)
BaseAddress -= Mdl->ByteOffset;
#else
{
char* pTemp = BaseAddress;
pTemp -= Mdl->ByteOffset;
@ -452,11 +458,13 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
MmUnlockPage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
MmDereferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[j]);
#else
PHYSICAL_ADDRESS dummyJunkNeeded;
dummyJunkNeeded.QuadPart = MdlPages[j];
MmUnlockPage(dummyJunkNeeded);
MmDereferencePage(dummyJunkNeeded);
#endif
}
ExRaiseStatus(Status);
}
@ -478,25 +486,30 @@ VOID STDCALL MmProbeAndLockPages (PMDL Mdl,
MmDereferencePage(
(LARGE_INTEGER)(LONGLONG)MdlPages[j]);
#else
PHYSICAL_ADDRESS dummyJunkNeeded;
dummyJunkNeeded.QuadPart = MdlPages[j];
MmUnlockPage(dummyJunkNeeded);
MmDereferencePage(dummyJunkNeeded);
#endif
}
ExRaiseStatus(Status);
}
}
MdlPages[i] = MmGetPhysicalAddressForProcess(NULL, Address).u.LowPart;
#if defined(__GNUC__)
MmReferencePage((LARGE_INTEGER)(LONGLONG)MdlPages[i]);
#else
{
PHYSICAL_ADDRESS dummyJunkNeeded;
dummyJunkNeeded.QuadPart = MdlPages[i];
MmReferencePage(dummyJunkNeeded);
}
#endif
}
MmUnlockAddressSpace(&Mdl->Process->AddressSpace);
if (Mode == UserMode && Mdl->Process != CurrentProcess)

View File

@ -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: mm.c,v 1.72 2004/04/08 20:49:15 jfilby Exp $
/* $Id: mm.c,v 1.73 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel

View File

@ -1,4 +1,4 @@
/* $Id: mminit.c,v 1.62 2004/03/16 22:45:56 dwelch Exp $
/* $Id: mminit.c,v 1.63 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
@ -78,8 +78,7 @@ MM_SYSTEM_SIZE STDCALL MmQuerySystemSize(VOID)
}
VOID MiShutdownMemoryManager(VOID)
{
}
{}
VOID INIT_FUNCTION
MmInitVirtualMemory(ULONG LastKernelAddress,
@ -316,6 +315,7 @@ MmInit1(ULONG FirstKrnlPhysAddr,
ULONG i;
ULONG kernel_len;
#ifndef MP
extern unsigned int unmap_me, unmap_me2, unmap_me3;
#endif
@ -410,6 +410,7 @@ MmInit1(ULONG FirstKrnlPhysAddr,
#ifdef BIOS_MEM_FIX
MmStats.NrTotalPages += 16;
#endif
DbgPrint("Used memory %dKb\n", (MmStats.NrTotalPages * PAGE_SIZE) / 1024);
LastKernelAddress = (ULONG)MmInitializePageList((PVOID)FirstKrnlPhysAddr,
@ -483,6 +484,7 @@ MmInit3(VOID)
if all processors are started. */
MmDeletePageTable(NULL, 0);
#endif
MmInitZeroPageThread();
MmCreatePhysicalMemorySection();
MiInitBalancerThread();

View File

@ -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: mpw.c,v 1.17 2003/12/30 18:52:05 fireball Exp $
/* $Id: mpw.c,v 1.18 2004/04/10 22:35:25 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/mpw.c
@ -55,10 +55,13 @@ MmWriteDirtyPages(ULONG Target, PULONG Actual)
Page = MmGetLRUFirstUserPage();
#if defined(__GNUC__)
while (Page.QuadPart != 0LL && Target > 0)
#else
while (Page.QuadPart && Target > 0)
#endif
{
/*
* FIXME: While the current page is write back it is possible
@ -114,6 +117,7 @@ MmMpwThreadMain(PVOID Ignored)
*/
MmWriteDirtyPages(128, &PagesWritten);
#endif
CcRosFlushDirtyPages(128, &PagesWritten);
}
}

View File

@ -1,4 +1,4 @@
/* $Id: ncache.c,v 1.27 2003/12/31 05:33:04 jfilby Exp $
/* $Id: ncache.c,v 1.28 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel

View File

@ -1,4 +1,4 @@
/* $Id: npool.c,v 1.84 2004/03/15 22:22:53 dwelch Exp $
/* $Id: npool.c,v 1.85 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -64,7 +64,8 @@ typedef struct _NODE
struct _NODE* link[2];
struct _NODE* parent;
signed char balance;
} NODE, *PNODE;
}
NODE, *PNODE;
/* TYPES *******************************************************************/
@ -88,13 +89,16 @@ typedef struct _BLOCK_HDR
PVOID Caller;
LIST_ENTRY TagListEntry;
BOOLEAN Dumped;
} Used;
}
Used;
struct
{
NODE Node;
} Free;
}
Free;
};
} BLOCK_HDR;
}
BLOCK_HDR;
#define BLOCK_HDR_SIZE ROUND_UP(sizeof(BLOCK_HDR), MM_POOL_ALIGNMENT)
@ -1159,6 +1163,7 @@ static void remove_from_free_list(BLOCK_HDR* current)
EiNrFreeBlocks--;
DPRINT("remove_from_free_list done\n");
#ifdef DUMP_AVL
DumpFreeBlockTree();
#endif
}
@ -1209,6 +1214,7 @@ add_to_free_list(BLOCK_HDR* blk)
DPRINT("add_to_free_list done\n");
#ifdef DUMP_AVL
DumpFreeBlockTree();
#endif
}
@ -1277,14 +1283,17 @@ grow_block(BLOCK_HDR* blk, PVOID end)
}
index++;
#if defined(__GNUC__)
start += PAGE_SIZE;
#else
{
char* pTemp = start;
pTemp += PAGE_SIZE;
start = pTemp;
}
#endif
}
return result;
}
@ -1523,8 +1532,10 @@ VOID STDCALL ExFreeNonPagedPool (PVOID block)
memset(block, 0xcc, blk->Size);
#ifdef TAG_STATISTICS_TRACKING
MiRemoveFromTagHashTable(blk);
#endif
remove_from_used_list(blk);
blk->Magic = BLOCK_HDR_FREE_MAGIC;
add_to_free_list(blk);
@ -1566,6 +1577,7 @@ ExAllocateNonPagedPoolWithTag(ULONG Type, ULONG Size, ULONG Tag, PVOID Caller)
return(block);
#else /* not WHOLE_PAGE_ALLOCATIONS */
PVOID block;
BLOCK_HDR* best = NULL;
KIRQL oldIrql;
@ -1581,6 +1593,7 @@ ExAllocateNonPagedPoolWithTag(ULONG Type, ULONG Size, ULONG Tag, PVOID Caller)
#if 0
/* after some allocations print the npaged pool stats */
#ifdef TAG_STATISTICS_TRACKING
{
static ULONG counter = 0;
if (counter++ % 100000 == 0)
@ -1629,8 +1642,10 @@ ExAllocateNonPagedPoolWithTag(ULONG Type, ULONG Size, ULONG Tag, PVOID Caller)
best->Used.Dumped = FALSE;
best->Used.TagListEntry.Flink = best->Used.TagListEntry.Blink = NULL;
#ifdef TAG_STATISTICS_TRACKING
MiAddToTagHashTable(best);
#endif
KeReleaseSpinLock(&MmNpoolLock, oldIrql);
block = block_to_address(best);
/* RtlZeroMemory(block, Size);*/
@ -1719,9 +1734,11 @@ MiInitializeNonPagedPool(VOID)
PVOID Address;
#ifdef WHOLE_PAGE_ALLOCATIONS
#else
BLOCK_HDR* blk;
#endif
#ifdef TAG_STATISTICS_TRACKING
for (i = 0; i < TAG_HASH_TABLE_SIZE; i++)
{
InitializeListHead(&tag_hash_table[i]);
@ -1732,6 +1749,7 @@ MiInitializeNonPagedPool(VOID)
InitializeListHead(&AddressListHead);
FreeBlockListRoot = NULL;
#ifdef WHOLE_PAGE_ALLOCATIONS
NonPagedPoolAllocMapHint = PAGE_ROUND_UP(MiNonPagedPoolLength / PAGE_SIZE / 8) / PAGE_SIZE;
MiCurrentNonPagedPoolLength = NonPagedPoolAllocMapHint * PAGE_SIZE;
Address = MiNonPagedPoolStart;
@ -1759,6 +1777,7 @@ MiInitializeNonPagedPool(VOID)
RtlClearAllBits(&NonPagedPoolAllocMap);
RtlSetBits(&NonPagedPoolAllocMap, 0, NonPagedPoolAllocMapHint);
#else
MiNonPagedPoolAllocMap = block_to_address((BLOCK_HDR*)MiNonPagedPoolStart);
MiNonPagedPoolNrOfPages = PAGE_ROUND_UP(ROUND_UP(MiNonPagedPoolLength / PAGE_SIZE, 32) / 8 + 2 * BLOCK_HDR_SIZE);
MiNonPagedPoolNrOfPages /= PAGE_SIZE;
@ -1795,6 +1814,7 @@ MiInitializeNonPagedPool(VOID)
blk->Used.Dumped = FALSE;
add_to_used_list(blk);
#ifdef TAG_STATISTICS_TRACKING
MiAddToTagHashTable(blk);
#endif
/* the second block is the first free block */

View File

@ -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: pagefile.c,v 1.42 2004/03/04 00:07:01 navaraf Exp $
/* $Id: pagefile.c,v 1.43 2004/04/10 22:35:25 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/pagefile.c
@ -53,7 +53,8 @@ typedef struct _PAGINGFILE
KSPIN_LOCK AllocMapLock;
ULONG AllocMapSize;
PGET_RETRIEVAL_DESCRIPTOR RetrievalPointers;
} PAGINGFILE, *PPAGINGFILE;
}
PAGINGFILE, *PPAGINGFILE;
typedef struct _RETRIEVEL_DESCRIPTOR_LIST
{
@ -176,10 +177,15 @@ MmGetOffsetPageFile(PGET_RETRIEVAL_DESCRIPTOR RetrievalPointers, LARGE_INTEGER O
}
KEBUGCHECK(0);
#if defined(__GNUC__)
return (LARGE_INTEGER)0LL;
#else
{
const LARGE_INTEGER dummy = { 0 };
const LARGE_INTEGER dummy =
{
0
};
return dummy;
}
#endif
@ -549,10 +555,15 @@ MmDumpToPagingFile(ULONG BugCode,
/* Dump the header. */
MdlMap[0] = MmGetPhysicalAddress(MmCoreDumpPageFrame).u.LowPart;
#if defined(__GNUC__)
DiskOffset = MmGetOffsetPageFile(RetrievalPointers, (LARGE_INTEGER)0LL);
#else
{
const LARGE_INTEGER dummy = { 0 };
const LARGE_INTEGER dummy =
{
0
};
DiskOffset = MmGetOffsetPageFile(RetrievalPointers, dummy);
}
#endif
@ -563,7 +574,8 @@ MmDumpToPagingFile(ULONG BugCode,
DPRINT1("MM: Failed to write core dump header\n.");
return(Status);
}
NextOffset += PAGE_SIZE;;
NextOffset += PAGE_SIZE;
;
DbgPrint("00");
@ -579,9 +591,11 @@ MmDumpToPagingFile(ULONG BugCode,
PAGE_READWRITE,
PhysicalAddress);
#if defined(__GNUC__)
DiskOffset = MmGetOffsetPageFile(RetrievalPointers,
(LARGE_INTEGER)NextOffset);
#else
{
LARGE_INTEGER dummy;
dummy.QuadPart = NextOffset;
@ -829,8 +843,10 @@ NtCreatePagingFile(IN PUNICODE_STRING FileName,
#if defined(__GNUC__)
Vcn.QuadPart = 0LL;
#else
Vcn.QuadPart = 0;
#endif
ExtentCount = 0;
MaxVcn = (ULONG)((InitialSize->QuadPart + BytesPerAllocationUnit - 1) / BytesPerAllocationUnit);
while(1)

View File

@ -1,4 +1,4 @@
/* $Id: pageop.c,v 1.19 2004/03/05 11:31:59 hbirr Exp $
/* $Id: pageop.c,v 1.20 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel

View File

@ -1,4 +1,4 @@
/* $Id: pager.c,v 1.16 2003/11/16 15:20:39 hbirr Exp $
/* $Id: pager.c,v 1.17 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -83,7 +83,8 @@ MmPagerThreadMain(PVOID Ignored)
{
/* Try and make some memory available to the system. */
MmRebalanceMemoryConsumers();
} while(PagerThreadWorkCount > 0);
}
while(PagerThreadWorkCount > 0);
}
}

View File

@ -1,4 +1,4 @@
/* $Id: pagfault.c,v 1.5 2003/07/10 21:05:03 royce Exp $ */
/* $Id: pagfault.c,v 1.6 2004/04/10 22:35:25 gdalsnes Exp $ */
#include <ddk/ntddk.h>
#include <internal/ps.h>

View File

@ -1,4 +1,4 @@
/* $Id: pool.c,v 1.27 2004/02/26 18:54:52 navaraf Exp $
/* $Id: pool.c,v 1.28 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -91,11 +91,13 @@ ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
{
PVOID Block;
#if defined(__GNUC__)
Block = EiAllocatePool(PoolType,
NumberOfBytes,
TAG_NONE,
(PVOID)__builtin_return_address(0));
#elif defined(_MSC_VER)
Block = EiAllocatePool(PoolType,
NumberOfBytes,
TAG_NONE,
@ -103,6 +105,7 @@ ExAllocatePool (POOL_TYPE PoolType, ULONG NumberOfBytes)
#else
#error Unknown compiler
#endif
return(Block);
}
@ -115,11 +118,13 @@ ExAllocatePoolWithTag (ULONG PoolType, ULONG NumberOfBytes, ULONG Tag)
{
PVOID Block;
#if defined(__GNUC__)
Block = EiAllocatePool(PoolType,
NumberOfBytes,
Tag,
(PVOID)__builtin_return_address(0));
#elif defined(_MSC_VER)
Block = EiAllocatePool(PoolType,
NumberOfBytes,
Tag,
@ -127,6 +132,7 @@ ExAllocatePoolWithTag (ULONG PoolType, ULONG NumberOfBytes, ULONG Tag)
#else
#error Unknown compiler
#endif
return(Block);
}
@ -157,6 +163,7 @@ ExAllocatePoolWithQuotaTag (IN POOL_TYPE PoolType,
(PVOID)__builtin_return_address(0));
return(Block);
#else
UNIMPLEMENTED;
return(NULL);
#endif

View File

@ -1,4 +1,4 @@
/* $Id: ppool.c,v 1.27 2004/03/30 09:28:44 gvg Exp $
/* $Id: ppool.c,v 1.28 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -36,16 +36,19 @@ typedef struct _MM_PPOOL_FREE_BLOCK_HEADER
{
ULONG Size;
struct _MM_PPOOL_FREE_BLOCK_HEADER* NextFree;
} MM_PPOOL_FREE_BLOCK_HEADER, *PMM_PPOOL_FREE_BLOCK_HEADER;
}
MM_PPOOL_FREE_BLOCK_HEADER, *PMM_PPOOL_FREE_BLOCK_HEADER;
typedef struct _MM_PPOOL_USED_BLOCK_HEADER
{
ULONG Size;
#if MM_PPOOL_REDZONE_BYTES
ULONG UserSize; // how many bytes the user actually asked for...
struct _MM_PPOOL_USED_BLOCK_HEADER* NextUsed;
#endif//MM_PPOOL_REDZONE_BYTES
} MM_PPOOL_USED_BLOCK_HEADER, *PMM_PPOOL_USED_BLOCK_HEADER;
}
MM_PPOOL_USED_BLOCK_HEADER, *PMM_PPOOL_USED_BLOCK_HEADER;
PVOID MmPagedPoolBase;
ULONG MmPagedPoolSize;
@ -85,6 +88,7 @@ MmInitializePagedPool(VOID)
MmPagedPoolFirstFreeBlock->NextFree = NULL;
#if MM_PPOOL_REDZONE_BYTES
MmPagedPoolFirstUsedBlock = NULL;
#endif//MM_PPOOL_REDZONE_BYTES
@ -289,7 +293,8 @@ ExAllocatePagedPoolWithTag (IN POOL_TYPE PoolType,
/*
* non-size-aligned block search
*/
else while ( CurrentBlock != NULL )
else
while ( CurrentBlock != NULL )
{
if ( CurrentBlock->Size >= BlockSize
&& ( BestBlock == NULL || BestBlock->Size > CurrentBlock->Size )
@ -409,6 +414,7 @@ ExAllocatePagedPoolWithTag (IN POOL_TYPE PoolType,
/* RtlZeroMemory(BlockAddress, NumberOfBytes);*/
#if MM_PPOOL_REDZONE_BYTES
NewBlock->UserSize = NumberOfBytes;
// write out buffer-overrun detection bytes
{

View File

@ -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: region.c,v 1.6 2003/12/30 18:52:05 fireball Exp $
/* $Id: region.c,v 1.7 2004/04/10 22:35:25 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/region.c
@ -198,6 +198,7 @@ MmAlterRegion(PMADDRESS_SPACE AddressSpace, PVOID BaseAddress,
#if defined(__GNUC__)
CurrentBaseAddress += CurrentRegion->Length;
#else
{
char* pTemp = CurrentBaseAddress;
pTemp += CurrentRegion->Length;
@ -308,14 +309,17 @@ MmFindRegion(PVOID BaseAddress, PLIST_ENTRY RegionListHead, PVOID Address,
current_entry = current_entry->Flink;
#if defined(__GNUC__)
StartAddress += current->Length;
#else
{
char* pTemp = StartAddress;
pTemp += current->Length;
StartAddress = pTemp;
}
#endif
}
return(NULL);
}

View File

@ -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: rmap.c,v 1.27 2004/03/05 11:31:59 hbirr Exp $
/* $Id: rmap.c,v 1.28 2004/04/10 22:35:25 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
@ -43,7 +43,8 @@ typedef struct _MM_RMAP_ENTRY
struct _MM_RMAP_ENTRY* Next;
PEPROCESS Process;
PVOID Address;
} MM_RMAP_ENTRY, *PMM_RMAP_ENTRY;
}
MM_RMAP_ENTRY, *PMM_RMAP_ENTRY;
#define TAG_RMAP TAG('R', 'M', 'A', 'P')

View File

@ -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.146 2004/03/05 11:31:59 hbirr Exp $
/* $Id: section.c,v 1.147 2004/04/10 22:35:26 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c
@ -54,7 +54,8 @@ typedef struct
ULONG Offset;
BOOLEAN WasDirty;
BOOLEAN Private;
} MM_SECTION_PAGEOUT_CONTEXT;
}
MM_SECTION_PAGEOUT_CONTEXT;
/* GLOBALS *******************************************************************/
@ -91,10 +92,13 @@ MmspWaitForPageOpCompletionEvent(PMM_PAGEOP PageOp)
{
LARGE_INTEGER Timeout;
#ifdef __GNUC__ /* TODO: Use other macro to check for suffix to use? */
Timeout.QuadPart = -100000000LL; // 10 sec
#else
Timeout.QuadPart = -100000000; // 10 sec
#endif
return KeWaitForSingleObject(&PageOp->CompletionEvent, 0, KernelMode, FALSE, &Timeout);
}

View File

@ -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: slab.c,v 1.11 2004/03/04 00:07:02 navaraf Exp $
/* $Id: slab.c,v 1.12 2004/04/10 22:35:26 gdalsnes Exp $
*
* COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel
@ -52,19 +52,22 @@ typedef struct _SLAB_CACHE
LIST_ENTRY PageListHead;
struct _SLAB_CACHE_PAGE* FirstFreePage;
KSPIN_LOCK SlabLock;
} SLAB_CACHE, *PSLAB_CACHE;
}
SLAB_CACHE, *PSLAB_CACHE;
typedef struct _SLAB_CACHE_BUFCTL
{
struct _SLAB_CACHE_BUFCTL* NextFree;
} SLAB_CACHE_BUFCTL, *PSLAB_CACHE_BUFCTL;
}
SLAB_CACHE_BUFCTL, *PSLAB_CACHE_BUFCTL;
typedef struct _SLAB_CACHE_PAGE
{
LIST_ENTRY PageListEntry;
PSLAB_CACHE_BUFCTL FirstFreeBuffer;
ULONG ReferenceCount;
} SLAB_CACHE_PAGE, *PSLAB_CACHE_PAGE;
}
SLAB_CACHE_PAGE, *PSLAB_CACHE_PAGE;
/* GLOBALS ******************************************************************/

View File

@ -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: virtual.c,v 1.71 2003/12/14 17:44:02 hbirr Exp $
/* $Id: virtual.c,v 1.72 2004/04/10 22:35:26 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/virtual.c

View File

@ -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: wset.c,v 1.17 2003/07/12 01:52:10 dwelch Exp $
/* $Id: wset.c,v 1.18 2004/04/10 22:35:26 gdalsnes Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/wset.c