Commit graph

86727 commits

Author SHA1 Message Date
Timo Kreuzer
60cffeb033 HACK [BOOTDATA] Make setup boot with MP 2025-02-01 16:36:33 +02:00
Hermès Bélusca-Maïto
129f10ea26 [TASKMGR] Cherry pick Hermes fixes
** WIP ** [TASKMGR] Get rid of thread-oriented updates. Just do it synchronously on WM_TIMER.

** WIP ** Merge RefreshPerformancePage() and PerformancePageRefreshThread(), now that we removed the separate performance page refreshing thread.

- Use _ui64tow() instead of _ultow() for converting ULONGLONGs into
  a string representation.

- Isolate the update of the status bar.

- Isolate the actual graphs redrawing. The idea for later is to not
  trigger any redrawings (and run unnecessary code) if the page is deactivated.

[TASKMGR] No need to get and save global handles for all the controls in the performance page.

... and especially for controls that are used only in one place.
Only handles to the graph controls are sufficient. For the others,
we can manage by using dialog control IDs.

- Rename AdjustFrameSize() 'pos' parameter to be more explicit.

** WIP ** Group trios of Memory performance getters together, as they are always used in succession.

- Group PerfDataGetCommitCharge[Total|Limit|Peak]K() together into
  PerfDataGetCommitChargeK().

- Group PerfDataGetKernelMemory[Total|Paged|NonPaged]K() together
  into PerfDataGetKernelMemoryK().

- Group PerfDataGetPhysicalMemory[Total|Available|SystemCache]K()
  together into PerfDataGetPhysicalMemoryK().

- Use these new Mem performance getters.

[TASKMGR] Use owner-drawn performance graphs.

- Use owner-drawn buttons to implement correct graph painting while
  maintaining the 3D appearance. As done on Windows (TM)

  Why using buttons (that should be disabled btw.)?
  Because we want, if the graphs fail to be created (due to e.g.
  lack of resources), to show a descriptive label of what's missing.

  This also allow the graphs to be drawn **properly** inside a 3D-border window.

- Redraw graphs on WM_DRAWITEM.

- Don't need to subclass button controls.

- Use DeferWindowPos() to avoid controls blinking on resize.

- Fix the problem of the buttons resizing as "1/x": this was due to
  the fact, using GetClientRect + Mapping, did't take the border into
  account. Instead, use GetWindowRect + a different coord mapping to
  fix all that.

- Remove some dead code.

- Rename the remaining ridiculously long variable names.

** WIP ** CPU/Mem meters: keep a separate copy of the CPU/Mem perf values.

+ Use structure for keeping state.

** WIP ** Add support for multiple-CPU stats. (In progress, needs code cleanup.)

In particular, use SystemProcessorTimeInfo to calculate the idle time
as done in ROSAPPS' ctm.exe, see commit c0873723.

See also https://ladydebug.com/blog/codes/cpuusage_win.htm

+ Fix the problem of NtQuerySystemInformation(SystemPerformanceInformation)
  that shows up when running a 32-bit build under Windows 7 x64.

** WIP ** Investigating showing physical memory in the MEM gauge.
2025-02-01 16:36:33 +02:00
Timo Kreuzer
b036b616ea HACK HACK HACK: disable an ASSERT
We need proper IPIs to flush the TLB
2025-02-01 16:36:32 +02:00
Timo Kreuzer
5faf6ed339 WIP [NTOS:KE/x64] Handle NewThread == OldThread in KiIdleLoop 2025-02-01 16:36:32 +02:00
Timo Kreuzer
e118c6a769 WIP KiIdleLoop PrcbLock 2025-02-01 16:36:31 +02:00
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
baa82a4d4f [HALx86] Mask profiling interrupt on init 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
98baac1ea2 [HAL] Use physical addressing in HalEnableSystemInterrupt 2025-02-01 16:36:28 +02:00
Timo Kreuzer
3f76942fd5 [SDK] Improve definition of (RTL_)CRITICAL_SECTION_DEBUG 2025-02-01 16:36:28 +02:00
Timo Kreuzer
90dce9340c [NTDLL] check for NULL buffer in LdrpLoadDll
This happens in advapi32_apitest in Test_CreateOpenKey.
2025-02-01 16:36:21 +02:00
Timo Kreuzer
486ab63862 [RPCRT4] Add SEH to avoid leaking locks / memory 2025-02-01 15:24:56 +02:00
Timo Kreuzer
daf557b245 [RTL/x64] Fix a bug in RtlpUnwindInternal
Check if the stack pointer is out of bounds, before trying to unwind a frame. This will not fix any crashes, but it prevents simple crashes from going into a recursive exception.
2025-02-01 15:24:56 +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
Timo Kreuzer
de3a6706e7 [UCRT] fenv.h: Fix GCC build of _Fenv1 2025-01-30 11:30:32 +02:00
Timo Kreuzer
a438d7c3b8 [UCRT] Add GCC compatible definition of _CRT_STDIO_INLINE
In C99 mode GCC emits global symbols for inline functions, as soon as the compilation unit contains a declaration that marks the function as "extern". A number of functions like printf are implicitly declared as extern by GCC, which seemingly cannot be disabled. This would lead to the inline function being emitted as a global symbol in every compilation unit. Using static inline prevents duplicate symbol errors.
2025-01-30 11:30:32 +02:00
Timo Kreuzer
4ca68ffb1c [UCRT] Make __local_stdio_printf/scanf_options GCC compatible 2025-01-30 11:30:32 +02:00
Timo Kreuzer
bb9392e4e1 [CMAKE] Define _CRT_SUPPRESS_RESTRICT on GCC builds
This prevents the use of __declspec(restrict) in UCRT headers.
2025-01-30 11:30:32 +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
Katayama Hirofumi MZ
2f23e70ad5
Revert "[NTUSER] Enable SM_CXICON etc. settings from registry (#7679)" (#7682)
This reverts commit 3b3741c10a of #7679 .
It seems like the shell icon size is not the
system icon size.

The wide string L"Shell Small Icon Size" is detected in
shell32.dll and themeui.dll.
No L"Shell Small Icon Size" in win32k.sys found.
JIRA issue: CORE-12905
2025-01-29 21:34:19 +09:00
Katayama Hirofumi MZ
3b3741c10a
[NTUSER] Enable SM_CXICON etc. settings from registry (#7679)
Improve usability.
JIRA issue: CORE-12905
- Add nIconSize and nSmallIconSize
  values to SPIVALUES structure.
- Load "Shell Icon Size" and "Shell
  Small Icon Size" values from registry.
- Enable changing of SM_CXICON,
  SM_CYICON, SM_CXSMICON, and
  SM_CYSMICON settings.
2025-01-29 20:20:25 +09:00
Justin Miller
a8da29e888
[ACPI] Move CMBATT and COMPBATT out of the acpi directory (#7599)
Move these out of ACPI in preparation for ACPI_NEW so they keep their juicy commit history.
Also both ACPIs can coexist for awhile as I don't see the old driver getting removed anytime soon.
2025-01-29 00:49:35 -08:00
Whindmar Saksit
b35becef2e
[RAPPS] Set working directory for zip generated shortcuts (#7674)
Some applications are broken and assume the working directory is the
same as the .exe directory (xrick etc).
2025-01-29 00:46:11 +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