Commit graph

1847 commits

Author SHA1 Message Date
Timo Kreuzer
8c66cce23c WIP add a bunch of ASSERTs 2025-02-01 16:36:31 +02:00
Timo Kreuzer
bcbc2c8700 [NTOS:KE] Handle SwapBusy in x64 KiIdleLoop 2025-02-01 16:36:31 +02:00
Timo Kreuzer
3b026627e9 WIP [NTOS:KE/x64] Properly handle KiIdleSummary
TODO: Remove the chunk from KiSystemStartupBootStack? Shouldn't be needed.
What about other instances of KiIdleSummary?
2025-02-01 16:36:31 +02:00
Timo Kreuzer
ea711415c4 [NTOS:KE/x64] Lower IRQL to passive while running idle function 2025-02-01 16:36:30 +02:00
Timo Kreuzer
2559827ffa [NTOS:KE/x64] Ignore DPCs from the idle loop
This is handled in the idle loop itself. The idle loop must not be preempted from a DPC.
2025-02-01 16:36:30 +02:00
Timo Kreuzer
e9ef091f0e [NTOS:IO] Fix affinity of PsInitialSystemProcess
Add a hack to work around SMP-incompatible drivers
2025-02-01 16:36:29 +02:00
Timo Kreuzer
36829a6bd9 [NTOS:KE/x64] Move initialization of KeActiveProcessors 2025-02-01 16:36:29 +02:00
Timo Kreuzer
323f18e446 [HAL][NTOS] Implement x64 SMP startup code
TODO: fix lgdt macro to work with GAAS and ML
Works with PIIX3 and cdrom on AHCI or SCSI controller
When cdrom is on IDE controller it doesn't seem to work
2025-02-01 16:36:28 +02:00
Timo Kreuzer
160bc8a0ce [NTOS:KE] Skip an "optimization" on SMP 2025-01-30 19:57:47 +02:00
Timo Kreuzer
fcb5d27141 NTOS:KE] Make KiSetAffinityThread SMP ready 2025-01-30 19:57:06 +02:00
Timo Kreuzer
9a94ad01f6 [NTOS:KE] Implement KiFindIdealProcessor 2025-01-30 19:57:06 +02:00
Timo Kreuzer
eddfdc756f [NTOS:KE] Select proper processor in KiDeferredReadyThread 2025-01-30 19:57:06 +02:00
Hervé Poussineau
70bf3bb8fa [NTOS:KDBG] Add back 'cregs' command
This command was removed in commit baa47fa5e0
because there was no way to get the CRx registers from a CONTEXT structure.
Previous code was also displaying current GDTR/LDTR and IDT.

Rewrite the code to use KdSystemDebugControl(SysDbgReadControlSpace, ...)
to get CRx, GDTR/LDTR and IDT values just before entering debugger.
2025-01-29 18:25:24 +01:00
Hervé Poussineau
b9852e83d2
[NTOS:EX] HACK: on livecd, disable security features in NtSystemDebugControl
WinDBG can do some local debugging using 'windbg -kl'. In that case,
WinDBG tries to directly use NtSystemDebugControl. If this function
returns an error, WinDBG extracts a driver from its resources.
WinDBG will send IOCTLs to this driver, and this driver will call
KdSystemDebugControl.

However, on livecd (where %SYSTEMROOT% is read-only), WinDBG is unable
to extract the driver from its resources, and can't use the driver to
call KdSystemDebugControl.

