https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d0f6874d920fc56b56991…
commit d0f6874d920fc56b5699149159c45f7e5b868672
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat Dec 2 16:50:17 2023 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Dec 8 20:16:51 2023 +0200
[NTOS:KE/x64] Factor out KiIntializeProcessorBootStructures
---
ntoskrnl/ke/amd64/kiinit.c | 58 ++++++++++++++++++++++++++++++++++------------
1 file changed, 43 insertions(+), 15 deletions(-)
diff --git a/ntoskrnl/ke/amd64/kiinit.c b/ntoskrnl/ke/amd64/kiinit.c
index 742650b98cf..54d4d13815a 100644
--- a/ntoskrnl/ke/amd64/kiinit.c
+++ b/ntoskrnl/ke/amd64/kiinit.c
@@ -270,6 +270,38 @@ KiInitializeTss(
Tss->Ist[3] = (ULONG64)NmiStack;
}
+CODE_SEG("INIT")
+VOID
+KiInitializeProcessorBootStructures(
+ _In_ ULONG ProcessorNumber,
+ _Out_ PKIPCR Pcr,
+ _In_ PKGDTENTRY64 GdtBase,
+ _In_ PKIDTENTRY64 IdtBase,
+ _In_ PKTSS64 TssBase,
+ _In_ PKTHREAD IdleThread,
+ _In_ PVOID KernelStack,
+ _In_ PVOID DpcStack,
+ _In_ PVOID DoubleFaultStack,
+ _In_ PVOID NmiStack)
+{
+ /* Initialize the PCR */
+ KiInitializePcr(Pcr,
+ ProcessorNumber,
+ GdtBase,
+ IdtBase,
+ TssBase,
+ IdleThread,
+ DpcStack);
+
+
+ /* Setup the TSS descriptor and entries */
+ KiInitializeTss(Pcr,
+ TssBase,
+ KernelStack,
+ DoubleFaultStack,
+ NmiStack);
+}
+
CODE_SEG("INIT")
static
VOID
@@ -294,21 +326,17 @@ KiInitializeP0BootStructures(
TssEntry = KiGetGdtEntry(GdtDescriptor.Base, KGDT64_SYS_TSS);
TssBase = KiGetGdtDescriptorBase(TssEntry);
- /* Initialize the PCR */
- KiInitializePcr(&KiInitialPcr,
- 0,
- GdtDescriptor.Base,
- IdtDescriptor.Base,
- TssBase,
- &KiInitialThread.Tcb,
- KiP0DoubleFaultStack);
-
- /* Setup the TSS descriptors and entries */
- KiInitializeTss(&KiInitialPcr,
- KiInitialPcr.TssBase,
- KiP0BootStack,
- KiP0DoubleFaultStack,
- KiP0DoubleFaultStack);
+ /* Initialize PCR and TSS */
+ KiInitializeProcessorBootStructures(0,
+ &KiInitialPcr,
+ GdtDescriptor.Base,
+ IdtDescriptor.Base,
+ TssBase,
+ &KiInitialThread.Tcb,
+ KiP0BootStack,
+ KiP0DoubleFaultStack,
+ KiP0DoubleFaultStack,
+ KiP0DoubleFaultStack);
}
CODE_SEG("INIT")