Commit graph

919 commits

Author SHA1 Message Date
Jérôme Gardou 774a4c703f [NTOS/MM] Misc fixes
Purge data section object before creating an image mapping
Zero-out the tail of the page after reading from file
Properly map page as read-only when paging-in a COW memory map.
2021-02-03 09:41:22 +01:00
Jérôme Gardou 0933337404 [NTOS/MM] Do not dirtify section pages for system-space maps
Cc does it for itself.
2021-02-03 09:41:22 +01:00
Jérôme Gardou d440434a8e [NTOS/MM] Do not error when FS returns STATUS_END_OF_FILE for paged read.
Also remove a seemingly invalid ASSERT
2021-02-03 09:41:22 +01:00
Jérôme Gardou b46173edaf [NTOS/MM] DO not assert when being passed invalid parameters in MmCreateSection 2021-02-03 09:41:22 +01:00
Jérôme Gardou ba49c39041 [NTOS/MM] Assert there are no RMAP left before freeing the page 2021-02-03 09:41:22 +01:00
Jérôme Gardou d932bdb950 [NTOS:MM] Fix locking when paging out 2021-02-03 09:41:22 +01:00
Jérôme Gardou d8cdb89fb0 [NTOSKRNL] Overhaul Cc and Mm relationship
Previously, when creating a file section, Mm requested Cc to cache the file, then Cc would request pages from Mm, then Mm would request them back to serve its file-mapping role
Now, Mm does it all by itself. If file cahcing is requested by the FS driver, then Cc creates a file mapping and uses that to serve its purpose.

This is a rewrite of Cc
2021-02-03 09:41:22 +01:00
Jérôme Gardou e4047d1521 [NTOS/MM] Introduce MmArePagesResident and MmMakePagesResident 2021-02-03 09:41:22 +01:00
Jérôme Gardou f1631b44e1 [NTOS/MM] Introduce MmMapViewInSystemSpaceEx 2021-02-03 09:41:22 +01:00
Jérôme Gardou 4f6fd6c42b [NTOS/MM] Infer that the Memory Area is an image mapping from its VAD node 2021-02-03 09:41:21 +01:00
Jérôme Gardou c3bd70cfd1 [NTOSKRNL/MM] Fix a few wine tests 2021-02-03 09:41:21 +01:00
Jérôme Gardou 4abda863ce [NTOSKRNL/MM] Reduce use of MiIsRosSectionObject 2021-02-03 09:41:21 +01:00
Jérôme Gardou b7d988ae5b [NTOSKRNL] Get rid of MM_ROS_SECTION_OBJECT 2021-02-03 09:41:21 +01:00
Jérôme Gardou 8b98ff66ea [NTOSKRNL] Store File Object in the segment instead of Section object 2021-02-03 09:41:21 +01:00
Jérôme Gardou e980efebd4 [NTOSKRNL] Store the MM_IMAGE_SECTION_OBJECT pointer in SECTION::Segment 2021-02-03 09:41:21 +01:00
Jérôme Gardou c6a87f28bf [NTOSKRNL] Get rid of MEMORY_AREA::Protect
Use the VAD node instead
2021-02-03 09:41:21 +01:00
Jérôme Gardou c9f924940a [NTOSKRNL/MM] Get rid of useless members of MEMORY_AREA struct 2021-02-03 09:41:21 +01:00
Jérôme Gardou defbf63416 [NTOSKRNL] Use PSECTION struct where possible 2021-02-03 09:41:21 +01:00
Jérôme Gardou 462d9a0974 [NTOSKRNL] Unload the cargo: We only use tiny bits of "NEWCC" 2021-02-03 09:41:21 +01:00
Jérôme Gardou 25722e647e [NTOSKRNL] Embed a SECTION struct inside MM_ROS_SECTION_OBJECT 2021-02-03 09:41:21 +01:00
Jérôme Gardou c3ec5d801c [NTOSKRNL] Disable more unused code 2021-02-03 09:41:21 +01:00
Jérôme Gardou 10ac04ff6e [NTOSKRNL] Get rid of ROS_SECTION_OBJECT::AllocationAttributes in favor of MM_SECTION_FLAGS 2021-02-03 09:41:21 +01:00
Jérôme Gardou 819406ac97 [NTOSKRNL] Get rid of pagefile-backed sections support in legacy Mm 2021-02-03 09:41:21 +01:00
Jérôme Gardou 7afecee5eb [NTOSKRNL] Rename MM_ROS_SECTION_OBJECT:SectionPageProtection to InitialPageProtection 2021-02-03 09:41:21 +01:00
Jérôme Gardou 54c760574b [NTOSKRNL] Rename MM_ROS_SECTION_OBJECT:MaximumSize to SizeOfSection
For consistency with the SECTION struct
2021-02-03 09:41:21 +01:00
Jérôme Gardou 073ec9b0d4 [NTOSKRNL][NDK] Get rid of SECTION_OBJECT typedef
We will use the more recent SECTION (already used in ARM3) and this will avoid confusions
2021-02-03 09:41:21 +01:00
Jérôme Gardou 9b74e5ed4f [NTOSKRNL] Do not compile unused code 2021-02-03 09:41:21 +01:00
Jérôme Gardou 857dd4ae36 [NTOS:MM] Properly handle the 1-offset of paging files 2021-02-02 10:17:28 +01:00
George Bișoc 1903b568b6
[NTOS:SE] Implement SECURITY_TOKEN_PROXY_DATA, SECURITY_TOKEN_AUDIT_D… (#3432)
ProxyData and AuditData are pointers to an arbitrary data, which instead, they should point to their respective data structures. This serves as preparation for SepFreeProxyData and SepCopyProxyData functions implementations in the future (regarding the proxy data stuff specifically).

For further details:
https://www.vergiliusproject.com/kernels/x86/Windows%202003/SP2/_TOKEN
https://www.nirsoft.net/kernel_struct/vista/SECURITY_TOKEN_AUDIT_DATA.html
https://www.nirsoft.net/kernel_struct/vista/SECURITY_TOKEN_PROXY_DATA.html
https://www.nirsoft.net/kernel_struct/vista/PROXY_CLASS.html
2021-02-02 01:55:42 +03:00
Jérôme Gardou 158235bdd5 [NTOS:KE] Fix EIP only when the breakpoint is a break
Fixes ntdll:exception winetest crash
ROSTESTS-80
2021-02-01 16:39:39 +01:00
Hervé Poussineau 794f15e45f [NTOSKRNL] Fix link with GCC x64
KeLowerIrql/KeRaiseIrqlToDpcLevel/KfRaiseIrql are defined as FORCEINLINE in ntoskrnl/ke/amd64/irql.c
Use KxLowerIrql/KxRaiseIrqlToDpcLevel/KxRaiseIrql instead, which call their respective Ke*/Kf* counterparts.
2021-01-28 23:10:01 +01:00
Hervé Poussineau 9d110db433 [NTOS:KDBG] Support KDBG on x64 2021-01-28 20:44:21 +01:00
Hervé Poussineau ae4ce99e00 [ASM x64] Fix usage of macro .allocstack
.allocstack only accepts one 'size' parameter."
2021-01-28 20:31:16 +01:00
Victor Perevertkin 91fceab36e
[NTOS:IO][NTOS:PNP] Add PiActionAddBootDevices device action
During the boot process, it makes possible to initalize the driver's
devices right after the driver is loaded. Moreover, this way one can be
sure that all critical devices are initialized before the
IopMarkBootPartition call (because we explicitly call the driver's
AddDevice routine now, after each driver is loaded)

CORE-7826
2021-01-27 05:15:16 +03:00
Victor Perevertkin 798fc13b48
[NTOS:PNP] Implement NT5.2-like DEVICE_NODE state management
- Use DeviceNode->State field and its values, instead of
  DeviceNode->Flags for tracking current node state
- Change DNF_* flags to the ones compatible with Windows XP+
- Simplify state changes for device nodes and encapsulate all the logic
  inside the PiDevNodeStateMachine routine. This makes the ground for
  future improvements in the device removal sequence and
  resource management
- Now values inside DeviceNode->State and ->Flags are compatible with
  the windbg !devnode macro and can be tracked using it
- BUGFIX: fixed cases where IRP_MN_START_DEVICE or
  IRP_MN_QUERY_DEVICE_RELATIONS may be sent to a device after a
  IRP_MN_REMOVE_DEVICE

CORE-7826
2021-01-27 05:15:15 +03:00
Victor Perevertkin b704292808
[NTOS:IO] Add more enumeration requests during the boot process
This is to ensure that all needed devices are initialized during the
early boot

CORE-7826
2021-01-27 05:15:15 +03:00
Jérôme Gardou f63401060d [NTOS:MM] Fix compilation for amd64 port.
Addendum to 0919324772
2021-01-22 10:34:20 +01:00
Jérôme Gardou 0919324772 [NTOS:MM] Get rid of "compatibility layer" for hyper space mappings
Let's call that a bug layer instead.
2021-01-22 09:33:06 +01:00
Jérôme Gardou 57e8684bc6 [NTOS:MM] Allow "creating" a PDE in legacy Mm for foreign process 2021-01-22 09:32:36 +01:00
Alex Henrie 35f3034879
[NDK] "Reserved" member in SYSTEM_PROCESSOR_INFORMATION is "MaximumProcessors" for Windows 8+ (#3421)
Co-authored-by: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito@reactos.org>
2021-01-09 23:15:36 +01:00
Hervé Poussineau ff7035d940 [ASM x64] Change ; by /* */ for comments
Syntax with semi-colon is not supported by gas.
2021-01-07 21:12:11 +01:00
Hervé Poussineau e581123c35 [NTOSKRNL] Correctly use SEH2 macros (fixes GCC x64 compilation) 2021-01-05 19:24:23 +01:00
Jérôme Gardou c8d07514c8 [CMAKE] Fix GCC -fstack-protector usage 2021-01-05 13:38:57 +01:00
Victor Perevertkin e5254974d2
[NTOS:IO] Start loading drivers from the disk only after SystemRoot is initialized
Add another PnPBootDriversInitialized variable to indicate a point where
both disk subsystem and SystemRoot symlink are initialized, and use it
in a PiCallDriverAddDevice call.
2021-01-04 16:50:33 +03:00
Victor Perevertkin c4c0585f96
[NTOS:IO][NTOS:PNP] Implement PiCallDriverAddDevice
- Move the driver's name obtaining logic into the IopGetDriverNames
  function
- Create a new PiCallDriverAddDevice instead of PipCallDriverAddDevice
  and move it to pnpmgr/devaction.c file. Move around all its internal
  helpers too
- Support a proper Windows-compatible driver loading order for a PDO
  (lower filters, main service, upper filters, etc.)
- Set a correct Problem for the DeviceNode, in case of an error during
  driver loading
- Check the Start Type for all drivers before loading
- Do not try to load drivers during the early boot stage when there is
  no disk subsystem initialized
2021-01-04 16:50:33 +03:00
Victor Perevertkin 4c95339da0
[NTOS:IO] Refactoring of the driver initialization code (2)
- Do not hold the IopDriverLoadResource while trying to reference a
  driver object (but still acquire it when we actually need to load a
  driver)
- Change IopLoadDriver and IopInitializeDriverModule to use registry
  handle instead of a service name string and/or full registry path
- Do not try to reference a driver object inside IopLoadDriver. It's
  supposed to be done before the function call
2021-01-04 16:50:33 +03:00
Victor Perevertkin a6a3aa0f0d
[NTOS:IO] Refactor IopLoadUnloadDriver
- Split IopLoadUnloadDriver into IopLoadDriver and calling DriverUnload
- Schedule the worker for (un)loading driver in a separate routine
  (IopDoLoadUnloadDriver) this allows IopLoadDriver to be called
  separately (if we are sure that we're in the system process)
2021-01-04 16:50:32 +03:00
Victor Perevertkin e18a32df3a
[NTOS:IO] Refactoring of the driver initialization code
- Remove IopCreateDriver and put its code into IoCreateDriver and
  IopInitializeDriverModule. It's hard to extract a meaningful common
  part from it
- Refactor IopInitializeDriverModule. Extend and put the DriverName
  generation logic into it. Now this function frees the ModuleObject in
  case of failure and returns STATUS_FAILED_DRIVER_ENTRY in case of
  DriverInit failure (will be used later)
2021-01-04 16:50:32 +03:00
Victor Perevertkin 6f0e37b042
[NTOS:PNP][NTOS:IO] Do not create a device object + node on every driver load
- Remove the usage of IopCreateDeviceNode and change it to
  PipAllocateDeviceNode where required
2021-01-04 16:50:32 +03:00
Hermès Bélusca-Maïto b570fac18b
Happy New Year 2021 to the ReactOS Community!!
⚛️ 🍾 🥳 🎆 ☢️
2021-01-01 00:00:00 +01:00