Commit graph

332 commits

Author SHA1 Message Date
Timo Kreuzer dae88fb828 [NTOS:MM] Make x64 address space layout more like Vista+
- Change MM_SYSTEM_SPACE_START to 0xFFFFF88000000000
- Move MI_DEBUG_MAPPING to the end of the system PTE range
- Add MI_SYSTEM_CACHE_START and MI_SYSTEM_CACHE_END, which is in the range that Vista uses as dynamic VA space for cache and other allocations
- Wrap x86 specific code that makes now invalid assumptions about the address space layout in #ifdef _M_IX86
2018-02-05 01:09:32 +01:00
Pierre Schweitzer 3f8788d6e5
[NTOSKRNL] Add an helper for marking a VACB clean (ie, not dirty).
CORE-14263
2018-02-01 08:36:17 +01:00
Pierre Schweitzer b49a2d6356
[NTOSKRNL] Drop ROS_DEFERRED_WRITE_CONTEXT in favor of DEFERRED_WRITE
that was introduced in d3e0eb2.

CORE-14235
2018-01-28 11:55:40 +01:00
Pierre Schweitzer 5cc0668b21
[NTOSKRNL] Store the total dirty pages per shared cache map in it. 2018-01-26 10:42:09 +01:00
Pierre Schweitzer 9d1e16663a
[NTOSKRNL] Link all the shared cache map together. 2018-01-24 21:46:16 +01:00
Pierre Schweitzer f93acd806a
[NTOSKRNL] Implement per-file dirty page threshold.
Namely, implement CcSetDirtyPageThreshold() and add support for it
in CcCanIWrite().

Also added my name in the headers of the few files I touched tonight.

CORE-14235
2018-01-23 23:25:26 +01:00
Pierre Schweitzer 9a07c71eef
[NTOSKRNL] Implement support for deferred writes in Cc.
Namely, implement CcCanIWrite() (very basic, and likely wrong).
And implement CcDeferWrite() which will queue the write operation.

In CciLazyWriter() (which may be renamed CcWorkerThread() ;-)),
handle the queued write operations one by one. This is likely
not to be accurate, but, given we have only on FS supporting
this for now (NFS / RDBSS / Shares), this is OK.

CORE-14235
2018-01-23 23:25:26 +01:00
Pierre Schweitzer 07e6e9c9c1
[NTOSKRNL] When marking a BCB dirty, also mark the underlying VACB dirty.
Experiment and MSDN tend to show that a dirty BCB is queued for lazy write.
This will do the job here!

Also, renamed CcRosMarkDirtyFile() which is more accurate, and added a new
function CcRosMarkDirtyVacb() which just takes a VACB as arg (expected locked)
and marks it dirty (using previous implementation). Make CcRosMarkDirtyFile()
use it.

CORE-14235
2018-01-23 23:25:26 +01:00
Pierre Schweitzer c7ad200f8b
[NTOSKRNL] Reimplement the lazy writer in Cc and remove the "basic" one in Mm.
This removes the "modified page writer" thread in Mm that was regularly blindly
attempting to flush dirty pages to the disk.
Instead, this commit introduces a lazy writer that will monitor dirty pages count
and will flush them to disk when this count is above a threshold. The threshold is
computed on Cc init.
Compared to what was done previously, this lazy writer will only write down files
that are not marked as temporary.
The mechanisms involved in this lazy writer worker are well described in Windows
Internals 4th editions (constants are coming from it ;-)).
Also fixed a bad (and old!) bug in CcRosFlushDirtyPages() where target count could
be overflow and the function would spin forever while holding the VACBs lock. This is
mandatory as now lazy writer will call it with "random" values.
This also allows implementing CcWaitForCurrentLazyWriterActivity() :-).
Also renamed DirtyPageCount to its MS equivalent.

CORE-14235
2018-01-23 19:33:59 +01:00
Pierre Schweitzer c779dbd4c5
[NTOSKRNL] Implement CcIsThereDirtyData() 2018-01-15 23:20:53 +01:00
Timo Kreuzer a00378a1a1 [NTOS:MM] Add support for NX page-faults 2018-01-06 18:20:24 +01:00
Timo Kreuzer 4d043aa05e [NTOS:MM] Make use of FaultCode and MI_IS_NOT_PRESENT_FAULT and MI_IS_WRITE_ACCESS macros in MmArmAccessFault. 2018-01-06 18:20:24 +01:00
Timo Kreuzer 3021c2d571 [NTOS:MM] Pass page fault code to MmAccessFault
Note: before we had a BOOLEAN parameter called StoreInstruction, but in reality it was not specifying whether the fault was from a store store instruction, but whether it was an access violation rather than a page-not-present fault. On x86 without PAE there are only 2 kinds of access violations: (1) Access of a kernel mode page from user mode, which is handled early and (2) access of a read-only (or COW) page with a writing instruction. Therefore we could get away with this, even though it relied on the wrong assumption that a fault, which was not a page-not-present-fault, was automatically a write access. This commit only changes one thing: we pass the full fault-code to MmAccessFault and handle the rest from there in exactly the same way as before. More changes are coming to make things clear.
2018-01-06 18:20:24 +01:00
Hermes Belusca-Maito b2be558e61 [NTOS:INBV] Simplify a little bit the BootLogoFadeIn() function
- Use KeDelayExecutionThread() instead of KeStallExecutionProcessor().
- Fix magic values and add comments.
- Fix structure name.
2018-01-03 02:57:28 +01:00
Stanislav Motylkov dd71fb5ec8 [NTOS:INBV] Implement rotation bar for boot screen
CORE-10327 #resolve
2018-01-03 02:57:28 +01:00
Timo Kreuzer cbc4cfeed6 [NTOS:EX] Fix handle table code for x64.
Based on patch by Ivan Labutin. See PR #115
2017-12-29 19:44:09 +01:00
Hermès Bélusca-Maïto ff8d8a8162
Revert 57c0678 (PR #194) that has been erroneously committed too early. 2017-12-24 16:54:48 +01:00
Stanislav Motylkov 57c0678818
[NTOS:INBV] Implement rotation bar for boot screen 2017-12-24 16:47:02 +01:00
Timo Kreuzer 18cd763160 [NTOS:MM] Make debug code in MmArmInitSystem portable 2017-12-20 06:56:09 +01:00
Timo Kreuzer 11c78f701d [NTOS:MM] Implement x64 version of MI_MAKE_SUBSECTION_PTE 2017-12-20 06:56:09 +01:00
Ivan Labutin ede3f4d449 [NTOS:KE] Improve readability of CPU flag checks and fix error checking wrong register for HT support 2017-12-20 06:56:09 +01:00
Ivan Labutin b9f592c054 [NTOS:KE] EFER constants fix 2017-12-20 06:56:09 +01:00
Thomas Faber 7e8de26164
[NTOS:KD] Pass PreviousMode down to KdpPrintString, since ExGetPreviousMode is not accurate. CORE-14103 2017-12-14 11:46:18 +01:00
Amine Khaldi 24f35397c6 [NTOS] Add some header guards. 2017-12-12 12:42:13 +01:00
Thomas Faber 34ccecbce8 [NTOS:KD] Protect against invalid user arguments in KdpPrintString. CORE-14057 2017-12-10 15:26:18 +01:00
Thomas Faber 1a38c76266 [NTOS:KD] Protect against invalid user arguments in KdpPrompt. CORE-14057 2017-12-10 15:26:18 +01:00
Thomas Faber 81532227b6
[NTOS:MM] Implement and use MiAcquirePfnLockAtDpcLevel/MiReleasePfnLockFromDpcLevel. 2017-12-08 10:32:22 +01:00
Thomas Faber da5949280c
[NTOS:MM] Use inline functions to acquire/release the PFN lock. 2017-12-08 10:32:08 +01:00
Pierre Schweitzer 3b64f7f8fb
[NTOSKRNL] Implement (with many FIXMEs) ObReferenceFileObjectForWrite() so that it can already do the job!
CORE-14003
2017-11-12 22:39:40 +01:00
Pierre Schweitzer 7eefe70294
[NTOSKRNL] Implement IoComputeDesiredAccessFileObject() based on checks performed in NtFlushBuffersFile()
CORE-14003
2017-11-12 22:39:40 +01:00
Timo Kreuzer 24856b8de6 [NTOSKRNL] Add back parentheses that got removed in r75605 2017-10-08 14:53:04 +02:00
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