Commit graph

18 commits

Author SHA1 Message Date
Colin Finck c2c66aff7d Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys. 2017-10-03 07:45:34 +00:00
Hermès Bélusca-Maïto 10bff42ab6 Remove redundant extra terminating ';' in all of our C code.
svn path=/trunk/; revision=70690
2016-02-04 20:42:07 +00:00
Amine Khaldi f57a299104 [CMAKE][NTOS]
* Improve some inclusions (avoid ../ types).
* The answer is 42.

svn path=/trunk/; revision=65357
2014-11-10 16:26:55 +00:00
Timo Kreuzer 0a3873c1c2 [NTOSKRNL]
Remove obsolete FreePage parameter from MmDeleteVirtualMapping

svn path=/trunk/; revision=64532
2014-10-05 07:16:01 +00:00
Timo Kreuzer 7ceac2f6a4 [NTOSKRNL]
Massive cleanup of old and deprecated "Ros-Mm"-Code

svn path=/trunk/; revision=62481
2014-03-11 22:51:22 +00:00
Timo Kreuzer 3f0ef714a4 [NTOSKRNL]
Remove deprecated and unused functions MmDisableVirtualMapping and MmRawDeleteVirtualMapping

svn path=/trunk/; revision=61090
2013-11-24 16:18:50 +00:00
Timo Kreuzer d059077864 [NTOSKRNL]
- Use MI_IS_MAPPED_PTE instead of unportable bit fiddling
- Use MiDecrementPageTableReferences instead of manually messing with MmWorkingSetList, which is not portable
- Make MmGetPhysicalAddress portable

svn path=/trunk/; revision=61086
2013-11-23 22:34:20 +00:00
Timo Kreuzer 28adbd6967 [NTOSKRNL]
Add amd64 version of MmIsDisabledPage

svn path=/trunk/; revision=56894
2012-07-15 12:39:46 +00:00
Amine Khaldi e14f67f95d [NEWCC]
A reintegration checkpoint for the NewCC branch, brought to you by Team NewCC.

Differences with current ReactOS trunk:

* A new memory area type, MEMORY_AREA_CACHE, is added, which represents a mapped region of a file. In NEWCC mode, user sections are MEMORY_AREA_CACHE type as well, and obey new semantics. In non-NEWCC mode, they aren't used.
* A way of claiming a page entry for a specific thread's work is added. Placing the special SWAPENTRY value MM_WAIT_ENTRY in a page table, or in a section page table should indicate that memory management code is intended to wait for another thread to make some status change before checking the state of the page entry again. In code that uses this convention, a return value of STATUS_SUCCESS + 1 is used to indicate that the caller should use the MiWaitForPageEvent macro to wait until somebody has change the state of a wait entry before checking again. This is a lighter weight mechanism than PAGEOPs.
* A way of asking the caller to perform some blocking operation without locks held is provided. This replaces some spaghettified code in which locks are repeatedly taken and broken by code that performs various blocking operations. Using this mechanism, it is possible to do a small amount of non-blocking work, fill in a request, then return STATUS_MORE_PROCESSING_REQUIRED to request that locks be dropped and the blocking operation be carried out. A MM_REQUIRED_RESOURCES structure is provided to consumers of this contract to use to accumulate state across many blocking operations. Several functions wrapping blocking operations are provided in ntoskrnl/cache/reqtools.c.
* Image section pages are no longer direct mapped. This is done to simplify consolidation of ownership of pages under the data section system. At a later time, it may be possible to make data pages directly available to image sections for the same file. This is likely the only direct performance impact this code makes on non-NEWCC mode.

RMAPs:

* A new type of RMAP entry is introduced, distinguished by RMAP_IS_SEGMENT(Address) of the rmap entry. This kind of entry contains a pointer to a section page table node in the Process pointer, which in turn links back to the MM_SECTION_SEGMENT it belongs to. Therefore, a page belonging only to a segment (that is, a segment page that isn't mapped) can exist and be evicted using the normal page eviction mechanism in balance.c. Each of the rmap function has been modified to deal with segment rmaps.
* The low 8 bits of the Address field in a segment rmap denote the entry number in the generic table node pointed to by Process that points to the page the rmap belongs to. By combining them, you can determine the file offset the page belongs to.
* In NEWCC mode, MmSharePageEntry/UnsharePageEntry are not used, and instead the page reference count is used to keep track of the number of mappings of a page, allowing the last reference expiring to allow the page to be recycled without much intervention. These are still used in non-NEWCC mode. One change has been made, the count fields have been narrowed by 1 bit to make room for a dirty bit in SSE entries, needed when a page is present but unmapped.

Section page tables:

* The section page tables are now implemented using RtlGenericTables. This enables a fairly compact representation of section page tables without having the existence of a section object imply 4k of fake PDEs. In addition, each node in the generic table has a wide file offset that is a multiple of 256 pages, or 1 megabyte total. Besides needing wide file offsets, the only other visible change caused by the switch to generic tables for section page tables is the need to lock the section segment before interacting with the section page table.

Eviction:

* Page eviction in cache sections is accomplished by MmpPageOutPhysicalAddress. In the case of a shared page, it tries to remove all mappings of the indicated page. If this process fails at any point, the page will simply be drawn back into the target address spaces. After succeeding at this, if TRUE has been accumulated into the page's dirty bit in the section page table, it is written back, and then permanently removed.

NewCC mode:

* NEWCC mode is introduced, which rewrites the file cache to a set of cache stripes actively mapped, along with unmapped section data.
* NewCC is more authentic in its interpretation of the external interface to the windows cache than the current cache manager, implementing each of the cache manager functions according to the documented interface with no preconceived ideas about how anything should be implemented internally. Cache stripes are implemented on top of section objects, using the same memory manager paths, and therefore economizing code and complexity. This replaces a rather complicated system in which pages can be owned by the cache manager and the memory manager simultaneously and they must cooperate in a fairly sophisticated way to manage them. Since they're quite interdependent in the current code, modifying either is very difficult. In NEWCC, they have a clear division of labor and thus can be worked on independently.
* Several third party filesystems that use the kernel Cc interface work properly using NEWCC, including matt wu's ext3 driver.
* In contrast with code that tries to make CcInitializeCacheMap and CcUninitializeCacheMap into a pair that supports reference counting, NEWCC lazily initializes the shared and private cache maps as needed and uses the presence of a PrivateCacheMap on at least one file pointing to the SharedCacheMap as an indication that the FILE_OBJECT reference in the SharedCacheMap should still be held. When the last PrivateCacheMap is discarded, that's the appropriate time to tear down caching for a specific file, as the SharedCacheMap data is allowed to be saved and reused. We honor this by making the SharedCacheMap into a depot for keeping track of the PrivateCacheMap objects associated with views of a file.

svn path=/trunk/; revision=55833
2012-02-23 12:03:06 +00:00
Alex Ionescu c21ab0f761 [NTOSKRNL]: This is kind of embarssing, but after doing a local grep for some of cgutman and zekflop's changes (respectively the patch that had added MmDeleteProcessPageDirectory, and the mshtml fix patch), I fell upon a .patch file. It included 3 memory-leak-fixing patches from richard that had been sent to me during his last days -- which, had I paid attention, would've fixed the MSHTML bug and the memory leaks months ago! I've tried my best to now re-integrate a portion of the patch (the other two portions deal with freeing the loader block, and freeing .INIT sections, and I will commit them later) with the current state of trunk. Some things that patch did, no longer seem to work, and I've commented where appropriate. But in general it does seem to dereference/delete some PTEs that had been left behind before (such as deleted TEBs, and deleted VA mappings). It no longer seems to be able to delete the root PDE nor the shared data page however (this worked in the original patch's timeframe). Zekflop, tkreuzer, please take a look. I hope this will set us on a better path!
svn path=/trunk/; revision=55666
2012-02-17 07:07:47 +00:00
Timo Kreuzer 54bd4f5cc8 [NTOSKRNL]
- Implement amd64 version of MmDeleteProcessPageDirectory
- Fix amd64 build

svn path=/trunk/; revision=55505
2012-02-08 22:23:10 +00:00
Timo Kreuzer 440561287c [NTOSKRNL]
- Modify MiRosTakeOverPebTebRanges to only create a memory area for the shared user page and rename it to MiRosTakeOverSharedUserPage. Previously it was creating a memory area for the whole region from USER_SHARED_DATA up to MM_HIGHEST_USER_ADDRESS, which is the majority of the x64 user mode address space and doesn't even contain the PEB/TEB. Those are allocated below the shared user page and get their memory areas created in MiInsertNode.
- Add amd64 versions of MmGetPageTableForProcess, MmUnmapPageTable, MmGetPageFileMapping

svn path=/trunk/; revision=55438
2012-02-05 18:41:37 +00:00
Timo Kreuzer afd88373ce [NTOSKRNL/MM/AMD64]
- Implement more of MmCreateProcessAddressSpace
- Acquire pfn lock and use MiRemoveZeroPage in MiGetPteForProcess

svn path=/trunk/; revision=55407
2012-02-04 12:13:53 +00:00
Timo Kreuzer 821e46df48 [NTOSKRNL]
Fix amd64 build and some warnings

svn path=/trunk/; revision=53334
2011-08-20 10:41:44 +00:00
Timo Kreuzer f69973e1e6 [NTOSKRNL]
- Add IoWMIDeviceObjectToProviderId and IoIs32bitProcess stubs for 64bit builds
- Comment out some deprecated amd64 code
- Add MmProtectToValue
- Fix a typo

svn path=/trunk/; revision=49322
2010-10-27 22:58:23 +00:00
Timo Kreuzer 592b4de3ba [NTOSKRNL]
- Fix MiAddressToPti and implement MiAddressToPxi for amd64
- Replace #error with DPRINT and ASSERT(FALSE) in MiInitializeLargePageSupport
- Implement amd64 specific MmCreateProcessAddressSpace
- Add MmProtectToPteMask for amd64 (copied from x86)
- Remove amd64 version of MmInitializeHandBuiltProcess

svn path=/trunk/; revision=48249
2010-07-25 12:00:26 +00:00
Timo Kreuzer 0bbdcf4d8b [NTOSKRNL]
Make MmIsAddressValid portable by using _MI_PAGING_LEVELS macro.

svn path=/trunk/; revision=48238
2010-07-25 00:50:03 +00:00
Timo Kreuzer bfc2638590 [NTOSKRNL]
Bring over all current amd64 specific code from the amd64 branch

svn path=/trunk/; revision=48222
2010-07-24 01:12:13 +00:00