[NTOS:KE] Improve freeze code in KeBugCheckWithTf

- Don't wait 1 second for each processor
- Use AFFINITY_MASK
- Use Prcb->Number, which is more future proof than KeGetCurrentProcessorNumber
- Improve for loop
This commit is contained in:
Timo Kreuzer 2023-11-30 20:02:31 +02:00
parent d96f01b5dc
commit 1d289fec77

View file

@ -727,9 +727,6 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
PLDR_DATA_TABLE_ENTRY LdrEntry;
PULONG_PTR HardErrorParameters;
KIRQL OldIrql;
#ifdef CONFIG_SMP
LONG i = 0;
#endif
/* Set active bugcheck */
KeBugCheckActive = TRUE;
@ -1083,15 +1080,17 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
KeBugCheckOwner = Prcb->Number;
/* Freeze the other CPUs */
for (i = 0; i < KeNumberProcessors; i++)
for (ULONG i = 0; i < KeNumberProcessors; i++)
{
if (i != (LONG)KeGetCurrentProcessorNumber())
if (i != Prcb->Number)
{
/* Send the IPI and give them one second to catch up */
KiIpiSend(1 << i, IPI_FREEZE);
KeStallExecutionProcessor(1000000);
/* Send the IPI */
KiIpiSend(AFFINITY_MASK(i), IPI_FREEZE);
}
}
/* Give the other CPUs one second to catch up */
KeStallExecutionProcessor(1000000);
#endif
/* Display the BSOD */