mirror of
https://github.com/reactos/reactos.git
synced 2025-05-30 06:28:34 +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)
|
||||
{
|
||||
PVOID Address;
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
|
||||
if (!NT_SUCCESS(MmRequestPageMemoryConsumer(MC_CACHE, TRUE, &Page)))
|
||||
break;
|
||||
|
@ -223,7 +223,7 @@ _MiFlushMappedSection(PVOID BaseAddress,
|
|||
PageAddress < EndingAddress;
|
||||
PageAddress += PAGE_SIZE)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
FileOffset.QuadPart = ViewOffset.QuadPart + PageAddress - BeginningAddress;
|
||||
Entry = MmGetPageEntrySectionSegment(MemoryArea->Data.SectionData.Segment,
|
||||
&FileOffset);
|
||||
|
@ -250,7 +250,7 @@ _MiFlushMappedSection(PVOID BaseAddress,
|
|||
PageAddress < EndingAddress;
|
||||
PageAddress += PAGE_SIZE)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
FileOffset.QuadPart = ViewOffset.QuadPart + PageAddress - BeginningAddress;
|
||||
Entry = Pages[(PageAddress - BeginningAddress) >> PAGE_SHIFT];
|
||||
Page = PFN_FROM_SSE(Entry);
|
||||
|
@ -351,7 +351,7 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
|||
{
|
||||
PROS_SECTION_OBJECT Section;
|
||||
NTSTATUS Status;
|
||||
ULARGE_INTEGER MaximumSize;
|
||||
LARGE_INTEGER MaximumSize;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
CC_FILE_SIZES FileSizes;
|
||||
|
@ -394,6 +394,7 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
|||
*/
|
||||
if (!CcGetFileSizes(FileObject, &FileSizes))
|
||||
{
|
||||
ULONG Information;
|
||||
/*
|
||||
* FIXME: This is propably not entirely correct. We can't look into
|
||||
* the standard FCB header because it might not be initialized yet
|
||||
|
@ -405,7 +406,8 @@ MmCreateCacheSection(PROS_SECTION_OBJECT *SectionObject,
|
|||
FileStandardInformation,
|
||||
sizeof(FILE_STANDARD_INFORMATION),
|
||||
&FileInfo,
|
||||
&Iosb.Information);
|
||||
&Information);
|
||||
Iosb.Information = Information;
|
||||
DPRINT("Query => %x\n", Status);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -644,7 +646,7 @@ NTAPI
|
|||
MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment,
|
||||
PLARGE_INTEGER FileOffset)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
PFILE_OBJECT FileObject = Segment->FileObject;
|
||||
|
||||
Entry = MmGetPageEntrySectionSegment(Segment, FileOffset);
|
||||
|
@ -696,7 +698,7 @@ MmFreeCacheSectionPage(PVOID Context,
|
|||
SWAPENTRY SwapEntry,
|
||||
BOOLEAN Dirty)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
PVOID *ContextData = Context;
|
||||
PMMSUPPORT AddressSpace;
|
||||
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;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
LARGE_INTEGER FileOffset, TotalOffset;
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
ULONG Attributes;
|
||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||
KIRQL OldIrql;
|
||||
|
@ -295,7 +295,7 @@ MiCowCacheSectionPage(PMMSUPPORT AddressSpace,
|
|||
Region->Protect == PAGE_EXECUTE_READWRITE)
|
||||
#endif
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
DPRINTC("setting non-cow page %x %x:%x offset %x (%x) to writable\n",
|
||||
Segment,
|
||||
Process,
|
||||
|
|
16
reactos/ntoskrnl/cache/section/newmm.h
vendored
16
reactos/ntoskrnl/cache/section/newmm.h
vendored
|
@ -5,16 +5,20 @@
|
|||
/* TYPES *********************************************************************/
|
||||
|
||||
#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 MM_IS_WAIT_PTE(E) \
|
||||
(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 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 CLEAN_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)
|
||||
|
||||
|
@ -52,7 +56,7 @@ typedef struct _CACHE_SECTION_PAGE_TABLE
|
|||
LARGE_INTEGER FileOffset;
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
ULONG Refcount;
|
||||
ULONG PageEntries[ENTRIES_PER_ELEMENT];
|
||||
ULONG_PTR PageEntries[ENTRIES_PER_ELEMENT];
|
||||
} CACHE_SECTION_PAGE_TABLE, *PCACHE_SECTION_PAGE_TABLE;
|
||||
|
||||
struct _MM_REQUIRED_RESOURCES;
|
||||
|
@ -124,11 +128,11 @@ NTSTATUS
|
|||
NTAPI
|
||||
_MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||
PLARGE_INTEGER Offset,
|
||||
ULONG Entry,
|
||||
ULONG_PTR Entry,
|
||||
const char *file,
|
||||
int line);
|
||||
|
||||
ULONG
|
||||
ULONG_PTR
|
||||
NTAPI
|
||||
_MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||
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,
|
||||
PMM_REQUIRED_RESOURCES Required)
|
||||
{
|
||||
int i;
|
||||
ULONG i;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
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
|
||||
_MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||
PLARGE_INTEGER Offset,
|
||||
ULONG Entry,
|
||||
ULONG_PTR Entry,
|
||||
const char *file,
|
||||
int line)
|
||||
{
|
||||
ULONG PageIndex, OldEntry;
|
||||
ULONG_PTR PageIndex, OldEntry;
|
||||
PCACHE_SECTION_PAGE_TABLE PageTable;
|
||||
|
||||
ASSERT(Segment->Locked);
|
||||
|
@ -202,7 +202,7 @@ _MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ULONG
|
||||
ULONG_PTR
|
||||
NTAPI
|
||||
_MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||
PLARGE_INTEGER Offset,
|
||||
|
@ -210,7 +210,7 @@ _MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
|||
int line)
|
||||
{
|
||||
LARGE_INTEGER FileOffset;
|
||||
ULONG PageIndex, Result;
|
||||
ULONG_PTR PageIndex, Result;
|
||||
PCACHE_SECTION_PAGE_TABLE PageTable;
|
||||
|
||||
ASSERT(Segment->Locked);
|
||||
|
@ -247,10 +247,10 @@ MmFreePageTablesSectionSegment(PMM_SECTION_SEGMENT Segment,
|
|||
Element->FileOffset.u.LowPart);
|
||||
if (FreePage)
|
||||
{
|
||||
int i;
|
||||
ULONG i;
|
||||
for (i = 0; i < ENTRIES_PER_ELEMENT; i++)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
LARGE_INTEGER Offset;
|
||||
Offset.QuadPart = Element->FileOffset.QuadPart + i * PAGE_SIZE;
|
||||
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,
|
||||
BOOLEAN *Dirty)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
|
||||
DPRINT("MmWithdrawSectionPage(%x,%08x%08x,%x)\n",
|
||||
Segment,
|
||||
|
@ -228,7 +228,7 @@ MmPageOutCacheSection(PMMSUPPORT AddressSpace,
|
|||
PBOOLEAN Dirty,
|
||||
PMM_REQUIRED_RESOURCES Required)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
PFN_NUMBER OurPage;
|
||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||
LARGE_INTEGER TotalOffset;
|
||||
|
@ -521,7 +521,8 @@ NTAPI
|
|||
MiCacheEvictPages(PMM_SECTION_SEGMENT Segment,
|
||||
ULONG Target)
|
||||
{
|
||||
ULONG Entry, Result = 0, i, j;
|
||||
ULONG_PTR Entry;
|
||||
ULONG Result = 0, i, j;
|
||||
NTSTATUS Status;
|
||||
PFN_NUMBER Page;
|
||||
LARGE_INTEGER Offset;
|
||||
|
|
|
@ -983,12 +983,14 @@ KiServiceExit2(
|
|||
IN PKTRAP_FRAME TrapFrame
|
||||
);
|
||||
|
||||
#ifndef _M_AMD64
|
||||
VOID
|
||||
FASTCALL
|
||||
KiInterruptDispatch(
|
||||
IN PKTRAP_FRAME TrapFrame,
|
||||
IN PKINTERRUPT Interrupt
|
||||
);
|
||||
#endif
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
|
|
|
@ -206,10 +206,10 @@ typedef struct _MM_SECTION_SEGMENT
|
|||
BOOLEAN WriteCopy;
|
||||
BOOLEAN Locked;
|
||||
|
||||
struct
|
||||
struct
|
||||
{
|
||||
LONG FileOffset; /* start offset into the file for image sections */
|
||||
ULONG_PTR VirtualAddress; /* dtart offset into the address range for image sections */
|
||||
ULONGLONG FileOffset; /* start offset into the file for image sections */
|
||||
ULONG_PTR VirtualAddress; /* start offset into the address range for image sections */
|
||||
ULONG Characteristics;
|
||||
} Image;
|
||||
|
||||
|
@ -443,7 +443,7 @@ typedef struct _MM_PAGEOP
|
|||
* section mapping.
|
||||
*/
|
||||
PMM_SECTION_SEGMENT Segment;
|
||||
ULONG Offset;
|
||||
ULONGLONG Offset;
|
||||
} MM_PAGEOP, *PMM_PAGEOP;
|
||||
|
||||
typedef struct _MM_MEMORY_CONSUMER
|
||||
|
@ -1020,7 +1020,7 @@ MmGetPageOp(
|
|||
HANDLE Pid,
|
||||
PVOID Address,
|
||||
PMM_SECTION_SEGMENT Segment,
|
||||
ULONG Offset,
|
||||
ULONGLONG Offset,
|
||||
ULONG OpType,
|
||||
BOOLEAN First
|
||||
);
|
||||
|
@ -1032,7 +1032,7 @@ MmCheckForPageOp(
|
|||
HANDLE Pid,
|
||||
PVOID Address,
|
||||
PMM_SECTION_SEGMENT Segment,
|
||||
ULONG Offset
|
||||
ULONGLONG Offset
|
||||
);
|
||||
|
||||
VOID
|
||||
|
|
|
@ -63,7 +63,7 @@ IopGetDeviceNode(PDEVICE_OBJECT DeviceObject)
|
|||
VOID
|
||||
IopFixupDeviceId(PWCHAR String)
|
||||
{
|
||||
ULONG Length = wcslen(String), i;
|
||||
SIZE_T Length = wcslen(String), i;
|
||||
|
||||
for (i = 0; i < Length; i++)
|
||||
{
|
||||
|
|
|
@ -306,7 +306,7 @@ ExpCheckPoolBlocks(IN PVOID Block)
|
|||
FORCEINLINE
|
||||
VOID
|
||||
ExpCheckPoolIrqlLevel(IN POOL_TYPE PoolType,
|
||||
IN ULONG NumberOfBytes,
|
||||
IN SIZE_T NumberOfBytes,
|
||||
IN PVOID Entry)
|
||||
{
|
||||
//
|
||||
|
@ -341,7 +341,7 @@ ExpComputeHashForTag(IN ULONG Tag,
|
|||
// the table
|
||||
//
|
||||
ULONGLONG Result = 40543 * Tag;
|
||||
return BucketMask & (Result ^ (Result >> 32));
|
||||
return (ULONG)BucketMask & ((ULONG)Result ^ (Result >> 32));
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
|
@ -358,7 +358,7 @@ ExpComputePartialHashForAddress(IN PVOID BaseAddress)
|
|||
// while holding the expansion pushlock, and this is why we call this a
|
||||
// "partial" hash only.
|
||||
//
|
||||
Result = (ULONG_PTR)BaseAddress >> PAGE_SHIFT;
|
||||
Result = (ULONG)((ULONG_PTR)BaseAddress >> PAGE_SHIFT);
|
||||
return (Result >> 24) ^ (Result >> 16) ^ (Result >> 8) ^ Result;
|
||||
}
|
||||
|
||||
|
@ -538,11 +538,13 @@ ExpRemovePoolTracker(IN ULONG Key,
|
|||
if ((PoolType & BASE_POOL_TYPE_MASK) == NonPagedPool)
|
||||
{
|
||||
InterlockedIncrement(&TableEntry->NonPagedFrees);
|
||||
InterlockedExchangeAddSizeT(&TableEntry->NonPagedBytes, -NumberOfBytes);
|
||||
InterlockedExchangeAddSizeT(&TableEntry->NonPagedBytes,
|
||||
-(SSIZE_T)NumberOfBytes);
|
||||
return;
|
||||
}
|
||||
InterlockedIncrement(&TableEntry->PagedFrees);
|
||||
InterlockedExchangeAddSizeT(&TableEntry->PagedBytes, -NumberOfBytes);
|
||||
InterlockedExchangeAddSizeT(&TableEntry->PagedBytes,
|
||||
-(SSIZE_T)NumberOfBytes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1071,7 +1073,7 @@ ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation,
|
|||
IN ULONG SystemInformationLength,
|
||||
IN OUT PULONG ReturnLength OPTIONAL)
|
||||
{
|
||||
SIZE_T TableSize, CurrentLength;
|
||||
ULONG TableSize, CurrentLength;
|
||||
ULONG EntryCount;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
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
|
||||
// of the table
|
||||
//
|
||||
EntryCount = PoolTrackTableSize;
|
||||
EntryCount = (ULONG)PoolTrackTableSize;
|
||||
TableSize = EntryCount * sizeof(POOL_TRACKER_TABLE);
|
||||
|
||||
//
|
||||
|
@ -1262,7 +1264,7 @@ ExpAddTagForBigPages(IN PVOID Va,
|
|||
ULONG
|
||||
NTAPI
|
||||
ExpFindAndRemoveTagBigPages(IN PVOID Va,
|
||||
OUT PULONG BigPages,
|
||||
OUT PULONG_PTR BigPages,
|
||||
IN POOL_TYPE PoolType)
|
||||
{
|
||||
BOOLEAN FirstTry = TRUE;
|
||||
|
@ -1525,7 +1527,8 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
|||
//
|
||||
// Increment required counters
|
||||
//
|
||||
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages, BYTES_TO_PAGES(NumberOfBytes));
|
||||
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages,
|
||||
(LONG)BYTES_TO_PAGES(NumberOfBytes));
|
||||
InterlockedExchangeAddSizeT(&PoolDesc->TotalBytes, NumberOfBytes);
|
||||
InterlockedIncrement((PLONG)&PoolDesc->RunningAllocs);
|
||||
|
||||
|
@ -1535,7 +1538,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
|||
//
|
||||
if (!ExpAddTagForBigPages(Entry,
|
||||
Tag,
|
||||
BYTES_TO_PAGES(NumberOfBytes),
|
||||
(ULONG)BYTES_TO_PAGES(NumberOfBytes),
|
||||
OriginalType))
|
||||
{
|
||||
Tag = ' GIB';
|
||||
|
@ -2083,14 +2086,16 @@ ExFreePoolWithTag(IN PVOID P,
|
|||
//
|
||||
PoolDesc = PoolVector[PoolType];
|
||||
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
|
||||
//
|
||||
RealPageCount = MiFreePoolPages(P);
|
||||
ASSERT(RealPageCount == PageCount);
|
||||
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages, -RealPageCount);
|
||||
InterlockedExchangeAdd((PLONG)&PoolDesc->TotalBigPages,
|
||||
-(LONG)RealPageCount);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1071,7 +1071,7 @@ MmFreeLoaderBlock(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
|||
{
|
||||
PLIST_ENTRY NextMd;
|
||||
PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
|
||||
ULONG i;
|
||||
ULONG_PTR i;
|
||||
PFN_NUMBER BasePage, LoaderPages;
|
||||
PMMPFN Pfn1;
|
||||
KIRQL OldIrql;
|
||||
|
|
|
@ -244,7 +244,8 @@ MmDeleteKernelStack(IN PVOID StackBase,
|
|||
if (ExQueryDepthSList(&MmDeadStackSListHead) < MmMaximumDeadKernelStacks)
|
||||
{
|
||||
Pfn1 = MiGetPfnEntry(PointerPte->u.Hard.PageFrameNumber);
|
||||
InterlockedPushEntrySList(&MmDeadStackSListHead, &Pfn1->u1.NextStackPfn);
|
||||
InterlockedPushEntrySList(&MmDeadStackSListHead,
|
||||
(PSLIST_ENTRY)&Pfn1->u1.NextStackPfn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1138,7 +1139,7 @@ MmInitializeHandBuiltProcess(IN PEPROCESS Process,
|
|||
|
||||
/* Use idle process Working set */
|
||||
Process->Vm.VmWorkingSetList = PsGetCurrentProcess()->Vm.VmWorkingSetList;
|
||||
|
||||
|
||||
/* Done */
|
||||
Process->HasAddressSpace = TRUE;//??
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -848,7 +848,7 @@ MiMapViewOfDataSection(IN PCONTROL_AREA ControlArea,
|
|||
{
|
||||
PointerPte = &Subsection->SubsectionBase[PteOffset];
|
||||
LastPte = PointerPte + BYTES_TO_PAGES(CommitSize);
|
||||
QuotaCharge = LastPte - PointerPte;
|
||||
QuotaCharge = (ULONG)(LastPte - PointerPte);
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
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");
|
||||
ObDereferenceObject(NewSection);
|
||||
|
|
|
@ -3668,9 +3668,9 @@ NtFreeVirtualMemory(IN HANDLE ProcessHandle,
|
|||
IN ULONG FreeType)
|
||||
{
|
||||
PMEMORY_AREA MemoryArea;
|
||||
ULONG PRegionSize;
|
||||
SIZE_T PRegionSize;
|
||||
PVOID PBaseAddress;
|
||||
ULONG CommitReduction = 0;
|
||||
ULONG_PTR CommitReduction = 0;
|
||||
ULONG_PTR StartingAddress, EndingAddress;
|
||||
PMMVAD Vad;
|
||||
NTSTATUS Status;
|
||||
|
|
|
@ -157,7 +157,7 @@ MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget)
|
|||
if (MmAvailablePages < MiMinimumAvailablePages)
|
||||
{
|
||||
/* Global page limit exceeded */
|
||||
Target = max(Target, MiMinimumAvailablePages - MmAvailablePages);
|
||||
Target = (ULONG)max(Target, MiMinimumAvailablePages - MmAvailablePages);
|
||||
}
|
||||
|
||||
if (Target)
|
||||
|
|
|
@ -72,7 +72,7 @@ MmReleasePageOp(PMM_PAGEOP PageOp)
|
|||
PMM_PAGEOP
|
||||
NTAPI
|
||||
MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
||||
PMM_SECTION_SEGMENT Segment, ULONG Offset)
|
||||
PMM_SECTION_SEGMENT Segment, ULONGLONG Offset)
|
||||
{
|
||||
ULONG_PTR Hash;
|
||||
KIRQL oldIrql;
|
||||
|
@ -135,7 +135,7 @@ MmCheckForPageOp(PMEMORY_AREA MArea, HANDLE Pid, PVOID Address,
|
|||
PMM_PAGEOP
|
||||
NTAPI
|
||||
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
|
||||
* the memory area and either the segment, offset pair or the
|
||||
|
|
|
@ -53,7 +53,7 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
|||
PVOID Address;
|
||||
PEPROCESS Process;
|
||||
PMM_PAGEOP PageOp;
|
||||
ULONG Offset;
|
||||
ULONGLONG Offset;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
ExAcquireFastMutex(&RmapListLock);
|
||||
|
@ -126,8 +126,8 @@ MmPageOutPhysicalAddress(PFN_NUMBER Page)
|
|||
Type = MemoryArea->Type;
|
||||
if (Type == MEMORY_AREA_SECTION_VIEW)
|
||||
{
|
||||
Offset = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
+ MemoryArea->Data.SectionData.ViewOffset.QuadPart;
|
||||
Offset = MemoryArea->Data.SectionData.ViewOffset.QuadPart +
|
||||
((ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress);
|
||||
|
||||
/*
|
||||
* Get or create a pageop
|
||||
|
|
|
@ -167,15 +167,6 @@ static GENERIC_MAPPING MmpSectionMapping = {
|
|||
STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE,
|
||||
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[] =
|
||||
{
|
||||
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;
|
||||
|
||||
/* 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)
|
||||
DIE(("The image is too large\n"));
|
||||
}
|
||||
|
@ -813,7 +804,7 @@ NTAPI
|
|||
MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||
PLARGE_INTEGER Offset)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
|
||||
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
|
||||
if (Entry == 0)
|
||||
|
@ -842,7 +833,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
|
|||
BOOLEAN Dirty,
|
||||
BOOLEAN PageOut)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
BOOLEAN IsDirectMapped = FALSE;
|
||||
|
||||
Entry = MmGetPageEntrySectionSegment(Segment, Offset);
|
||||
|
@ -982,7 +973,7 @@ BOOLEAN MiIsPageFromCache(PMEMORY_AREA MemoryArea,
|
|||
PBCB Bcb;
|
||||
PCACHE_SEGMENT CacheSeg;
|
||||
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)
|
||||
{
|
||||
CcRosReleaseCacheSegment(Bcb, CacheSeg, CacheSeg->Valid, FALSE, TRUE);
|
||||
|
@ -1029,7 +1020,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
|||
*/
|
||||
{
|
||||
ULONG BaseOffset;
|
||||
ULONG_PTR FileOffset;
|
||||
ULONGLONG FileOffset;
|
||||
PVOID BaseAddress;
|
||||
BOOLEAN UptoDate;
|
||||
PCACHE_SEGMENT CacheSeg;
|
||||
|
@ -1042,7 +1033,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
|||
|
||||
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
||||
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;
|
||||
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
|
||||
* then get the related cache segment.
|
||||
*/
|
||||
if ((FileOffset % PAGE_SIZE) == 0 &&
|
||||
(SegOffset + PAGE_SIZE <= RawLength || !IsImageSection) &&
|
||||
if (((FileOffset % PAGE_SIZE) == 0) &&
|
||||
((SegOffset + PAGE_SIZE <= RawLength) || !IsImageSection) &&
|
||||
!(MemoryArea->Data.SectionData.Segment->Image.Characteristics & IMAGE_SCN_MEM_SHARED))
|
||||
{
|
||||
|
||||
|
@ -1140,7 +1131,7 @@ MiReadPage(PMEMORY_AREA MemoryArea,
|
|||
|
||||
Process = PsGetCurrentProcess();
|
||||
PageAddr = MiMapPageInHyperSpace(Process, *Page, &Irql);
|
||||
CacheSegOffset = BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset;
|
||||
CacheSegOffset = (ULONG_PTR)(BaseOffset + CacheSeg->Bcb->CacheSegmentSize - FileOffset);
|
||||
Length = RawLength - SegOffset;
|
||||
if (Length <= CacheSegOffset && Length <= PAGE_SIZE)
|
||||
{
|
||||
|
@ -1469,7 +1460,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
/*
|
||||
* Just map the desired physical page
|
||||
*/
|
||||
Page = Offset.QuadPart >> PAGE_SHIFT;
|
||||
Page = (PFN_NUMBER)(Offset.QuadPart >> PAGE_SHIFT);
|
||||
Status = MmCreateVirtualMappingUnsafe(Process,
|
||||
PAddress,
|
||||
Region->Protect,
|
||||
|
@ -1552,7 +1543,8 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
MmUnlockAddressSpace(AddressSpace);
|
||||
|
||||
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);
|
||||
if (Process) MI_SET_PROCESS2(Process->ImageFileName);
|
||||
|
@ -1566,7 +1558,7 @@ MmNotPresentFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
}
|
||||
else
|
||||
{
|
||||
Status = MiReadPage(MemoryArea, Offset.QuadPart, &Page);
|
||||
Status = MiReadPage(MemoryArea, (ULONG_PTR)Offset.QuadPart, &Page);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("MiReadPage failed (Status %x)\n", Status);
|
||||
|
@ -1745,7 +1737,7 @@ MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
LARGE_INTEGER Offset;
|
||||
PMM_PAGEOP PageOp;
|
||||
PMM_REGION Region;
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace);
|
||||
|
||||
DPRINT("MmAccessFaultSectionView(%x, %x, %x, %x)\n", AddressSpace, MemoryArea, Address);
|
||||
|
@ -1800,10 +1792,10 @@ MmAccessFaultSectionView(PMMSUPPORT AddressSpace,
|
|||
MmSetPageProtect(Process, Address, Region->Protect);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
if(OldPage == 0)
|
||||
DPRINT("OldPage == 0!\n");
|
||||
|
||||
|
||||
/*
|
||||
* Get or create a pageop
|
||||
*/
|
||||
|
@ -1962,8 +1954,8 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
|||
PFN_NUMBER Page;
|
||||
MM_SECTION_PAGEOUT_CONTEXT Context;
|
||||
SWAPENTRY SwapEntry;
|
||||
ULONG Entry;
|
||||
ULONG FileOffset;
|
||||
ULONG_PTR Entry;
|
||||
ULONGLONG FileOffset;
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
#ifndef NEWCC
|
||||
|
@ -2162,7 +2154,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
|||
KeBugCheckEx(MEMORY_MANAGEMENT, STATUS_UNSUCCESSFUL, SwapEntry, (ULONG_PTR)Process, (ULONG_PTR)Address);
|
||||
}
|
||||
#ifndef NEWCC
|
||||
Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE);
|
||||
Status = CcRosUnmapCacheSegment(Bcb, (ULONG)FileOffset, FALSE);
|
||||
#else
|
||||
Status = STATUS_SUCCESS;
|
||||
#endif
|
||||
|
@ -2170,7 +2162,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
|||
if (!NT_SUCCESS(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
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
|
@ -2237,7 +2229,7 @@ MmPageOutSectionView(PMMSUPPORT AddressSpace,
|
|||
}
|
||||
else
|
||||
{
|
||||
LONG OldEntry;
|
||||
ULONG_PTR OldEntry;
|
||||
/*
|
||||
* 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
|
||||
|
@ -2365,7 +2357,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
|
|||
PMM_SECTION_SEGMENT Segment;
|
||||
PFN_NUMBER Page;
|
||||
SWAPENTRY SwapEntry;
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
BOOLEAN Private;
|
||||
NTSTATUS Status;
|
||||
PFILE_OBJECT FileObject;
|
||||
|
@ -2457,7 +2449,7 @@ MmWritePageSectionView(PMMSUPPORT AddressSpace,
|
|||
{
|
||||
ASSERT(SwapEntry == 0);
|
||||
#ifndef NEWCC
|
||||
CcRosMarkDirtyCacheSegment(Bcb, Offset.LowPart + Segment->Image.FileOffset);
|
||||
CcRosMarkDirtyCacheSegment(Bcb, (ULONG)(Offset.QuadPart + Segment->Image.FileOffset));
|
||||
#endif
|
||||
PageOp->Status = STATUS_SUCCESS;
|
||||
MmspCompleteAndReleasePageOp(PageOp);
|
||||
|
@ -2543,7 +2535,7 @@ MmAlterViewAttributes(PMMSUPPORT AddressSpace,
|
|||
if (DoCOW && MmIsPagePresent(Process, Address))
|
||||
{
|
||||
LARGE_INTEGER Offset;
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
PFN_NUMBER Page;
|
||||
|
||||
Offset.QuadPart = (ULONG_PTR)Address - (ULONG_PTR)MemoryArea->StartingAddress
|
||||
|
@ -2655,7 +2647,7 @@ MmpFreePageFileSegment(PMM_SECTION_SEGMENT Segment)
|
|||
{
|
||||
ULONG Length;
|
||||
LARGE_INTEGER Offset;
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
SWAPENTRY SavedSwapEntry;
|
||||
PFN_NUMBER Page;
|
||||
|
||||
|
@ -2739,7 +2731,7 @@ MmpDeleteSection(PVOID ObjectBody)
|
|||
ULONG RefCount = 0;
|
||||
PMM_SECTION_SEGMENT Segment = Section->Segment;
|
||||
|
||||
if (Segment &&
|
||||
if (Segment &&
|
||||
(RefCount = InterlockedDecrementUL(&Segment->ReferenceCount)) == 0)
|
||||
{
|
||||
DPRINT("Freeing section segment\n");
|
||||
|
@ -3307,7 +3299,7 @@ ExeFmtpReadFile(IN PVOID File,
|
|||
|
||||
Status = MiSimpleRead(FileObject, &FileOffset, Buffer, BufferSize, TRUE, &Iosb);
|
||||
|
||||
UsedSize = Iosb.Information;
|
||||
UsedSize = (ULONG)Iosb.Information;
|
||||
|
||||
if(NT_SUCCESS(Status) && UsedSize < OffsetAdjustment)
|
||||
{
|
||||
|
@ -3540,7 +3532,7 @@ MmspPageAlignSegments
|
|||
PMM_SECTION_SEGMENT Segment = &ImageSectionObject->Segments[i];
|
||||
ULONG_PTR EndOfEffectiveSegment;
|
||||
|
||||
EndOfEffectiveSegment = EffectiveSegment->Image.VirtualAddress + EffectiveSegment->Length.QuadPart;
|
||||
EndOfEffectiveSegment = (ULONG_PTR)(EffectiveSegment->Image.VirtualAddress + EffectiveSegment->Length.QuadPart);
|
||||
ASSERT((EndOfEffectiveSegment % PAGE_SIZE) == 0);
|
||||
|
||||
/*
|
||||
|
@ -4042,7 +4034,7 @@ static VOID
|
|||
MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||
PFN_NUMBER Page, SWAPENTRY SwapEntry, BOOLEAN Dirty)
|
||||
{
|
||||
ULONG Entry;
|
||||
ULONG_PTR Entry;
|
||||
PFILE_OBJECT FileObject;
|
||||
PBCB Bcb;
|
||||
LARGE_INTEGER Offset;
|
||||
|
@ -4098,7 +4090,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
|||
FileObject = MemoryArea->Data.SectionData.Section->FileObject;
|
||||
Bcb = FileObject->SectionObjectPointer->SharedCacheMap;
|
||||
#ifndef NEWCC
|
||||
CcRosMarkDirtyCacheSegment(Bcb, Offset.QuadPart + Segment->Image.FileOffset);
|
||||
CcRosMarkDirtyCacheSegment(Bcb, (ULONG)(Offset.QuadPart + Segment->Image.FileOffset));
|
||||
#endif
|
||||
ASSERT(SwapEntry == 0);
|
||||
}
|
||||
|
@ -4597,8 +4589,8 @@ MmMapViewOfSection(IN PVOID SectionObject,
|
|||
if (!(SectionSegments[i].Image.Characteristics & IMAGE_SCN_TYPE_NOLOAD))
|
||||
{
|
||||
ULONG_PTR MaxExtent;
|
||||
MaxExtent = (ULONG_PTR)SectionSegments[i].Image.VirtualAddress +
|
||||
SectionSegments[i].Length.QuadPart;
|
||||
MaxExtent = (ULONG_PTR)(SectionSegments[i].Image.VirtualAddress +
|
||||
SectionSegments[i].Length.QuadPart);
|
||||
ImageSize = max(ImageSize, MaxExtent);
|
||||
}
|
||||
}
|
||||
|
@ -5047,7 +5039,7 @@ MmCreateSection (OUT PVOID * Section,
|
|||
DPRINT("Creating a section with WRITE access\n");
|
||||
FileAccess = FILE_READ_DATA | FILE_WRITE_DATA | SYNCHRONIZE;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
DPRINT("Creating a section with READ access\n");
|
||||
FileAccess = FILE_READ_DATA | SYNCHRONIZE;
|
||||
|
|
|
@ -470,8 +470,8 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
|||
VmCounters->PagefileUsage = Process->QuotaUsage[2] << PAGE_SHIFT;
|
||||
VmCounters->PeakPagefileUsage = Process->QuotaPeak[2] << PAGE_SHIFT;
|
||||
//VmCounters->PrivateUsage = Process->CommitCharge << PAGE_SHIFT;
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
/* Set the return length */
|
||||
Length = ProcessInformationLength;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue