mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fixed the mapping for low alignment images.
svn path=/trunk/; revision=18679
This commit is contained in:
parent
14f1738dcb
commit
37fe3f1b68
1 changed files with 13 additions and 9 deletions
|
@ -1747,7 +1747,7 @@ MmWritePageSectionView(PMADDRESS_SPACE AddressSpace,
|
||||||
* memory area was mapped at an offset in the file which is page aligned
|
* memory area was mapped at an offset in the file which is page aligned
|
||||||
* then note this is a direct mapped page.
|
* then note this is a direct mapped page.
|
||||||
*/
|
*/
|
||||||
if ((Offset + MemoryArea->Data.SectionData.ViewOffset % PAGE_SIZE) == 0 &&
|
if (((Offset + Segment->FileOffset) % PAGE_SIZE) == 0 &&
|
||||||
(Offset + PAGE_SIZE <= Segment->RawLength || !IsImageSection))
|
(Offset + PAGE_SIZE <= Segment->RawLength || !IsImageSection))
|
||||||
{
|
{
|
||||||
DirectMapped = TRUE;
|
DirectMapped = TRUE;
|
||||||
|
@ -2813,6 +2813,7 @@ MmspPageAlignSegments
|
||||||
ULONG i;
|
ULONG i;
|
||||||
ULONG LastSegment;
|
ULONG LastSegment;
|
||||||
BOOLEAN Initialized;
|
BOOLEAN Initialized;
|
||||||
|
PMM_SECTION_SEGMENT EffectiveSegment;
|
||||||
|
|
||||||
if (Flags & EXEFMT_LOAD_ASSUME_SEGMENTS_PAGE_ALIGNED)
|
if (Flags & EXEFMT_LOAD_ASSUME_SEGMENTS_PAGE_ALIGNED)
|
||||||
{
|
{
|
||||||
|
@ -2822,11 +2823,10 @@ MmspPageAlignSegments
|
||||||
|
|
||||||
Initialized = FALSE;
|
Initialized = FALSE;
|
||||||
LastSegment = 0;
|
LastSegment = 0;
|
||||||
|
EffectiveSegment = &ImageSectionObject->Segments[LastSegment];
|
||||||
|
|
||||||
for ( i = 0; i < ImageSectionObject->NrSegments; ++ i )
|
for ( i = 0; i < ImageSectionObject->NrSegments; ++ i )
|
||||||
{
|
{
|
||||||
PMM_SECTION_SEGMENT EffectiveSegment = &ImageSectionObject->Segments[LastSegment];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The first segment requires special handling
|
* The first segment requires special handling
|
||||||
*/
|
*/
|
||||||
|
@ -2880,11 +2880,14 @@ MmspPageAlignSegments
|
||||||
|
|
||||||
EffectiveSegment = &ImageSectionObject->Segments[LastSegment];
|
EffectiveSegment = &ImageSectionObject->Segments[LastSegment];
|
||||||
|
|
||||||
/*
|
if (LastSegment != i)
|
||||||
* Copy the current segment. If necessary, the effective segment
|
{
|
||||||
* will be expanded later
|
/*
|
||||||
*/
|
* Copy the current segment. If necessary, the effective segment
|
||||||
*EffectiveSegment = *Segment;
|
* will be expanded later
|
||||||
|
*/
|
||||||
|
*EffectiveSegment = *Segment;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Page-align the virtual size. We know for sure the virtual address
|
* Page-align the virtual size. We know for sure the virtual address
|
||||||
|
@ -2937,7 +2940,7 @@ MmspPageAlignSegments
|
||||||
/*
|
/*
|
||||||
* Extend the virtual size
|
* Extend the virtual size
|
||||||
*/
|
*/
|
||||||
ASSERT(PAGE_ROUND_UP(Segment->VirtualAddress + Segment->Length) > EndOfEffectiveSegment);
|
ASSERT(PAGE_ROUND_UP(Segment->VirtualAddress + Segment->Length) >= EndOfEffectiveSegment);
|
||||||
|
|
||||||
EffectiveSegment->Length = PAGE_ROUND_UP(Segment->VirtualAddress + Segment->Length) -
|
EffectiveSegment->Length = PAGE_ROUND_UP(Segment->VirtualAddress + Segment->Length) -
|
||||||
EffectiveSegment->VirtualAddress;
|
EffectiveSegment->VirtualAddress;
|
||||||
|
@ -2981,6 +2984,7 @@ MmspPageAlignSegments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ImageSectionObject->NrSegments = LastSegment + 1;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue