Author: tkreuzer
Date: Wed Mar 28 19:41:40 2012
New Revision: 56264

URL: http://svn.reactos.org/svn/reactos?rev=56264&view=rev
Log:
[NTOSKRNL]
- Make file offsets 64 bit
- Fix lots of MSVC/64 bit warnings

Modified:
    trunk/reactos/ntoskrnl/cache/section/data.c
    trunk/reactos/ntoskrnl/cache/section/fault.c
    trunk/reactos/ntoskrnl/cache/section/newmm.h
    trunk/reactos/ntoskrnl/cache/section/reqtools.c
    trunk/reactos/ntoskrnl/cache/section/sptab.c
    trunk/reactos/ntoskrnl/cache/section/swapout.c
    trunk/reactos/ntoskrnl/include/internal/ke.h
    trunk/reactos/ntoskrnl/include/internal/mm.h
    trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
    trunk/reactos/ntoskrnl/mm/ARM3/expool.c
    trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
    trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
    trunk/reactos/ntoskrnl/mm/ARM3/section.c
    trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
    trunk/reactos/ntoskrnl/mm/balance.c
    trunk/reactos/ntoskrnl/mm/pageop.c
    trunk/reactos/ntoskrnl/mm/rmap.c
    trunk/reactos/ntoskrnl/mm/section.c
    trunk/reactos/ntoskrnl/ps/query.c

Modified: trunk/reactos/ntoskrnl/cache/section/data.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/data.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -129,7 +129,7 @@
     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 @@
          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 @@
          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 @@
 {
     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 @@
     */
     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 @@
                                         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 @@
 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 @@
                        SWAPENTRY SwapEntry,
                        BOOLEAN Dirty)
 {
-    ULONG Entry;
+    ULONG_PTR Entry;
     PVOID *ContextData = Context;
     PMMSUPPORT AddressSpace;
     PEPROCESS Process;

Modified: trunk/reactos/ntoskrnl/cache/section/fault.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/fault.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/fault.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/fault.c [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -69,7 +69,7 @@
     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 @@
             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,

Modified: trunk/reactos/ntoskrnl/cache/section/newmm.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/newmm.h?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/newmm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/newmm.h [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -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 @@
     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 @@
 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,

Modified: trunk/reactos/ntoskrnl/cache/section/reqtools.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/reqtools.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/reqtools.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/reqtools.c [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -61,7 +61,7 @@
              PMEMORY_AREA MemoryArea,
              PMM_REQUIRED_RESOURCES Required)
 {
-    int i;
+    ULONG i;
     NTSTATUS Status = STATUS_SUCCESS;
 
     for (i = 0; i < Required->Amount; i++)

Modified: trunk/reactos/ntoskrnl/cache/section/sptab.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/sptab.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/sptab.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/sptab.c [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -148,11 +148,11 @@
 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 @@
     return STATUS_SUCCESS;
 }
 
-ULONG
+ULONG_PTR
 NTAPI
 _MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
                               PLARGE_INTEGER Offset,
@@ -210,7 +210,7 @@
                               int line)
 {
     LARGE_INTEGER FileOffset;
-    ULONG PageIndex, Result;
+    ULONG_PTR PageIndex, Result;
     PCACHE_SECTION_PAGE_TABLE PageTable;
 
     ASSERT(Segment->Locked);
@@ -247,10 +247,10 @@
                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];

Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/swapout.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -64,7 +64,7 @@
                       PLARGE_INTEGER FileOffset,
                       BOOLEAN *Dirty)
 {
-    ULONG Entry;
+    ULONG_PTR Entry;
 
     DPRINT("MmWithdrawSectionPage(%x,%08x%08x,%x)\n",
            Segment,
@@ -228,7 +228,7 @@
                       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 @@
 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;

Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/ke.h?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -983,12 +983,14 @@
     IN PKTRAP_FRAME TrapFrame
 );
 
+#ifndef _M_AMD64
 VOID
 FASTCALL
 KiInterruptDispatch(
     IN PKTRAP_FRAME TrapFrame,
     IN PKINTERRUPT Interrupt
 );
+#endif
 
 VOID
 FASTCALL

Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/mm.h?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Wed Mar 28 
19:41:40 2012
@@ -206,10 +206,10 @@
     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 @@
    * section mapping.
    */
   PMM_SECTION_SEGMENT Segment;
-  ULONG Offset;
+  ULONGLONG Offset;
 } MM_PAGEOP, *PMM_PAGEOP;
 
 typedef struct _MM_MEMORY_CONSUMER
@@ -1020,7 +1020,7 @@
     HANDLE Pid,
     PVOID Address,
     PMM_SECTION_SEGMENT Segment,
-    ULONG Offset,
+    ULONGLONG Offset,
     ULONG OpType,
     BOOLEAN First
 );
@@ -1032,7 +1032,7 @@
     HANDLE Pid,
     PVOID Address,
     PMM_SECTION_SEGMENT Segment,
-    ULONG Offset
+    ULONGLONG Offset
 );
 
 VOID

Modified: trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/pnpmgr/pnpmgr.c [iso-8859-1] Wed Mar 28 19:41:40 
2012
@@ -63,7 +63,7 @@
 VOID
 IopFixupDeviceId(PWCHAR String)
 {
-    ULONG Length = wcslen(String), i;
+    SIZE_T Length = wcslen(String), i;
 
     for (i = 0; i < Length; i++)
     {

Modified: trunk/reactos/ntoskrnl/mm/ARM3/expool.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/expool.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/expool.c [iso-8859-1] Wed Mar 28 19:41:40 
2012
@@ -306,7 +306,7 @@
 FORCEINLINE
 VOID
 ExpCheckPoolIrqlLevel(IN POOL_TYPE PoolType,
-                      IN ULONG NumberOfBytes,
+                      IN SIZE_T NumberOfBytes,
                       IN PVOID Entry)
 {
     //
@@ -341,7 +341,7 @@
     // the table
     //
     ULONGLONG Result = 40543 * Tag;
-    return BucketMask & (Result ^ (Result >> 32));
+    return (ULONG)BucketMask & ((ULONG)Result ^ (Result >> 32));
 }
 
 FORCEINLINE
@@ -358,7 +358,7 @@
     // 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 @@
             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 @@
                  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 @@
     // 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 @@
 ULONG
 NTAPI
 ExpFindAndRemoveTagBigPages(IN PVOID Va,
-                            OUT PULONG BigPages,
+                            OUT PULONG_PTR BigPages,
                             IN POOL_TYPE PoolType)
 {
     BOOLEAN FirstTry = TRUE;
@@ -1525,7 +1527,8 @@
         //
         // 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 @@
         //
         if (!ExpAddTagForBigPages(Entry,
                                   Tag,
-                                  BYTES_TO_PAGES(NumberOfBytes),
+                                  (ULONG)BYTES_TO_PAGES(NumberOfBytes),
                                   OriginalType))
         {
             Tag = ' GIB';
@@ -2083,14 +2086,16 @@
         //
         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;
     }
 

Modified: trunk/reactos/ntoskrnl/mm/ARM3/mminit.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/mminit.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/mminit.c [iso-8859-1] Wed Mar 28 19:41:40 
2012
@@ -1071,7 +1071,7 @@
 {
     PLIST_ENTRY NextMd;
     PMEMORY_ALLOCATION_DESCRIPTOR MdBlock;
-    ULONG i;
+    ULONG_PTR i;
     PFN_NUMBER BasePage, LoaderPages;
     PMMPFN Pfn1;
     KIRQL OldIrql;

Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Wed Mar 28 19:41:40 
2012
@@ -244,7 +244,8 @@
         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 @@
 
     /* Use idle process Working set */
     Process->Vm.VmWorkingSetList = PsGetCurrentProcess()->Vm.VmWorkingSetList;
-    
+
     /* Done */
     Process->HasAddressSpace = TRUE;//??
     return STATUS_SUCCESS;

Modified: trunk/reactos/ntoskrnl/mm/ARM3/section.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/section.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/section.c [iso-8859-1] Wed Mar 28 19:41:40 
2012
@@ -848,7 +848,7 @@
     {
         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 @@
     {
         /* 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);

Modified: trunk/reactos/ntoskrnl/mm/ARM3/virtual.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/virtual.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/virtual.c [iso-8859-1] Wed Mar 28 19:41:40 
2012
@@ -3668,9 +3668,9 @@
                     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;

Modified: trunk/reactos/ntoskrnl/mm/balance.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Wed Mar 28 19:41:40 2012
@@ -157,7 +157,7 @@
     if (MmAvailablePages < MiMinimumAvailablePages)
     {
         /* Global page limit exceeded */
-        Target = max(Target, MiMinimumAvailablePages - MmAvailablePages);
+        Target = (ULONG)max(Target, MiMinimumAvailablePages - 
MmAvailablePages);
     }
 
     if (Target)

Modified: trunk/reactos/ntoskrnl/mm/pageop.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pageop.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pageop.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pageop.c [iso-8859-1] Wed Mar 28 19:41:40 2012
@@ -72,7 +72,7 @@
 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 @@
 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

Modified: trunk/reactos/ntoskrnl/mm/rmap.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/rmap.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/rmap.c [iso-8859-1] Wed Mar 28 19:41:40 2012
@@ -53,7 +53,7 @@
    PVOID Address;
    PEPROCESS Process;
    PMM_PAGEOP PageOp;
-   ULONG Offset;
+   ULONGLONG Offset;
    NTSTATUS Status = STATUS_SUCCESS;
 
    ExAcquireFastMutex(&RmapListLock);
@@ -126,8 +126,8 @@
    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

Modified: trunk/reactos/ntoskrnl/mm/section.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/section.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/section.c [iso-8859-1] Wed Mar 28 19:41:40 2012
@@ -167,15 +167,6 @@
          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 @@
         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 @@
 MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
                                PLARGE_INTEGER Offset)
 {
-   ULONG Entry;
+   ULONG_PTR Entry;
 
    Entry = MmGetPageEntrySectionSegment(Segment, Offset);
    if (Entry == 0)
@@ -842,7 +833,7 @@
                                  BOOLEAN Dirty,
                                  BOOLEAN PageOut)
 {
-   ULONG Entry;
+   ULONG_PTR Entry;
    BOOLEAN IsDirectMapped = FALSE;
 
    Entry = MmGetPageEntrySectionSegment(Segment, Offset);
@@ -982,7 +973,7 @@
       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 @@
  */
 {
    ULONG BaseOffset;
-   ULONG_PTR FileOffset;
+   ULONGLONG FileOffset;
    PVOID BaseAddress;
    BOOLEAN UptoDate;
    PCACHE_SEGMENT CacheSeg;
@@ -1042,7 +1033,7 @@
 
    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 @@
     * 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 @@
 
       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 @@
       /*
        * 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 @@
       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 @@
       }
       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 @@
    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 @@
       MmSetPageProtect(Process, Address, Region->Protect);
       return(STATUS_SUCCESS);
    }
-   
+
    if(OldPage == 0)
       DPRINT("OldPage == 0!\n");
-   
+
    /*
     * Get or create a pageop
     */
@@ -1962,8 +1954,8 @@
    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 @@
          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 @@
       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 @@
          }
          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 @@
    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 @@
    {
       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 @@
          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 @@
 {
    ULONG Length;
    LARGE_INTEGER Offset;
-   ULONG Entry;
+   ULONG_PTR Entry;
    SWAPENTRY SavedSwapEntry;
    PFN_NUMBER Page;
 
@@ -2739,7 +2731,7 @@
          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 @@
 
    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 @@
          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 @@
 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 @@
          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 @@
          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 @@
         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;

Modified: trunk/reactos/ntoskrnl/ps/query.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=56264&r1=56263&r2=56264&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Wed Mar 28 19:41:40 2012
@@ -470,8 +470,8 @@
                 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;
             }


Reply via email to