Commit graph

1669 commits

Author SHA1 Message Date
Hervé Poussineau 9e43518da5 [NTOS:PO] Set SystemBatteriesPresent when having a battery device in the system
This is (at least) used by powercfg.cpl to know if it needs to display some additional pages.
2024-02-05 18:04:02 +01:00
Hervé Poussineau dff8b93ee2 [NTOS:PO] Give the power device type to PopAddRemoveSysCapsCallback function 2024-02-05 18:04:02 +01:00
Oleg Dubinskiy 5abf0c76b7
[NTOS:KE/x86/arm] Use a better boot process affinity value (#6399)
Use a value that is independent of the CPU bitness.
Addendum to commit 96d5b6281
2024-01-24 17:52:56 +01:00
Justin Miller 748a2e1655
[NTOS] Fix boot on UP build - PrcbLocks are not used on UP (#6391)
On the uniprocessor kernel KiAcquirePrcbLock is a stub that doesn't modify the current Prcb's PrcbLock value.
Quickly protect this assert around CONFIG_SMP
2024-01-20 08:59:13 -08:00
Oleg Dubinskiy ab528ac6ae
[NTOS:KE] Acquire PRCB lock before marking thread ready for execution in dispatch interrupt routine (#6387)
Fixed in x86 and ARM (this was already done in x64).

This is needed because thread preparation routine KxQueueReadyThread()
releases PRCB lock, but does not acquire it, so that the locking must
always be done outside the function, same as in all its other usage cases.
This fixes an assert from release PRCB routine, when booting x86 ReactOS
in SMP mode, because it attempts to release the lock when it is not
actually acquired.

Addendum to commit a011d19ed.

+ Add an assert in KxQueueReadyThread() to ensure the PRCB lock is actually acquired.
2024-01-20 15:58:39 +01:00
Oleg Dubinskiy f72d6dd4c5
[NTOS:KE] Set IRQL to SYNCH_LEVEL when exiting from idle after the thread is ready for execution (#6386)
CORE-1697

Raise IRQL to SYNCH_LEVEL when exiting from the idle thread in the
idle loop, in case it is scheduled for execution. Then restore it
back to DISPATCH_LEVEL, after this is done.
This behaviour is a bit similar to the way it's done on x64.

This IRQL raise is necessary only in SMP builds.
Calls are placed in CONFIG_SMP ifdef: this avoids unnecessary IRQL
changes on UP, since SYNCH_LEVEL and DISPATCH_LEVEL are identical
there, unlike in MP, where SYNCH_LEVEL is IPI_LEVEL - 2 actually.

This prevents bugcheck DRIVER_IRQL_NOT_LESS_OR_EQUAL when booting
SMP x86 ReactOS, in KiTimerExpiration when calling it 2nd time.
The BSOD happened due to IRQL levels mismatch.
2024-01-20 15:55:20 +01:00
Timo Kreuzer 9c1cfe0587 [NTOS:KE] Fix initialization of node block for application processors
- Initialize KeNodeBlock[0] statically
- Update Prcb->ParentNode->ProcessorMask for all processors
2024-01-18 22:41:46 +01:00
Hermès Bélusca-Maïto feb67576dd
[NTOS:CM][CMLIB] In PE mode, allow registry hives (except system ones) to use read/write access.
+ Improve related comments.

Registry hives are opened in shared read access when NT is loaded in PE
mode (MININT) or from network (the hives residing on a network share).
This is true in particular for the main system hives (SYSTEM, SOFTWARE,
DEFAULT, ...).

However, in PE mode, we can allow other hives, e.g. those loaded by the
user (with NtLoadKey) to be loaded with full read/write access, since we
boot from a local computer.
2024-01-17 22:13:03 +01:00
Hermès Bélusca-Maïto 793ee786cd
[NTOS:CM] Initially start the registry in read-only mode.
Disable registry hive writes, until the IO subsystem is initialized
and disk access is enabled (when the SM signals so after AUTOCHK).
2024-01-17 22:09:45 +01:00
Hermès Bélusca-Maïto 76f1da5631
[NTOS:CM][CMLIB] Minor code styling
In particular remove some extra-parentheses around single code tokens,
and replace few "DPRINT1 + while (TRUE);" by UNIMPLEMENTED_DBGBREAK.

+ Improve some comments.
2024-01-17 22:09:37 +01:00
Timo Kreuzer 96d5b6281d [NTOS:KE/x64] Fix boot process affinity 2024-01-16 08:15:53 +01:00
Timo Kreuzer 1ee23d33ac [NTOS:KE] Fix some KAFFINITYs 2024-01-16 08:15:53 +01:00
Hermès Bélusca-Maïto a70ce994f0
🎊 🍾 🥳 Happy New Year 2024 to the ReactOS Community! 🎆 ⚛️ ☢️
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.██████╗  ██████╗ ██████╗ ██╗  ██╗
 __,  ,__)            __,  ,__)       __, ,__)         ╚════██╗██╔═████╗╚════██╗██║  ██║
(--|__| _ ,_ ,_      (--|\ | _       (--\ | _  _ ,_     █████╔╝██║██╔██║ █████╔╝███████║
  _|  |(_||_)|_)(_|    _| \|(/_(_|_)     \|(/_(_||     ██╔═══╝ ████╔╝██║██╔═══╝ ╚════██║
 (        |  |  ,_|   (                (__|            ███████╗╚██████╔╝███████╗     ██║
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.╚══════╝ ╚═════╝ ╚══════╝     ╚═╝
2024-01-01 00:00:00 +01:00
Hermès Bélusca-Maïto 434ac241df
[NTOS:INBV:PO] Consolidate shutdown logo routines where all the boot theming is implemented.
And it's late now, but... Merry Christmas 2023 as well! 🎄
Logo design by contributor 'TheCustomFHD'

"From ReactOS with Love" ;^)
2023-12-25 21:43:20 +01:00
Hermès Bélusca-Maïto 6d265d1fd8
[NTOS:INBV] Isolate the bitmap resources pertaining to the boot theme/animation into their resource sub-file. 2023-12-24 22:39:36 +01:00
Hermès Bélusca-Maïto 0f3da97456
[NTOS:KE:EX] Fix comment typo. 2023-12-24 22:39:35 +01:00
Hermès Bélusca-Maïto 7b410fb8ca
[NTOS:INBV] Don't hardcode the off-screen rot-bar-bits buffer size. 2023-12-24 21:54:24 +01:00
Hermès Bélusca-Maïto 81dc30a434
[NTOS:INBV] Improve comment & define name. 2023-12-24 21:54:23 +01:00
Hermès Bélusca-Maïto 7aec73a76c
[NTOS:INBV] Minor code style. 2023-12-24 21:54:16 +01:00
Hermès Bélusca-Maïto 3812996042
[NTOS:INBV] Fix build when INBV_ROTBAR_IMPLEMENTED is not defined. 2023-12-24 21:40:36 +01:00
Ratin Gao ffb20d3330
[REACTOS] Fix typos (#6198)
- Adress -> Address
- Currupted -> Corrupted

3rd-party files are not modified.
2023-12-23 21:37:08 +01:00
Timo Kreuzer 1831bc6add [NTOS:KE/x64] Implement initial IPI code 2023-12-18 23:16:39 +02:00
Serge Gautherie 1244659d4c
[NTOSKRNL] Remove remnant internal/arm/asmmacro.S (#6052)
Addendum to 6212c82 (r67715).
2023-12-14 13:48:31 +00:00
Timo Kreuzer e5c5efe2ad [NTOS:KE/x64] Set the idle thread's IdealProcessor for application processors 2023-12-08 20:16:51 +02:00
Timo Kreuzer b1a9e72e92 [NTOS:KE/x64] Do not call HalInitSystem from application processors 2023-12-08 20:16:51 +02:00
Timo Kreuzer d0f6874d92 [NTOS:KE/x64] Factor out KiIntializeProcessorBootStructures 2023-12-08 20:16:51 +02:00
Timo Kreuzer 8c466c3e36 [NTOS:KE/x64] Improve KiInitializePcr 2023-12-08 20:16:51 +02:00
Timo Kreuzer d2a3b1c791 [NTOS:KE/x64] Factor out KiInitializeP0BootStructures 2023-12-08 20:16:51 +02:00
Timo Kreuzer e655594609 [NTOS:KE/x64] (Re)move initialization of IRQL and TR 2023-12-08 20:16:51 +02:00
Timo Kreuzer 0a7255e4bf [NTOS:KE/x64] Move Initialization of TSS 2023-12-08 20:16:51 +02:00
Timo Kreuzer 160980aba1 [NTOS:KE/x64] Move initialization of PCR 2023-12-08 20:16:51 +02:00
Timo Kreuzer ba62dd0aaa [NTOS:KE/x64] Move initialization of KeLoaderBlock 2023-12-08 20:16:51 +02:00
Timo Kreuzer e1497d43d7 [NTOS:KE/x64] Improve KiInitializeTss 2023-12-08 20:16:51 +02:00
Timo Kreuzer bbe16859b5 [NTOS:KE/x64] Rename P0 boot stacks 2023-12-08 20:16:51 +02:00
Timo Kreuzer 6c5b3f203d [NTOS:KE/x64] Add back a stubs.c file 2023-12-08 19:38:59 +02:00
Timo Kreuzer 57c7f06004 [NTOS:KE/x64] Rename stubs.c to traphandler.c 2023-12-08 19:38:59 +02:00
Timo Kreuzer d87b45bee7 [NDK] Add Affinity helper inline functions 2023-12-08 19:28:57 +02:00
Hermès Bélusca-Maïto 2f0a5e546f
[NTOS:KE] Don't hardcode pool tag and TSS flag values (#6051)
Co-authored-by: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com>
2023-12-03 17:33:10 +01:00
Eric Kohl d8ba5920a2 [NTOS:PNP][UMPNPMGR] GUID_DEVICE_ENUMERATED should be a DeviceInstallEvent
- Move the GUID_DEVICE_ENUMERATED event from the TargetDeviceChangeEvent category to the DeviceInstallEvent category
- Create a new function that handles DeviceInstallEvent category events
2023-12-03 14:00:34 +01:00
Timo Kreuzer f92c44b217 [NTOS:KE] Remove KiMask32Array
It's useless and also broken in the way it is used. Replace it with a simple shift and make it correct for 64 bit.
2023-11-30 13:03:52 +02:00
Eric Kohl 12a5971b7a [NTOS:PNP] Queue a device change event on interface enable or disable 2023-11-27 22:36:52 +01:00
Serge Gautherie b386ea728f [NTOSKRNL] Remove unused internal/amd64/asmmacro.S
Added, but never(?) used.

Addendum to 99e6ad7 (r46620).
2023-11-27 22:51:51 +02:00
Justin Miller 516ccad340
[NTOS:KE][HALX86] Implement AP startup code (#5879)
Co-authored-by: Victor Perevertkin <victor.perevertkin@reactos.org>

Introduce the initial changes needed to get other processors up and into kernel mode. 
This only supports x86 as of now but is the first real step towards using other system processors.
2023-11-19 15:51:33 -08:00
George Bișoc f3141fb29e
[NTOS:CM] Implement support for alternate registry hives
Sometimes repairing a broken hive with a hive log does not always guarantee the hive
in question has fully recovered. In worst cases it could happen the LOG itself is even
corrupt too and that would certainly lead to a total unbootable system. This is most likely
if the victim hive is the SYSTEM hive.

This can be anyhow solved by the help of a mirror hive, or also called an "alternate hive".
Alternate hives serve the purpose as backup hives for primary hives of which there is still
a risk that is not worth taking. For now only the SYSTEM hive is granted the right to have
a backup alternate hive.

=== NOTE ===

Currently the SYSTEM hive can only base upon the alternate SYSTEM.ALT hive, which means the
corresponding LOG file never gets updated. When time comes the existing code must be adapted
to allow the possibility to use .ALT and .LOG hives simultaneously.
2023-11-19 20:44:29 +01:00
George Bișoc 27917c14ed
[NTOS:CM] Flush the dirty data to disk if the SYSTEM hive has been recovered by FreeLdr
If FreeLdr performed recovery against the SYSTEM hive with a log, all of its data is only present in volatile memory thus dirty. So the kernel is responsible to flush all the data that's been recovered within the SYSTEM hive into the backing storage.
2023-11-19 20:44:29 +01:00
George Bișoc d2b8b9ec96
[NTOS:CM] Use the appropriate flags on functions that will call CmCheckRegistry & add missing CmCheckRegistry calls
In addition to that, in some functions like CmFlushKey, CmSaveKey and CmSaveMergedKeys we must validate the underlying hives as a matter of precaution that everything is alright and we don't fuck all the shit up.
2023-11-19 20:44:27 +01:00
George Bișoc f33da480af
[SDK][CMLIB] Implement CmCheckRegistry and validation private helpers
CmCheckRegistry is a function that provides the necessary validation checks for a registry hive. This function usually comes into action when logs have been replayed for example, or when a registry hive internals have changed such as when saving a key, loading a key, etc.

This commit implements the whole Check Registry infrastructure (cmcheck.c) in CMLIB library for ease of usage and wide accessibility across parts of the OS. In addition, two more functions for registry checks are also implemented -- HvValidateHive and HvValidateBin.

Instead of having the CmCheckRegistry implementation in the kernel, it's better to have it in the Configuration Manager library instead (aka CMLIB). The benefits of having it in the library are the following:

- CmCheckRegistry can be used in FreeLdr to fix the SYSTEM hive
- It can be used on-demand in the kernel
- It can be used for offline registry repair tools
- It makes the underlying CmCheckRegistry implementation code debug-able in user mode

CORE-9195
CORE-6762
2023-11-19 20:44:27 +01:00
George Bișoc bfcb28787d
[NTOS:CM] Disable hard errors when setting up a new size for a hive file / annotate CmpFileSetSize parameters with SAL
During a I/O failure of whatever kind the upper-level driver, namely a FSD, can raise a hard error and a deadlock can occur. We wouldn't want that to happen for particular files like hives or logs so in such cases we must disable hard errors before toying with hives until we're done.

In addition to that, annotate the CmpFileSetSize function's parameters with SAL.
2023-11-19 20:44:26 +01:00
George Bișoc 0d776beac9
[NTOS:CM] Ignore syncing/flushing requests after registry shutdown
When shutting down the registry of the system we don't want that the registry in question gets poked again, such as flushing the hives or syncing the hives and respective logs for example. The reasoning behind this is very simple, during a complete shutdown the system does final check-ups and stuff until the computer
shuts down.

Any writing operations done to the registry can lead to erratic behaviors. CmShutdownSystem call already invokes a final flushing of all the hives on the backing storage which is more than enough to ensure consistency of the last session configuration. So after that final flushing, mark HvShutdownComplete as TRUE indicating
that any eventual flushing or syncying (in the case where HvSyncHive gets called) request is outright ignored.
2023-11-19 20:44:26 +01:00
Timo Kreuzer bf95b7e8e5 [NTOS:CC] Do not access VACB after decrementing it's reference count
It might already be deleted by a different thread.
2023-11-17 20:07:55 +02:00