mirror of
https://github.com/reactos/reactos.git
synced 2025-06-10 12:24:48 +00:00
[NTOSKRNL]
- Make file offsets 64 bit - Fix lots of MSVC/64 bit warnings svn path=/trunk/; revision=56264
This commit is contained in:
parent
549c33f2ff
commit
3bdad064e3
19 changed files with 108 additions and 100 deletions
16
reactos/ntoskrnl/cache/section/data.c
vendored
16
reactos/ntoskrnl/cache/section/data.c
vendored
|
@ -129,7 +129,7 @@ MiZeroFillSection(PVOID Address, PLARGE_INTEGER FileOffsetPtr, ULONG Length)
|
||||||
while (FileOffset.QuadPart < End.QuadPart)
|
while (FileOffset.QuadPart < End.QuadPart)
|
||||||
{
|
{
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
|
|
||||||
if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page)))
|
if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page)))
|
||||||
break;
|
break;
|
||||||
|
@ -223,7 +223,7 @@ _MiFlushMappedSection(PVOID BaseAddress,
|
||||||
PageAddress < EndingAddress;
|
PageAddress < EndingAddress;
|
||||||
PageAddress += PAGE_SIZE)
|
PageAddress += PAGE_SIZE)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
FileOffset.QuadPart = ViewOffset.QuadPart + PageAddress - BeginningAddress;
|
FileOffset.QuadPart = ViewOffset.QuadPart + PageAddress - BeginningAddress;
|
||||||
Entry = MmGetPageEntrySectionSegment(MemoryArea->Data.SectionData.Segment,
|
Entry = MmGetPageEntrySectionSegment(MemoryArea->Data.SectionData.Segment,
|
||||||
&FileOffset);
|
&FileOffset);
|
||||||
|
@ -250,7 +250,7 @@ _MiFlushMappedSection(PVOID BaseAddress,
|
||||||
PageAddress < EndingAddress;
|
PageAddress < EndingAddress;
|
||||||
PageAddress += PAGE_SIZE)
|
PageAddress += PAGE_SIZE)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
FileOffset.QuadPart = ViewOffset.QuadPart + PageAddress - BeginningAddress;
|
FileOffset.QuadPart = ViewOffset.QuadPart + PageAddress - BeginningAddress;
|
||||||
Entry = Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT];
|
Entry = Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT];
|
||||||
Page = PFN_FROM_SSE(Entry);
|
Page = PFN_FROM_SSE(Entry);
|
||||||
|
@ -351,7 +351,7 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
||||||
{
|
{
|
||||||
PROS_SECTION_OBJECT Section;
|
PROS_SECTION_OBJECT Section;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULARGE_INTEGER MaximumSize;
|
LARGE_INTEGER MaximumSize;
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
IO_STATUS_BLOCK Iosb;
|
IO_STATUS_BLOCK Iosb;
|
||||||
CC_FILE_SIZES FileSizes;
|
CC_FILE_SIZES FileSizes;
|
||||||
|
@ -394,6 +394,7 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
||||||
*/
|
*/
|
||||||
if (!CcGetFileSizes(FileObject, &FileSizes))
|
if (!CcGetFileSizes(FileObject, &FileSizes))
|
||||||
{
|
{
|
||||||
|
ULONG Information;
|
||||||
/*
|
/*
|
||||||
* FIXME: This is propably not entirely correct. We can't look into
|
* FIXME: This is propably not entirely correct. We can't look into
|
||||||
* the standard FCB header because it might not be initialized yet
|
* the standard FCB header because it might not be initialized yet
|
||||||
|
@ -405,7 +406,8 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
||||||
FileStandardInformation,
|
FileStandardInformation,
|
||||||
sizeof(FILE_STANDARD_INFORMATION),
|
sizeof(FILE_STANDARD_INFORMATION),
|
||||||
&FileInfo,
|
&FileInfo,
|
||||||
&Iosb.Information);
|
&Information);
|
||||||
|
Iosb.Information = Information;
|
||||||
DPRINT("Query => %x\n", Status);
|
DPRINT("Query => %x\n", Status);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
@ -644,7 +646,7 @@ NTAPI
|
||||||
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
|
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER FileOffset)
|
PLARGE_INTEGER FileOffset)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
PFILE_OBJECT FileObject = Segment->FileObject;
|
PFILE_OBJECT FileObject = Segment->FileObject;
|
||||||
|
|
||||||
Entry = MmGetPageEntrySectionSegment(Segment, FileOffset);
|
Entry = MmGetPageEntrySectionSegment(Segment, FileOffset);
|
||||||
|
@ -696,7 +698,7 @@ MmFreeCacheSectionPage(PVOID Context,
|
||||||
SWAPENTRY SwapEntry,
|
SWAPENTRY SwapEntry,
|
||||||
BOOLEAN Dirty)
|
BOOLEAN Dirty)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
PVOID *ContextData = Context;
|
PVOID *ContextData = Context;
|
||||||
PMMSUPPORT AddressSpace;
|
PMMSUPPORT AddressSpace;
|
||||||
PEPROCESS Process;
|
PEPROCESS Process;
|
||||||
|
|
4
reactos/ntoskrnl/cache/section/fault.c
vendored
4
reactos/ntoskrnl/cache/section/fault.c
vendored
|
@ -69,7 +69,7 @@ MmNotPresentFaultCachePage(PMMSUPPORT AddressSpace,
|
||||||
ULONG Consumer;
|
ULONG Consumer;
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
LARGE_INTEGER FileOffset, TotalOffset;
|
LARGE_INTEGER FileOffset, TotalOffset;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
ULONG Attributes;
|
ULONG Attributes;
|
||||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
@ -295,7 +295,7 @@ MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
|
||||||
Region->Protect == PAGE_EXECUTE_READWRITE)
|
Region->Protect == PAGE_EXECUTE_READWRITE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
DPRINTC("setting non-cow page %x %x:%x offset %x (%x) to writable\n",
|
DPRINTC("setting non-cow page %x %x:%x offset %x (%x) to writable\n",
|
||||||
Segment,
|
Segment,
|
||||||
Process,
|
Process,
|
||||||
|
|
16
reactos/ntoskrnl/cache/section/newmm.h
vendored
16
reactos/ntoskrnl/cache/section/newmm.h
vendored
|
@ -5,16 +5,20 @@
|
||||||
/* TYPES *********************************************************************/
|
/* TYPES *********************************************************************/
|
||||||
|
|
||||||
#define MM_WAIT_ENTRY 0x7ffff800
|
#define MM_WAIT_ENTRY 0x7ffff800
|
||||||
#define PFN_FROM_SSE(E) ((E) >> PAGE_SHIFT)
|
#define PFN_FROM_SSE(E) ((PFN_NUMBER)((E) >> PAGE_SHIFT))
|
||||||
#define IS_SWAP_FROM_SSE(E) ((E) & 0x00000001)
|
#define IS_SWAP_FROM_SSE(E) ((E) & 0x00000001)
|
||||||
#define MM_IS_WAIT_PTE(E) \
|
#define MM_IS_WAIT_PTE(E) \
|
||||||
(IS_SWAP_FROM_SSE(E) && SWAPENTRY_FROM_SSE(E) == MM_WAIT_ENTRY)
|
(IS_SWAP_FROM_SSE(E) && SWAPENTRY_FROM_SSE(E) == MM_WAIT_ENTRY)
|
||||||
#define MAKE_PFN_SSE(P) ((P) << PAGE_SHIFT)
|
#define MAKE_PFN_SSE(P) ((ULONG_PTR)((P) << PAGE_SHIFT))
|
||||||
#define SWAPENTRY_FROM_SSE(E) ((E) >> 1)
|
#define SWAPENTRY_FROM_SSE(E) ((E) >> 1)
|
||||||
#define MAKE_SWAP_SSE(S) (((ULONG)(S) << 1) | 0x1)
|
#define MAKE_SWAP_SSE(S) (((ULONG_PTR)(S) << 1) | 0x1)
|
||||||
#define DIRTY_SSE(E) ((E) | 2)
|
#define DIRTY_SSE(E) ((E) | 2)
|
||||||
#define CLEAN_SSE(E) ((E) & ~2)
|
#define CLEAN_SSE(E) ((E) & ~2)
|
||||||
#define IS_DIRTY_SSE(E) ((E) & 2)
|
#define IS_DIRTY_SSE(E) ((E) & 2)
|
||||||
|
#define PAGE_FROM_SSE(E) ((E) & 0xFFFFF000)
|
||||||
|
#define SHARE_COUNT_FROM_SSE(E) (((E) & 0x00000FFC) >> 2)
|
||||||
|
#define MAX_SHARE_COUNT 0x3FF
|
||||||
|
#define MAKE_SSE(P, C) ((ULONG_PTR)((P) | ((C) << 2)))
|
||||||
|
|
||||||
#define MM_SEGMENT_FINALIZE (0x40000000)
|
#define MM_SEGMENT_FINALIZE (0x40000000)
|
||||||
|
|
||||||
|
@ -52,7 +56,7 @@ typedef struct _CACHE_SECTION_PAGE_TABLE
|
||||||
LARGE_INTEGER FileOffset;
|
LARGE_INTEGER FileOffset;
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
ULONG Refcount;
|
ULONG Refcount;
|
||||||
ULONG PageEntries[ENTRIES_PER_ELEMENT];
|
ULONG_PTR PageEntries[ENTRIES_PER_ELEMENT];
|
||||||
} CACHE_SECTION_PAGE_TABLE, *PCACHE_SECTION_PAGE_TABLE;
|
} CACHE_SECTION_PAGE_TABLE, *PCACHE_SECTION_PAGE_TABLE;
|
||||||
|
|
||||||
struct _MM_REQUIRED_RESOURCES;
|
struct _MM_REQUIRED_RESOURCES;
|
||||||
|
@ -124,11 +128,11 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
_MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
_MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
ULONG Entry,
|
ULONG_PTR Entry,
|
||||||
const char *file,
|
const char *file,
|
||||||
int line);
|
int line);
|
||||||
|
|
||||||
ULONG
|
ULONG_PTR
|
||||||
NTAPI
|
NTAPI
|
||||||
_MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
_MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
|
|
2
reactos/ntoskrnl/cache/section/reqtools.c
vendored
2
reactos/ntoskrnl/cache/section/reqtools.c
vendored
|
@ -61,7 +61,7 @@ MiGetOnePage(PMMSUPPORT AddressSpace,
|
||||||
PMEMORY_AREA MemoryArea,
|
PMEMORY_AREA MemoryArea,
|
||||||
PMM_REQUIRED_RESOURCES Required)
|
PMM_REQUIRED_RESOURCES Required)
|
||||||
{
|
{
|
||||||
int i;
|
ULONG i;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
for (i = 0; i < Required->Amount; i++)
|
for (i = 0; i < Required->Amount; i++)
|
||||||
|
|
12
reactos/ntoskrnl/cache/section/sptab.c
vendored
12
reactos/ntoskrnl/cache/section/sptab.c
vendored
|
@ -148,11 +148,11 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
_MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
_MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
ULONG Entry,
|
ULONG_PTR Entry,
|
||||||
const char *file,
|
const char *file,
|
||||||
int line)
|
int line)
|
||||||
{
|
{
|
||||||
ULONG PageIndex, OldEntry;
|
ULONG_PTR PageIndex, OldEntry;
|
||||||
PCACHE_SECTION_PAGE_TABLE PageTable;
|
PCACHE_SECTION_PAGE_TABLE PageTable;
|
||||||
|
|
||||||
ASSERT(Segment->Locked);
|
ASSERT(Segment->Locked);
|
||||||
|
@ -202,7 +202,7 @@ _MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG
|
ULONG_PTR
|
||||||
NTAPI
|
NTAPI
|
||||||
_MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
_MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
|
@ -210,7 +210,7 @@ _MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
int line)
|
int line)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER FileOffset;
|
LARGE_INTEGER FileOffset;
|
||||||
ULONG PageIndex, Result;
|
ULONG_PTR PageIndex, Result;
|
||||||
PCACHE_SECTION_PAGE_TABLE PageTable;
|
PCACHE_SECTION_PAGE_TABLE PageTable;
|
||||||
|
|
||||||
ASSERT(Segment->Locked);
|
ASSERT(Segment->Locked);
|
||||||
|
@ -247,10 +247,10 @@ MmFreePageTablesSectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
Element->FileOffset.u.LowPart);
|
Element->FileOffset.u.LowPart);
|
||||||
if (FreePage)
|
if (FreePage)
|
||||||
{
|
{
|
||||||
int i;
|
ULONG i;
|
||||||
for (i = 0; i < ENTRIES_PER_ELEMENT; i++)
|
for (i = 0; i < ENTRIES_PER_ELEMENT; i++)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
Offset.QuadPart = Element->FileOffset.QuadPart + i * PAGE_SIZE;
|
Offset.QuadPart = Element->FileOffset.QuadPart + i * PAGE_SIZE;
|
||||||
Entry = Element->PageEntries[i];
|
Entry = Element->PageEntries[i];
|
||||||
|
|
7
reactos/ntoskrnl/cache/section/swapout.c
vendored
7
reactos/ntoskrnl/cache/section/swapout.c
vendored
|
@ -64,7 +64,7 @@ MmWithdrawSectionPage(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER FileOffset,
|
PLARGE_INTEGER FileOffset,
|
||||||
BOOLEAN *Dirty)
|
BOOLEAN *Dirty)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
|
|
||||||
DPRINT("MmWithdrawSectionPage(%x,%08x%08x,%x)\n",
|
DPRINT("MmWithdrawSectionPage(%x,%08x%08x,%x)\n",
|
||||||
Segment,
|
Segment,
|
||||||
|
@ -228,7 +228,7 @@ MmPageOutCacheSection(PMMSUPPORT AddressSpace,
|
||||||
PBOOLEAN Dirty,
|
PBOOLEAN Dirty,
|
||||||
PMM_REQUIRED_RESOURCES Required)
|
PMM_REQUIRED_RESOURCES Required)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
PFN_NUMBER OurPage;
|
PFN_NUMBER OurPage;
|
||||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
LARGE_INTEGER TotalOffset;
|
LARGE_INTEGER TotalOffset;
|
||||||
|
@ -521,7 +521,8 @@ NTAPI
|
||||||
MiCacheEvictPages(PMM_SECTION_SEGMENT Segment,
|
MiCacheEvictPages(PMM_SECTION_SEGMENT Segment,
|
||||||
ULONG Target)
|
ULONG Target)
|
||||||
{
|
{
|
||||||
ULONG Entry, Result = 0, i, j;
|
ULONG_PTR Entry;
|
||||||
|
ULONG Result = 0, i, j;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
|
|
|
@ -983,12 +983,14 @@ KiServiceExit2(
|
||||||
IN PKTRAP_FRAME TrapFrame
|
IN PKTRAP_FRAME TrapFrame
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifndef _M_AMD64
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
KiInterruptDispatch(
|
KiInterruptDispatch(
|
||||||
IN PKTRAP_FRAME TrapFrame,
|
IN PKTRAP_FRAME TrapFrame,
|
||||||
IN PKINTERRUPT Interrupt
|
IN PKINTERRUPT Interrupt
|
||||||
);
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
|
|
|
@ -208,8 +208,8 @@ typedef struct _MM_SECTION_SEGMENT
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
LONG FileOffset; /* start offset into the file for image sections */
|
ULONGLONG FileOffset; /* start offset into the file for image sections */
|
||||||
ULONG_PTR VirtualAddress; /* dtart offset into the address range for image sections */
|
ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
|
||||||
ULONG Characteristics;
|
ULONG Characteristics;
|
||||||
} Image;
|
} Image;
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ typedef struct _MM_PAGEOP
|
||||||
* section mapping.
|
* section mapping.
|
||||||
*/
|
*/
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
ULONG Offset;
|
ULONGLONG Offset;
|
||||||
} MM_PAGEOP, *PMM_PAGEOP;
|
} MM_PAGEOP, *PMM_PAGEOP;
|
||||||
|
|
||||||
typedef struct _MM_MEMORY_CONSUMER
|
typedef struct _MM_MEMORY_CONSUMER
|
||||||
|
@ -1020,7 +1020,7 @@ MmGetPageOp(
|
||||||
HANDLE Pid,
|
HANDLE Pid,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
PMM_SECTION_SEGMENT Segment,
|
PMM_SECTION_SEGMENT Segment,
|
||||||
ULONG Offset,
|
ULONGLONG Offset,
|
||||||
ULONG OpType,
|
ULONG OpType,
|
||||||
BOOLEAN First
|
BOOLEAN First
|
||||||
);
|
);
|
||||||
|
@ -1032,7 +1032,7 @@ MmCheckForPageOp(
|
||||||
HANDLE Pid,
|
HANDLE Pid,
|
||||||
PVOID Address,
|
PVOID Address,
|
||||||
PMM_SECTION_SEGMENT Segment,
|
PMM_SECTION_SEGMENT Segment,
|
||||||
ULONG Offset
|
ULONGLONG Offset
|
||||||
);
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -63,7 +63,7 @@ IopGetDeviceNode(PDEVICE_OBJECT DeviceObject)
|
||||||
VOID
|
VOID
|
||||||
IopFixupDeviceId(PWCHAR String)
|
IopFixupDeviceId(PWCHAR String)
|
||||||
{
|
{
|
||||||
ULONG Length = wcslen(String), i;
|
SIZE_T Length = wcslen(String), i;
|
||||||
|
|
||||||
for (i = 0; i < Length; i++)
|
for (i = 0; i < Length; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,7 +306,7 @@ ExpCheckPoolBlocks(IN PVOID Block)
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
VOID
|
VOID
|
||||||
ExpCheckPoolIrqlLevel(IN POOL_TYPE PoolType,
|
ExpCheckPoolIrqlLevel(IN POOL_TYPE PoolType,
|
||||||
IN ULONG NumberOfBytes,
|
IN SIZE_T NumberOfBytes,
|
||||||
IN PVOID Entry)
|
IN PVOID Entry)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -341,7 +341,7 @@ ExpComputeHashForTag(IN ULONG Tag,
|
||||||
// the table
|
// the table
|
||||||
//
|
//
|
||||||
ULONGLONG Result = 40543 * Tag;
|
ULONGLONG Result = 40543 * Tag;
|
||||||
return BucketMask & (Result ^ (Result >> 32));
|
return (ULONG)BucketMask & ((ULONG)Result ^ (Result >> 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
|
@ -358,7 +358,7 @@ ExpComputePartialHashForAddress(IN PVOID BaseAddress)
|
||||||
// while holding the expansion pushlock, and this is why we call this a
|
// while holding the expansion pushlock, and this is why we call this a
|
||||||
// "partial" hash only.
|
// "partial" hash only.
|
||||||
//
|
//
|
||||||
Result = (ULONG_PTR)BaseAddress >> PAGE_SHIFT;
|
Result = (ULONG)((ULONG_PTR)BaseAddress >> PAGE_SHIFT);
|
||||||
return (Result >> 24) ^ (Result >> 16) ^ (Result >> 8) ^ Result;
|
return (Result >> 24) ^ (Result >> 16) ^ (Result >> 8) ^ Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,11 +538,13 @@ ExpRemovePoolTracker(IN ULONG Key,
|
||||||
if ((PoolType & BASE_POOL_TYPE_MASK) == NonPagedPool)
|
if ((PoolType & BASE_POOL_TYPE_MASK) == NonPagedPool)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&TableEntry->NonPagedFrees);
|
InterlockedIncrement(&TableEntry->NonPagedFrees);
|
||||||
InterlockedExchangeAddSizeT(&TableEntry->NonPagedBytes, -NumberOfBytes);
|
InterlockedExchangeAddSizeT(&TableEntry->NonPagedBytes,
|
||||||
|
-(SSIZE_T)NumberOfBytes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
InterlockedIncrement(&TableEntry->PagedFrees);
|
InterlockedIncrement(&TableEntry->PagedFrees);
|
||||||
InterlockedExchangeAddSizeT(&TableEntry->PagedBytes, -NumberOfBytes);
|
InterlockedExchangeAddSizeT(&TableEntry->PagedBytes,
|
||||||
|
-(SSIZE_T)NumberOfBytes);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,7 +1073,7 @@ ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation,
|
||||||
IN ULONG SystemInformationLength,
|
IN ULONG SystemInformationLength,
|
||||||
IN OUT PULONG ReturnLength OPTIONAL)
|
IN OUT PULONG ReturnLength OPTIONAL)
|
||||||
{
|
{
|
||||||
SIZE_T TableSize, CurrentLength;
|
ULONG TableSize, CurrentLength;
|
||||||
ULONG EntryCount;
|
ULONG EntryCount;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
PSYSTEM_POOLTAG TagEntry;
|
PSYSTEM_POOLTAG TagEntry;
|
||||||
|
@ -1094,7 +1096,7 @@ ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation,
|
||||||
// Capture the number of entries, and the total size needed to make a copy
|
// Capture the number of entries, and the total size needed to make a copy
|
||||||
// of the table
|
// of the table
|
||||||
//
|
//
|
||||||
EntryCount = PoolTrackTableSize;
|
EntryCount = (ULONG)PoolTrackTableSize;
|
||||||
TableSize = EntryCount * sizeof(POOL_TRACKER_TABLE);
|
TableSize = EntryCount * sizeof(POOL_TRACKER_TABLE);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1262,7 +1264,7 @@ ExpAddTagForBigPages(IN PVOID Va,
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
ExpFindAndRemoveTagBigPages(IN PVOID Va,
|
ExpFindAndRemoveTagBigPages(IN PVOID Va,
|
||||||
OUT PULONG BigPages,
|
OUT PULONG_PTR BigPages,
|
||||||
IN POOL_TYPE PoolType)
|
IN POOL_TYPE PoolType)
|
||||||
{
|
{
|
||||||
BOOLEAN FirstTry = TRUE;
|
BOOLEAN FirstTry = TRUE;
|
||||||
|
@ -1525,7 +1527,8 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
||||||
//
|
//
|
||||||
// Increment required counters
|
// Increment required counters
|
||||||
//
|
//
|
||||||
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages, BYTES_TO_PAGES(NumberOfBytes));
|
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages,
|
||||||
|
(LONG)BYTES_TO_PAGES(NumberOfBytes));
|
||||||
InterlockedExchangeAddSizeT(&PoolDesc->TotalBytes, NumberOfBytes);
|
InterlockedExchangeAddSizeT(&PoolDesc->TotalBytes, NumberOfBytes);
|
||||||
InterlockedIncrement((PLONG)&PoolDesc->RunningAllocs);
|
InterlockedIncrement((PLONG)&PoolDesc->RunningAllocs);
|
||||||
|
|
||||||
|
@ -1535,7 +1538,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
||||||
//
|
//
|
||||||
if (!ExpAddTagForBigPages(Entry,
|
if (!ExpAddTagForBigPages(Entry,
|
||||||
Tag,
|
Tag,
|
||||||
BYTES_TO_PAGES(NumberOfBytes),
|
(ULONG)BYTES_TO_PAGES(NumberOfBytes),
|
||||||
OriginalType))
|
OriginalType))
|
||||||
{
|
{
|
||||||
Tag = ' GIB';
|
Tag = ' GIB';
|
||||||
|
@ -2083,14 +2086,16 @@ ExFreePoolWithTag(IN PVOID P,
|
||||||
//
|
//
|
||||||
PoolDesc = PoolVector[PoolType];
|
PoolDesc = PoolVector[PoolType];
|
||||||
InterlockedIncrement((PLONG)&PoolDesc->RunningDeAllocs);
|
InterlockedIncrement((PLONG)&PoolDesc->RunningDeAllocs);
|
||||||
InterlockedExchangeAddSizeT(&PoolDesc->TotalBytes, -PageCount << PAGE_SHIFT);
|
InterlockedExchangeAddSizeT(&PoolDesc->TotalBytes,
|
||||||
|
-(LONG_PTR)(PageCount << PAGE_SHIFT));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do the real free now and update the last counter with the big page count
|
// Do the real free now and update the last counter with the big page count
|
||||||
//
|
//
|
||||||
RealPageCount = MiFreePoolPages(P);
|
RealPageCount = MiFreePoolPages(P);
|
||||||
ASSERT(RealPageCount == PageCount);
|
ASSERT(RealPageCount == PageCount);
|
||||||
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages, -RealPageCount);
|
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages,
|
||||||
|
-(LONG)RealPageCount);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ MmFreeLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY NextMd;
|
PLIST_ENTRY NextMd;
|
||||||
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
||||||
ULONG i;
|
ULONG_PTR i;
|
||||||
PFN_NUMBER BasePage, LoaderPages;
|
PFN_NUMBER BasePage, LoaderPages;
|
||||||
PMMPFN Pfn1;
|
PMMPFN Pfn1;
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
|
|
|
@ -244,7 +244,8 @@ MmDeleteKernelStack(IN PVOID StackBase,
|
||||||
if (ExQueryDepthSList(&MmDeadStackSListHead) < MmMaximumDeadKernelStacks)
|
if (ExQueryDepthSList(&MmDeadStackSListHead) < MmMaximumDeadKernelStacks)
|
||||||
{
|
{
|
||||||
Pfn1 = MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber);
|
Pfn1 = MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber);
|
||||||
InterlockedPushEntrySList(&MmDeadStackSListHead, &Pfn1->u1.NextStackPfn);
|
InterlockedPushEntrySList(&MmDeadStackSListHead,
|
||||||
|
(PSLIST_ENTRY)&Pfn1->u1.NextStackPfn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -848,7 +848,7 @@ MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea,
|
||||||
{
|
{
|
||||||
PointerPte = &Subsection->SubsectionBase[PteOffset];
|
PointerPte = &Subsection->SubsectionBase[PteOffset];
|
||||||
LastPte = PointerPte + BYTES_TO_PAGES(CommitSize);
|
LastPte = PointerPte + BYTES_TO_PAGES(CommitSize);
|
||||||
QuotaCharge = LastPte - PointerPte;
|
QuotaCharge = (ULONG)(LastPte - PointerPte);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ARM3 does not currently support large pages */
|
/* ARM3 does not currently support large pages */
|
||||||
|
@ -1467,7 +1467,8 @@ MmCreateArm3Section(OUT PVOID *SectionObject,
|
||||||
{
|
{
|
||||||
/* Convert the flag, and make sure the section isn't too big */
|
/* Convert the flag, and make sure the section isn't too big */
|
||||||
NewSection->u.Flags.Based = TRUE;
|
NewSection->u.Flags.Based = TRUE;
|
||||||
if (NewSection->SizeOfSection.QuadPart > (ULONG_PTR)MmHighSectionBase)
|
if ((ULONGLONG)NewSection->SizeOfSection.QuadPart >
|
||||||
|
(ULONG_PTR)MmHighSectionBase)
|
||||||
{
|
{
|
||||||
DPRINT1("BASED section is too large\n");
|
DPRINT1("BASED section is too large\n");
|
||||||
ObDereferenceObject(NewSection);
|
ObDereferenceObject(NewSection);
|
||||||
|
|
|
@ -3668,9 +3668,9 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
||||||
IN ULONG FreeType)
|
IN ULONG FreeType)
|
||||||
{
|
{
|
||||||
PMEMORY_AREA MemoryArea;
|
PMEMORY_AREA MemoryArea;
|
||||||
ULONG PRegionSize;
|
SIZE_T PRegionSize;
|
||||||
PVOID PBaseAddress;
|
PVOID PBaseAddress;
|
||||||
ULONG CommitReduction = 0;
|
ULONG_PTR CommitReduction = 0;
|
||||||
ULONG_PTR StartingAddress, EndingAddress;
|
ULONG_PTR StartingAddress, EndingAddress;
|
||||||
PMMVAD Vad;
|
PMMVAD Vad;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
|
@ -157,7 +157,7 @@ MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget)
|
||||||
if (MmAvailablePages < MiMinimumAvailablePages)
|
if (MmAvailablePages < MiMinimumAvailablePages)
|
||||||
{
|
{
|
||||||
/* Global page limit exceeded */
|
/* Global page limit exceeded */
|
||||||
Target = max(Target, MiMinimumAvailablePages - MmAvailablePages);
|
Target = (ULONG)max(Target, MiMinimumAvailablePages - MmAvailablePages);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Target)
|
if (Target)
|
||||||
|
|
|
@ -72,7 +72,7 @@ MmReleasePageOp(PMM_PAGEOP PageOp)
|
||||||
PMM_PAGEOP
|
PMM_PAGEOP
|
||||||
NTAPI
|
NTAPI
|
||||||
MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
||||||
PMM_SECTION_SEGMENT Segment, ULONG Offset)
|
PMM_SECTION_SEGMENT Segment, ULONGLONG Offset)
|
||||||
{
|
{
|
||||||
ULONG_PTR Hash;
|
ULONG_PTR Hash;
|
||||||
KIRQL oldIrql;
|
KIRQL oldIrql;
|
||||||
|
@ -135,7 +135,7 @@ MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
||||||
PMM_PAGEOP
|
PMM_PAGEOP
|
||||||
NTAPI
|
NTAPI
|
||||||
MmGetPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
MmGetPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
||||||
PMM_SECTION_SEGMENT Segment, ULONG Offset, ULONG OpType, BOOLEAN First)
|
PMM_SECTION_SEGMENT Segment, ULONGLONG Offset, ULONG OpType, BOOLEAN First)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Get a page operation descriptor corresponding to
|
* FUNCTION: Get a page operation descriptor corresponding to
|
||||||
* the memory area and either the segment, offset pair or the
|
* the memory area and either the segment, offset pair or the
|
||||||
|
|
|
@ -53,7 +53,7 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
PVOID Address;
|
PVOID Address;
|
||||||
PEPROCESS Process;
|
PEPROCESS Process;
|
||||||
PMM_PAGEOP PageOp;
|
PMM_PAGEOP PageOp;
|
||||||
ULONG Offset;
|
ULONGLONG Offset;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
ExAcquireFastMutex(&RmapListLock);
|
ExAcquireFastMutex(&RmapListLock);
|
||||||
|
@ -126,8 +126,8 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
||||||
Type = MemoryArea->Type;
|
Type = MemoryArea->Type;
|
||||||
if (Type == MEMORY_AREA_SECTION_VIEW)
|
if (Type == MEMORY_AREA_SECTION_VIEW)
|
||||||
{
|
{
|
||||||
Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
Offset = MemoryArea->Data.SectionData.ViewOffset.QuadPart +
|
||||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get or create a pageop
|
* Get or create a pageop
|
||||||
|
|
|
@ -167,15 +167,6 @@ static GENERIC_MAPPING MmpSectionMapping = {
|
||||||
STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
|
STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
|
||||||
SECTION_ALL_ACCESS};
|
SECTION_ALL_ACCESS};
|
||||||
|
|
||||||
#define PAGE_FROM_SSE(E) ((E) & 0xFFFFF000)
|
|
||||||
#define PFN_FROM_SSE(E) ((E) >> PAGE_SHIFT)
|
|
||||||
#define SHARE_COUNT_FROM_SSE(E) (((E) & 0x00000FFC) >> 2)
|
|
||||||
#define IS_SWAP_FROM_SSE(E) ((E) & 0x00000001)
|
|
||||||
#define MAX_SHARE_COUNT 0x3FF
|
|
||||||
#define MAKE_SSE(P, C) ((P) | ((C) << 2))
|
|
||||||
#define SWAPENTRY_FROM_SSE(E) ((E) >> 1)
|
|
||||||
#define MAKE_SWAP_SSE(S) (((ULONG)(S) << 1) | 0x1)
|
|
||||||
|
|
||||||
static const INFORMATION_CLASS_INFO ExSectionInfoClass[] =
|
static const INFORMATION_CLASS_INFO ExSectionInfoClass[] =
|
||||||
{
|
{
|
||||||
ICI_SQ_SAME( sizeof(SECTION_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), /* SectionBasicInformation */
|
ICI_SQ_SAME( sizeof(SECTION_BASIC_INFORMATION), sizeof(ULONG), ICIF_QUERY ), /* SectionBasicInformation */
|
||||||
|
@ -695,7 +686,7 @@ l_ReadHeaderFromFile:
|
||||||
pssSegments[i].Image.Characteristics = pishSectionHeaders[i].Characteristics;
|
pssSegments[i].Image.Characteristics = pishSectionHeaders[i].Characteristics;
|
||||||
|
|
||||||
/* ensure the memory image is no larger than 4GB */
|
/* ensure the memory image is no larger than 4GB */
|
||||||
nPrevVirtualEndOfSegment = pssSegments[i].Image.VirtualAddress + pssSegments[i].Length.QuadPart;
|
nPrevVirtualEndOfSegment = (ULONG_PTR)(pssSegments[i].Image.VirtualAddress + pssSegments[i].Length.QuadPart);
|
||||||
if (nPrevVirtualEndOfSegment < pssSegments[i].Image.VirtualAddress)
|
if (nPrevVirtualEndOfSegment < pssSegments[i].Image.VirtualAddress)
|
||||||
DIE(("The image is too large\n"));
|
DIE(("The image is too large\n"));
|
||||||
}
|
}
|
||||||
|
@ -813,7 +804,7 @@ NTAPI
|
||||||
MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
PLARGE_INTEGER Offset)
|
PLARGE_INTEGER Offset)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
|
|
||||||
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
|
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
|
||||||
if (Entry == 0)
|
if (Entry == 0)
|
||||||
|
@ -842,7 +833,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
|
||||||
BOOLEAN Dirty,
|
BOOLEAN Dirty,
|
||||||
BOOLEAN PageOut)
|
BOOLEAN PageOut)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
BOOLEAN IsDirectMapped = FALSE;
|
BOOLEAN IsDirectMapped = FALSE;
|
||||||
|
|
||||||
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
|
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
|
||||||
|
@ -982,7 +973,7 @@ BOOLEAN MiIsPageFromCache(PMEMORY_AREA MemoryArea,
|
||||||
PBCB Bcb;
|
PBCB Bcb;
|
||||||
PCACHE_SEGMENT CacheSeg;
|
PCACHE_SEGMENT CacheSeg;
|
||||||
Bcb = MemoryArea->Data.SectionData.Section->FileObject->SectionObjectPointer->SharedCacheMap;
|
Bcb = MemoryArea->Data.SectionData.Section->FileObject->SectionObjectPointer->SharedCacheMap;
|
||||||
CacheSeg = CcRosLookupCacheSegment(Bcb, SegOffset + MemoryArea->Data.SectionData.Segment->Image.FileOffset);
|
CacheSeg = CcRosLookupCacheSegment(Bcb, (ULONG)(SegOffset + MemoryArea->Data.SectionData.Segment->Image.FileOffset));
|
||||||
if (CacheSeg)
|
if (CacheSeg)
|
||||||
{
|
{
|
||||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, CacheSeg->Valid, FALSE, TRUE);
|
CcRosReleaseCacheSegment(Bcb, CacheSeg, CacheSeg->Valid, FALSE, TRUE);
|
||||||
|
@ -1029,7 +1020,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
ULONG BaseOffset;
|
ULONG BaseOffset;
|
||||||
ULONG_PTR FileOffset;
|
ULONGLONG FileOffset;
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
BOOLEAN UptoDate;
|
BOOLEAN UptoDate;
|
||||||
PCACHE_SEGMENT CacheSeg;
|
PCACHE_SEGMENT CacheSeg;
|
||||||
|
@ -1042,7 +1033,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
|
|
||||||
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
||||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||||
RawLength = MemoryArea->Data.SectionData.Segment->RawLength.QuadPart;
|
RawLength = (ULONG_PTR)(MemoryArea->Data.SectionData.Segment->RawLength.QuadPart);
|
||||||
FileOffset = SegOffset + MemoryArea->Data.SectionData.Segment->Image.FileOffset;
|
FileOffset = SegOffset + MemoryArea->Data.SectionData.Segment->Image.FileOffset;
|
||||||
IsImageSection = MemoryArea->Data.SectionData.Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE;
|
IsImageSection = MemoryArea->Data.SectionData.Section->AllocationAttributes & SEC_IMAGE ? TRUE : FALSE;
|
||||||
|
|
||||||
|
@ -1055,8 +1046,8 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
* 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 get the related cache segment.
|
* then get the related cache segment.
|
||||||
*/
|
*/
|
||||||
if ((FileOffset % PAGE_SIZE) == 0 &&
|
if (((FileOffset % PAGE_SIZE) == 0) &&
|
||||||
(SegOffset + PAGE_SIZE <= RawLength || !IsImageSection) &&
|
((SegOffset + PAGE_SIZE <= RawLength) || !IsImageSection) &&
|
||||||
!(MemoryArea->Data.SectionData.Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED))
|
!(MemoryArea->Data.SectionData.Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1140,7 +1131,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
||||||
|
|
||||||
Process = PsGetCurrentProcess();
|
Process = PsGetCurrentProcess();
|
||||||
PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
|
PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
|
||||||
CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset;
|
CacheSegOffset = (ULONG_PTR)(BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset);
|
||||||
Length = RawLength - SegOffset;
|
Length = RawLength - SegOffset;
|
||||||
if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
|
if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
|
||||||
{
|
{
|
||||||
|
@ -1469,7 +1460,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
||||||
/*
|
/*
|
||||||
* Just map the desired physical page
|
* Just map the desired physical page
|
||||||
*/
|
*/
|
||||||
Page = Offset.QuadPart >> PAGE_SHIFT;
|
Page = (PFN_NUMBER)(Offset.QuadPart >> PAGE_SHIFT);
|
||||||
Status = MmCreateVirtualMappingUnsafe(Process,
|
Status = MmCreateVirtualMappingUnsafe(Process,
|
||||||
PAddress,
|
PAddress,
|
||||||
Region->Protect,
|
Region->Protect,
|
||||||
|
@ -1552,7 +1543,8 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
|
|
||||||
if ((Segment->Flags & MM_PAGEFILE_SEGMENT) ||
|
if ((Segment->Flags & MM_PAGEFILE_SEGMENT) ||
|
||||||
(Offset.QuadPart >= PAGE_ROUND_UP(Segment->RawLength.QuadPart) && Section->AllocationAttributes & SEC_IMAGE))
|
((Offset.QuadPart >= (LONGLONG)PAGE_ROUND_UP(Segment->RawLength.QuadPart) &&
|
||||||
|
(Section->AllocationAttributes & SEC_IMAGE))))
|
||||||
{
|
{
|
||||||
MI_SET_USAGE(MI_USAGE_SECTION);
|
MI_SET_USAGE(MI_USAGE_SECTION);
|
||||||
if (Process) MI_SET_PROCESS2(Process->ImageFileName);
|
if (Process) MI_SET_PROCESS2(Process->ImageFileName);
|
||||||
|
@ -1566,7 +1558,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = MiReadPage(MemoryArea, Offset.QuadPart, &Page);
|
Status = MiReadPage(MemoryArea, (ULONG_PTR)Offset.QuadPart, &Page);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("MiReadPage failed (Status %x)\n", Status);
|
DPRINT1("MiReadPage failed (Status %x)\n", Status);
|
||||||
|
@ -1745,7 +1737,7 @@ MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
PMM_PAGEOP PageOp;
|
PMM_PAGEOP PageOp;
|
||||||
PMM_REGION Region;
|
PMM_REGION Region;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||||
|
|
||||||
DPRINT("MmAccessFaultSectionView(%x, %x, %x, %x)\n", AddressSpace, MemoryArea, Address);
|
DPRINT("MmAccessFaultSectionView(%x, %x, %x, %x)\n", AddressSpace, MemoryArea, Address);
|
||||||
|
@ -1962,8 +1954,8 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
MM_SECTION_PAGEOUT_CONTEXT Context;
|
MM_SECTION_PAGEOUT_CONTEXT Context;
|
||||||
SWAPENTRY SwapEntry;
|
SWAPENTRY SwapEntry;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
ULONG FileOffset;
|
ULONGLONG FileOffset;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
#ifndef NEWCC
|
#ifndef NEWCC
|
||||||
|
@ -2162,7 +2154,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
KeBugCheckEx(MEMORY_MANAGEMENT, STATUS_UNSUCCESSFUL, SwapEntry, (ULONG_PTR)Process, (ULONG_PTR)Address);
|
KeBugCheckEx(MEMORY_MANAGEMENT, STATUS_UNSUCCESSFUL, SwapEntry, (ULONG_PTR)Process, (ULONG_PTR)Address);
|
||||||
}
|
}
|
||||||
#ifndef NEWCC
|
#ifndef NEWCC
|
||||||
Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE);
|
Status = CcRosUnmapCacheSegment(Bcb, (ULONG)FileOffset, FALSE);
|
||||||
#else
|
#else
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2170,7 +2162,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
|
DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
|
||||||
KeBugCheckEx(MEMORY_MANAGEMENT, Status, (ULONG_PTR)Bcb, FileOffset, (ULONG_PTR)Address);
|
KeBugCheckEx(MEMORY_MANAGEMENT, Status, (ULONG_PTR)Bcb, (ULONG_PTR)FileOffset, (ULONG_PTR)Address);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
|
@ -2237,7 +2229,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LONG OldEntry;
|
ULONG_PTR OldEntry;
|
||||||
/*
|
/*
|
||||||
* For non-private pages if the page wasn't direct mapped then
|
* For non-private pages if the page wasn't direct mapped then
|
||||||
* set it back into the section segment entry so we don't loose
|
* set it back into the section segment entry so we don't loose
|
||||||
|
@ -2365,7 +2357,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
|
||||||
PMM_SECTION_SEGMENT Segment;
|
PMM_SECTION_SEGMENT Segment;
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
SWAPENTRY SwapEntry;
|
SWAPENTRY SwapEntry;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
BOOLEAN Private;
|
BOOLEAN Private;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
|
@ -2457,7 +2449,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
|
||||||
{
|
{
|
||||||
ASSERT(SwapEntry == 0);
|
ASSERT(SwapEntry == 0);
|
||||||
#ifndef NEWCC
|
#ifndef NEWCC
|
||||||
CcRosMarkDirtyCacheSegment(Bcb, Offset.LowPart + Segment->Image.FileOffset);
|
CcRosMarkDirtyCacheSegment(Bcb, (ULONG)(Offset.QuadPart + Segment->Image.FileOffset));
|
||||||
#endif
|
#endif
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
MmspCompleteAndReleasePageOp(PageOp);
|
MmspCompleteAndReleasePageOp(PageOp);
|
||||||
|
@ -2543,7 +2535,7 @@ MmAlterViewAttributes(PMMSUPPORT AddressSpace,
|
||||||
if (DoCOW && MmIsPagePresent(Process, Address))
|
if (DoCOW && MmIsPagePresent(Process, Address))
|
||||||
{
|
{
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
|
|
||||||
Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||||
|
@ -2655,7 +2647,7 @@ MmpFreePageFileSegment(PMM_SECTION_SEGMENT Segment)
|
||||||
{
|
{
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
SWAPENTRY SavedSwapEntry;
|
SWAPENTRY SavedSwapEntry;
|
||||||
PFN_NUMBER Page;
|
PFN_NUMBER Page;
|
||||||
|
|
||||||
|
@ -3307,7 +3299,7 @@ ExeFmtpReadFile(IN PVOID File,
|
||||||
|
|
||||||
Status = MiSimpleRead(FileObject, &FileOffset, Buffer, BufferSize, TRUE, &Iosb);
|
Status = MiSimpleRead(FileObject, &FileOffset, Buffer, BufferSize, TRUE, &Iosb);
|
||||||
|
|
||||||
UsedSize = Iosb.Information;
|
UsedSize = (ULONG)Iosb.Information;
|
||||||
|
|
||||||
if(NT_SUCCESS(Status) && UsedSize < OffsetAdjustment)
|
if(NT_SUCCESS(Status) && UsedSize < OffsetAdjustment)
|
||||||
{
|
{
|
||||||
|
@ -3540,7 +3532,7 @@ MmspPageAlignSegments
|
||||||
PMM_SECTION_SEGMENT Segment = &ImageSectionObject->Segments[i];
|
PMM_SECTION_SEGMENT Segment = &ImageSectionObject->Segments[i];
|
||||||
ULONG_PTR EndOfEffectiveSegment;
|
ULONG_PTR EndOfEffectiveSegment;
|
||||||
|
|
||||||
EndOfEffectiveSegment = EffectiveSegment->Image.VirtualAddress + EffectiveSegment->Length.QuadPart;
|
EndOfEffectiveSegment = (ULONG_PTR)(EffectiveSegment->Image.VirtualAddress + EffectiveSegment->Length.QuadPart);
|
||||||
ASSERT((EndOfEffectiveSegment % PAGE_SIZE) == 0);
|
ASSERT((EndOfEffectiveSegment % PAGE_SIZE) == 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -4042,7 +4034,7 @@ static VOID
|
||||||
MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||||
{
|
{
|
||||||
ULONG Entry;
|
ULONG_PTR Entry;
|
||||||
PFILE_OBJECT FileObject;
|
PFILE_OBJECT FileObject;
|
||||||
PBCB Bcb;
|
PBCB Bcb;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
|
@ -4098,7 +4090,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
||||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||||
#ifndef NEWCC
|
#ifndef NEWCC
|
||||||
CcRosMarkDirtyCacheSegment(Bcb, Offset.QuadPart + Segment->Image.FileOffset);
|
CcRosMarkDirtyCacheSegment(Bcb, (ULONG)(Offset.QuadPart + Segment->Image.FileOffset));
|
||||||
#endif
|
#endif
|
||||||
ASSERT(SwapEntry == 0);
|
ASSERT(SwapEntry == 0);
|
||||||
}
|
}
|
||||||
|
@ -4597,8 +4589,8 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
||||||
if (!(SectionSegments[i].Image.Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
if (!(SectionSegments[i].Image.Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
||||||
{
|
{
|
||||||
ULONG_PTR MaxExtent;
|
ULONG_PTR MaxExtent;
|
||||||
MaxExtent = (ULONG_PTR)SectionSegments[i].Image.VirtualAddress +
|
MaxExtent = (ULONG_PTR)(SectionSegments[i].Image.VirtualAddress +
|
||||||
SectionSegments[i].Length.QuadPart;
|
SectionSegments[i].Length.QuadPart);
|
||||||
ImageSize = max(ImageSize, MaxExtent);
|
ImageSize = max(ImageSize, MaxExtent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue