[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; PLDR_DATA_TABLE_ENTRY LdrEntry;
PULONG_PTR HardErrorParameters; PULONG_PTR HardErrorParameters;
KIRQL OldIrql; KIRQL OldIrql;
#ifdef CONFIG_SMP
LONG i = 0;
#endif
/* Set active bugcheck */ /* Set active bugcheck */
KeBugCheckActive = TRUE; KeBugCheckActive = TRUE;
@ -1083,15 +1080,17 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
KeBugCheckOwner = Prcb->Number; KeBugCheckOwner = Prcb->Number;
/* Freeze the other CPUs */ /* 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 */ /* Send the IPI */
KiIpiSend(1 << i, IPI_FREEZE); KiIpiSend(AFFINITY_MASK(i), IPI_FREEZE);
KeStallExecutionProcessor(1000000);
} }
} }
/* Give the other CPUs one second to catch up */
KeStallExecutionProcessor(1000000);
#endif #endif
/* Display the BSOD */ /* Display the BSOD */