Fixed reference counting of page tables

Don't print addresses that aren't in the text segment of a module

svn path=/trunk/; revision=1627
This commit is contained in:
David Welch 2001-02-18 17:43:32 +00:00
parent d458692c89
commit f827a8f124
3 changed files with 31 additions and 15 deletions

View file

@ -57,7 +57,8 @@ extern ULONG init_stack_top;
extern unsigned int _text_start__, _text_end__; extern unsigned int _text_start__, _text_end__;
static void print_address(PVOID address) STATIC BOOLEAN
print_address(PVOID address)
{ {
PLIST_ENTRY current_entry; PLIST_ENTRY current_entry;
PMODULE_OBJECT current; PMODULE_OBJECT current;
@ -75,12 +76,15 @@ static void print_address(PVOID address)
{ {
DbgPrint("<%wZ: %x>", &current->Name, DbgPrint("<%wZ: %x>", &current->Name,
address - current->Base); address - current->Base);
return; return(TRUE);
} }
current_entry = current_entry->Flink; current_entry = current_entry->Flink;
} }
#if 0
DbgPrint("<%x>", address); DbgPrint("<%x>", address);
#endif
return(FALSE);
} }
ULONG ULONG

View file

@ -1,4 +1,4 @@
/* $Id: page.c,v 1.19 2001/02/10 22:51:11 dwelch Exp $ /* $Id: page.c,v 1.20 2001/02/18 17:43:32 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top directory * COPYRIGHT: See COPYING in the top directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -173,7 +173,8 @@ VOID MmFreePageTable(PEPROCESS Process, PVOID Address)
{ {
if (PageTable[i] != 0) if (PageTable[i] != 0)
{ {
DbgPrint("Page table entry not clear\n"); DbgPrint("Page table entry not clear at %x/%x (is %x)\n",
((ULONG)Address / 4*1024*1024), i, PageTable[i]);
KeBugCheck(0); KeBugCheck(0);
} }
} }
@ -324,7 +325,7 @@ VOID MmDeleteVirtualMapping(PEPROCESS Process, PVOID Address, BOOL FreePage)
Ptrc = Process->AddressSpace.PageTableRefCountTable; Ptrc = Process->AddressSpace.PageTableRefCountTable;
Ptrc[ADDR_TO_PAGE_TABLE(Address)]--; Ptrc[ADDR_TO_PAGE_TABLE(Address)]--;
#if 0 #if 1
if (Ptrc[ADDR_TO_PAGE_TABLE(Address)] == 0) if (Ptrc[ADDR_TO_PAGE_TABLE(Address)] == 0)
{ {
MmFreePageTable(Process, Address); MmFreePageTable(Process, Address);
@ -441,6 +442,17 @@ NTSTATUS MmCreateVirtualMapping(PEPROCESS Process,
if (!MmIsUsablePage((PVOID)PhysicalAddress)) if (!MmIsUsablePage((PVOID)PhysicalAddress))
{ {
DPRINT1("Page not usable\n");
KeBugCheck(0);
}
if (Process == NULL && Address < (PVOID)KERNEL_BASE)
{
DPRINT1("No process\n");
KeBugCheck(0);
}
if (Process != NULL && Address >= (PVOID)KERNEL_BASE)
{
DPRINT1("Setting kernel address with process context\n");
KeBugCheck(0); KeBugCheck(0);
} }

View file

@ -1,4 +1,4 @@
/* $Id: section.c,v 1.46 2001/02/14 02:53:53 dwelch Exp $ /* $Id: section.c,v 1.47 2001/02/18 17:43:32 dwelch Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -218,7 +218,7 @@ MmWaitForPendingOperationSection(PMADDRESS_SPACE AddressSpace,
* and have a reference to a page containing valid data for the * and have a reference to a page containing valid data for the
* section offset. Set the page and return success. * section offset. Set the page and return success.
*/ */
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
Attributes, Attributes,
(ULONG)Page); (ULONG)Page);
@ -294,7 +294,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
/* /*
* Just map the desired physical page * Just map the desired physical page
*/ */
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
MemoryArea->Attributes, MemoryArea->Attributes,
Offset.QuadPart); Offset.QuadPart);
@ -329,7 +329,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
MmLockSectionSegment(Segment); MmLockSectionSegment(Segment);
Page = MmAllocPage(0); Page = MmAllocPage(0);
} }
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
MemoryArea->Attributes, MemoryArea->Attributes,
(ULONG)Page); (ULONG)Page);
@ -406,7 +406,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Page = (PVOID)Entry; Page = (PVOID)Entry;
MmReferencePage(Page); MmReferencePage(Page);
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
Attributes, Attributes,
(ULONG)Page); (ULONG)Page);
@ -500,7 +500,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
*/ */
MmSetWaitPage(Page); MmSetWaitPage(Page);
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
Attributes, Attributes,
(ULONG)Page); (ULONG)Page);
@ -541,7 +541,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
Page = (PVOID)Entry; Page = (PVOID)Entry;
MmReferencePage(Page); MmReferencePage(Page);
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
Attributes, Attributes,
(ULONG)Page); (ULONG)Page);
@ -626,7 +626,7 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
memcpy(NewAddress, (PVOID)PAGE_ROUND_DOWN(Address), PAGESIZE); memcpy(NewAddress, (PVOID)PAGE_ROUND_DOWN(Address), PAGESIZE);
ExUnmapPage(NewAddress); ExUnmapPage(NewAddress);
Status = MmCreateVirtualMapping(NULL, Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
Address, Address,
MemoryArea->Attributes, MemoryArea->Attributes,
(ULONG)NewPage); (ULONG)NewPage);