mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
More cygwin fixes
svn path=/trunk/; revision=2470
This commit is contained in:
parent
3273c93173
commit
6ade027031
3 changed files with 71 additions and 20 deletions
|
@ -23,6 +23,6 @@ extern ULONG MmPagedPoolSize;
|
||||||
/*
|
/*
|
||||||
* Maximum size of the kmalloc area (this is totally arbitary)
|
* Maximum size of the kmalloc area (this is totally arbitary)
|
||||||
*/
|
*/
|
||||||
#define NONPAGED_POOL_SIZE (4*1024*1024)
|
#define NONPAGED_POOL_SIZE (400*1024*1024)
|
||||||
|
|
||||||
#endif /* __INTERNAL_POOL_H */
|
#endif /* __INTERNAL_POOL_H */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: npool.c,v 1.54 2002/01/01 00:21:56 dwelch Exp $
|
/* $Id: npool.c,v 1.55 2002/01/01 05:09:50 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -1027,7 +1027,8 @@ ExAllocateWholePageBlock(ULONG UserSize)
|
||||||
MmCreateVirtualMapping(NULL,
|
MmCreateVirtualMapping(NULL,
|
||||||
Address + (i * PAGESIZE),
|
Address + (i * PAGESIZE),
|
||||||
PAGE_READWRITE | PAGE_SYSTEM,
|
PAGE_READWRITE | PAGE_SYSTEM,
|
||||||
(ULONG)Page);
|
(ULONG)Page,
|
||||||
|
TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
*((PULONG)((ULONG)Address + (NrPages * PAGESIZE) - Size)) = NrPages;
|
*((PULONG)((ULONG)Address + (NrPages * PAGESIZE) - Size)) = NrPages;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: section.c,v 1.73 2002/01/01 03:29:15 dwelch Exp $
|
/* $Id: section.c,v 1.74 2002/01/01 05:09:50 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/mm/section.c
|
* FILE: ntoskrnl/mm/section.c
|
||||||
|
@ -394,6 +394,10 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
* we might have to move other things out of memory
|
* we might have to move other things out of memory
|
||||||
*/
|
*/
|
||||||
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
|
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, Page);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create an mdl to hold the page we are going to read data into.
|
* Create an mdl to hold the page we are going to read data into.
|
||||||
|
@ -500,6 +504,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
{
|
{
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MmReleasePageOp(PageOp);
|
MmReleasePageOp(PageOp);
|
||||||
|
DPRINT("Address 0x%.8X\n", Address);
|
||||||
return(STATUS_MM_RESTART_OPERATION);
|
return(STATUS_MM_RESTART_OPERATION);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -508,6 +513,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
if (!NT_SUCCESS(PageOp->Status))
|
if (!NT_SUCCESS(PageOp->Status))
|
||||||
{
|
{
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
DPRINT("Address 0x%.8X\n", Address);
|
||||||
return(PageOp->Status);
|
return(PageOp->Status);
|
||||||
}
|
}
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
@ -544,6 +550,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
MmUnlockSection(Section);
|
MmUnlockSection(Section);
|
||||||
MmReleasePageOp(PageOp);
|
MmReleasePageOp(PageOp);
|
||||||
|
DPRINT("Address 0x%.8X\n", Address);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,14 +586,13 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
FALSE);
|
FALSE);
|
||||||
while (Status == STATUS_NO_MEMORY)
|
while (Status == STATUS_NO_MEMORY)
|
||||||
{
|
{
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
KeBugCheck(0);
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
|
||||||
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
Status = MmCreateVirtualMapping(PsGetCurrentProcess(),
|
||||||
Address,
|
Address,
|
||||||
MemoryArea->Attributes,
|
MemoryArea->Attributes,
|
||||||
(ULONG)Page,
|
(ULONG)Page,
|
||||||
FALSE);
|
TRUE);
|
||||||
|
MmLockAddressSpace(AddressSpace);
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
@ -598,7 +604,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
/*
|
/*
|
||||||
* Add the page to the process's working set
|
* Add the page to the process's working set
|
||||||
*/
|
*/
|
||||||
MmInsertRmap(Page, PsGetCurrentProcess(), (PVOID)PAGE_ROUND_DOWN(Address));
|
MmInsertRmap(Page, PsGetCurrentProcess(), (PVOID)PAGE_ROUND_DOWN(Address));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finish the operation
|
* Finish the operation
|
||||||
|
@ -610,6 +616,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE);
|
||||||
MmReleasePageOp(PageOp);
|
MmReleasePageOp(PageOp);
|
||||||
|
DPRINT("Address 0x%.8X\n", Address);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,6 +647,7 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
MmReleasePageOp(PageOp);
|
MmReleasePageOp(PageOp);
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
MmUnlockSection(Section);
|
MmUnlockSection(Section);
|
||||||
|
DPRINT("Address 0x%.8X\n", Address);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,13 +687,16 @@ MmNotPresentFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
MmReleasePageOp(PageOp);
|
MmReleasePageOp(PageOp);
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
MmUnlockSection(Section);
|
MmUnlockSection(Section);
|
||||||
|
DPRINT("Address 0x%.8X\n", Address);
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if this page needs to be mapped COW
|
* Check if this page needs to be mapped COW
|
||||||
*/
|
*/
|
||||||
if (Segment->WriteCopy || MemoryArea->Data.SectionData.WriteCopyView)
|
if ((Segment->WriteCopy || MemoryArea->Data.SectionData.WriteCopyView) &&
|
||||||
|
(MemoryArea->Attributes == PAGE_READWRITE ||
|
||||||
|
MemoryArea->Attributes == PAGE_EXECUTE_READWRITE))
|
||||||
{
|
{
|
||||||
Attributes = PAGE_READONLY;
|
Attributes = PAGE_READONLY;
|
||||||
}
|
}
|
||||||
|
@ -957,10 +968,21 @@ MmAccessFaultSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
MmLockSection(Section);
|
MmLockSection(Section);
|
||||||
MmLockSectionSegment(Segment);
|
MmLockSectionSegment(Segment);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sanity check.
|
||||||
|
*/
|
||||||
|
if (MmGetPageEntrySectionSegment(Segment, Offset.QuadPart) == 0)
|
||||||
|
{
|
||||||
|
DPRINT1("COW fault for page with PESS 0. Address was 0x%.8X\n",
|
||||||
|
Address);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we are doing COW
|
* Check if we are doing COW
|
||||||
*/
|
*/
|
||||||
if (!(Segment->WriteCopy || MemoryArea->Data.SectionData.WriteCopyView))
|
if (!((Segment->WriteCopy || MemoryArea->Data.SectionData.WriteCopyView) &&
|
||||||
|
(MemoryArea->Attributes == PAGE_READWRITE ||
|
||||||
|
MemoryArea->Attributes == PAGE_EXECUTE_READWRITE)))
|
||||||
{
|
{
|
||||||
MmUnlockSection(Section);
|
MmUnlockSection(Section);
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
|
@ -2108,33 +2130,61 @@ MmCreateImageSection(PHANDLE SectionHandle,
|
||||||
ImageSections[i-1].PointerToRawData;
|
ImageSections[i-1].PointerToRawData;
|
||||||
SectionSegments[i].Characteristics =
|
SectionSegments[i].Characteristics =
|
||||||
ImageSections[i-1].Characteristics;
|
ImageSections[i-1].Characteristics;
|
||||||
if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_CODE)
|
|
||||||
|
/*
|
||||||
|
* Set up the protection and write copy variables.
|
||||||
|
*/
|
||||||
|
if ((ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_READABLE) ||
|
||||||
|
(ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_WRITABLE) ||
|
||||||
|
(ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_EXECUTABLE))
|
||||||
|
{
|
||||||
|
SectionSegments[i].Protection =
|
||||||
|
SectionCharacteristicsToProtect[ImageSections[i-1].Characteristics >> 28];
|
||||||
|
SectionSegments[i].WriteCopy =
|
||||||
|
!(ImageSections[i - 1].Characteristics & IMAGE_SECTION_CHAR_SHARED);
|
||||||
|
}
|
||||||
|
else if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_CODE)
|
||||||
{
|
{
|
||||||
SectionSegments[i].Protection = PAGE_EXECUTE_READ;
|
SectionSegments[i].Protection = PAGE_EXECUTE_READ;
|
||||||
SectionSegments[i].Attributes = 0;
|
|
||||||
SectionSegments[i].WriteCopy = TRUE;
|
SectionSegments[i].WriteCopy = TRUE;
|
||||||
}
|
}
|
||||||
else if (ImageSections[i-1].Characteristics &
|
else if (ImageSections[i-1].Characteristics &
|
||||||
IMAGE_SECTION_CHAR_DATA)
|
IMAGE_SECTION_CHAR_DATA)
|
||||||
{
|
{
|
||||||
SectionSegments[i].Protection = PAGE_READWRITE;
|
SectionSegments[i].Protection = PAGE_READWRITE;
|
||||||
SectionSegments[i].Attributes = 0;
|
|
||||||
SectionSegments[i].WriteCopy = TRUE;
|
SectionSegments[i].WriteCopy = TRUE;
|
||||||
}
|
}
|
||||||
else if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_BSS)
|
else if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_BSS)
|
||||||
{
|
{
|
||||||
SectionSegments[i].Protection = PAGE_READWRITE;
|
SectionSegments[i].Protection = PAGE_READWRITE;
|
||||||
SectionSegments[i].Attributes = MM_SECTION_SEGMENT_BSS;
|
|
||||||
SectionSegments[i].WriteCopy = TRUE;
|
SectionSegments[i].WriteCopy = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SectionSegments[i].Protection =
|
SectionSegments[i].Protection = PAGE_NOACCESS;
|
||||||
SectionCharacteristicsToProtect[ImageSections[i-1].Characteristics >> 28];
|
SectionSegments[i].WriteCopy = TRUE;
|
||||||
SectionSegments[i].Attributes = 0;
|
|
||||||
SectionSegments[i].WriteCopy =
|
|
||||||
!(ImageSections[i - 1].Characteristics & IMAGE_SECTION_CHAR_SHARED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set up the attributes.
|
||||||
|
*/
|
||||||
|
if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_CODE)
|
||||||
|
{
|
||||||
|
SectionSegments[i].Attributes = 0;
|
||||||
|
}
|
||||||
|
else if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_DATA)
|
||||||
|
{
|
||||||
|
SectionSegments[i].Attributes = 0;
|
||||||
|
}
|
||||||
|
else if (ImageSections[i-1].Characteristics & IMAGE_SECTION_CHAR_BSS)
|
||||||
|
{
|
||||||
|
SectionSegments[i].Attributes = MM_SECTION_SEGMENT_BSS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SectionSegments[i].Attributes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
SectionSegments[i].RawLength = ImageSections[i-1].SizeOfRawData;
|
SectionSegments[i].RawLength = ImageSections[i-1].SizeOfRawData;
|
||||||
SectionSegments[i].Length =
|
SectionSegments[i].Length =
|
||||||
ImageSections[i-1].Misc.VirtualSize;
|
ImageSections[i-1].Misc.VirtualSize;
|
||||||
|
|
Loading…
Reference in a new issue