As a work-around, allow all control classes in NtSystemDebugControl
in case of livecd.
WinDBG local debugging now also works on livecd (windbg -kl).
2025-01-28 22:00:56 +01:00
Hervé Poussineau
5547b74717
[NTOS:KD64] Fix freezes on first chance exception when KDBG is enabled and KdIgnoreUmExceptions is TRUE
This fixes the following use case:
- Execute 'kdbgctrl.exe -du'
- Execute 'kdbgctrl.exe -cu'
- See that last command never finishes
2025-01-28 22:00:55 +01:00
Hermès Bélusca-Maïto
7068a790b2
[NTOS:KD64] Add a missing KdEnteredDebugger reset in KdExitDebugger() 2025-01-28 22:00:54 +01:00
Hervé Poussineau
6b89a0da11
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetKdBlockEnable/SysDbgSetKdBlockEnable 2025-01-28 22:00:53 +01:00
Hervé Poussineau
d4546753f6
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetKdUmExceptionEnable/SysDbgSetKdUmExceptionEnable 2025-01-28 22:00:53 +01:00
Hervé Poussineau
734a043b22
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetPrintBufferSize 2025-01-28 22:00:51 +01:00
Hervé Poussineau
4dc0e5cc81
[NTOS:EX] Implement NtSystemDebugControl: SysDbgGetAutoKdEnable/SysDbgSetAutoKdEnable 2025-01-28 22:00:50 +01:00
Hervé Poussineau
4bae44e412
[NTOS:EX] Implement NtSystemDebugControl: SysDbgEnableKernelDebugger/SysDbgDisableKernelDebugger 2025-01-28 22:00:49 +01:00
Hervé Poussineau
7b4d618994
[NTOS:EX] Implement NtSystemDebugControl: SysDbgBreakPoint 2025-01-28 22:00:48 +01:00
Hervé Poussineau
1db1bceaa7
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgCheckLowMemory 2025-01-28 22:00:48 +01:00
Hervé Poussineau
2fe3de6c69
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadBusData/SysDbgWriteBusData 2025-01-28 22:00:47 +01:00
Hervé Poussineau
19046a253b
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadMsr/SysDbgWriteMsr 2025-01-28 22:00:46 +01:00
Hervé Poussineau
b187662f39
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadIoSpace/SysDbgWriteIoSpace 2025-01-28 22:00:46 +01:00
Hervé Poussineau
0589c178ba
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadControlSpace/SysDbgWriteControlSpace 2025-01-28 22:00:45 +01:00
Hervé Poussineau
42e038f227
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadPhysical/SysDbgWritePhysical 2025-01-28 22:00:43 +01:00
Hervé Poussineau
2efaa5ea1e
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgReadVirtual/SysDbgWriteVirtual 2025-01-28 22:00:42 +01:00
Hervé Poussineau
9f97f0b284
[NTOS:KD64] Implement KdSystemDebugControl: SysDbgQueryVersion 2025-01-28 22:00:40 +01:00
Hervé Poussineau
6338d51353
[NTOS:EX] In NtSystemDebugControl, check for SeDebugPrivilege 2025-01-28 22:00:39 +01:00
Hervé Poussineau
9e7c3770e3
[NTOS:EX] Improve NtSystemDebugControl
- Add SEH probing for user buffer
- Mark some classes as i386 only
- Explicitly return STATUS_NOT_IMPLEMENTED on disabled classes (must use KdSystemDebugControl instead)
- Explicitly return STATUS_NOT_IMPLEMENTED on not implemented classes
- Return STATUS_INVALID_INFO_CLASS on all other classes
2025-01-28 22:00:38 +01:00
Hervé Poussineau
0f36ef3392
[NTOS:KD64] Improve KdSystemDebugControl
- Explicitly return STATUS_NOT_IMPLEMENTED on not implemented classes
- Return STATUS_INVALID_INFO_CLASS on all other classes
2025-01-28 22:00:37 +01:00
Hermès Bélusca-Maïto
a0b009f1ed
[NTOS:EX:KD64] Add Doxygen documentation for Nt/KdSystemDebugControl.
Based from external documentation:
https://www.ivanlef0u.tuxfamily.org/?p=21
https://www.ivanlef0u.tuxfamily.org/?p=382
http://pds8.egloos.com/pds/200807/09/51/Subverting_Windows_2003_Service_Pack_1_Kernel_Integrity_Protection.pdf
http://www.nynaeve.net/?p=114
https://media.defcon.org/DEF%20CON%2030/DEF%20CON%2030%20presentations/Eran%20Segal%20-%20The%20COW%20%28Container%20On%20Windows%29%20Who%20Escaped%20the%20Silo.pdf
https://vidstromlabs.com/blog/memory-dumping-with-ntsystemdebugcontrol/
https://www.kernelmode.info/forum/viewtopic0aa3.html?t=5317
2025-01-28 22:00:36 +01:00
Hermès Bélusca-Maïto
317f1e8391
[NDK][NTOS:EX:KD64] Add SAL annotations to Kd/Nt/ZwSystemDebugControl. 2025-01-28 22:00:35 +01:00
Hermès Bélusca-Maïto
5d78952024
[NTOS:KD64] Simplify some code in debugging helpers 2025-01-28 22:00:34 +01:00
Hermès Bélusca-Maïto
1c61d4ce90
[NTOS:KD64] Add annotations to debugger control routines used in Kd/Nt/ZwSystemDebugControl 2025-01-28 22:00:33 +01:00
Hervé Poussineau
20bd5e8a9c
[NTOS:MM] Allow not providing MMDBG_COPY_UNSAFE in MmDbgCopyMemory
Replace an assert by a log, as this works most of the times.
2025-01-28 22:00:31 +01:00
Hervé Poussineau
69cd1e107a
[NTOS:EX] Allow calling ExLockUserBuffer up to DISPATCH_LEVEL 2025-01-28 22:00:30 +01:00
Hervé Poussineau
d8e25f06b1
[NTOS:EX] Add prototypes for ExLockUserBuffer/ExUnlockUserBuffer 2025-01-28 22:00:29 +01:00
Hermès Bélusca-Maïto
5962c44511
[NTOS:IO] Fix a typo in comment 2025-01-28 15:29:39 +01:00
Katayama Hirofumi MZ
fe11f7a2e5
[REACTOS] Refresh old URLs (#7632)
URLs are getting old. We have to
update URLs for documentation
purpose.
JIRA issue: CORE-19963
- Refresh old URLs.
- Add " (DEAD_LINK)" labels
  to dead links.
- Use MS Learn links rather
  than MSDN ones.
- Some dead links revived by
  Web Archive.
- Don't change Wine Tests
  and Wine Sync.
- Don't change 3rd party libraries.
- Don't append "redirected" labels.
2025-01-28 13:36:45 +09:00
Timo Kreuzer
647b518bd3 [NTOS:MM] Fix process affinity in MmCreatePeb 2025-01-25 16:33:27 +02:00
Timo Kreuzer
c07fba4508 [NTOS:KE] Make KeQueryActiveProcessors portable and non-paged
In Windows Vista and later, this routine can be called at any IRQL.
2025-01-24 18:38:34 +02:00
Hermès Bélusca-Maïto
a857b28008
[NTOS:INBV] We are now past Christmas time. 2025-01-22 17:30:43 +01:00
Timo Kreuzer
85f42a25d5 [NTOS:KE/x64] Improve freeze code
- Set ACTIVE flag on freeze owner like on Windows
- Add a nice state graph
- Change license to MIT
2025-01-22 14:04:18 +02:00
Hermès Bélusca-Maïto
0e01cbc6cd
[NTOS:IO] IoVolumeDeviceToDosName(): Fix returned DosName buffer initialization (#6990)
The VolumePath buffer returned by IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH
contains one string stored as a multi-NUL-terminated string, whose
total length is given by its `MultiSzLength` member.

The DosName UNICODE_STRING just returns the (single) string as a normal
NUL-terminated string. So, we need to remove the two NUL-terminators
from the `MultiSzLength` count to retrieve the correct length.
2025-01-21 19:16:03 +01:00
Hermès Bélusca-Maïto
f315111bb5
[NTOS:IO] Improve some comments in IoVolumeDeviceToDosName()
Addendum to commit 5afb7ab003.
2025-01-21 19:16:02 +01:00
Vincent Franchomme
6ada5978d0
[NTOS:MM] Do not use PAGE_ROUND_DOWN for LONGLONG values (#7603)
PAGE_ROUND_DOWN macro seems to not work correctly with LONGLONG values. It creates some random freezes in the 1st-stage setup after commit 69bf140506.
It's fixed by creating PAGE_ROUND_UP_64 and PAGE_ROUND_DOWN_64 macros for 64-bit only data types.

---------

Co-authored-by: Thamatip Chitpong <thamatip.chitpong@reactos.org>
2025-01-16 10:30:38 +07:00
Thamatip Chitpong
190f710942 [NTOS:MM] MiBalancerThread: Formatting fixes 2025-01-15 16:10:55 +07:00