From e05e05b13af815a4179a56570590bf90721961a9 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Wed, 7 Apr 2021 23:04:37 -0700 Subject: [PATCH] [kernel] Set process in cpu_early_init Update the cpu data to point to the fake kernel process in cpu_early_init so there can never be a race condition where the current process may not be set. --- src/kernel/cpu.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/kernel/cpu.cpp b/src/kernel/cpu.cpp index c650763..a485264 100644 --- a/src/kernel/cpu.cpp +++ b/src/kernel/cpu.cpp @@ -46,6 +46,10 @@ cpu_early_init(cpu_data *cpu) // Install the GS base pointint to the cpu_data wrmsr(msr::ia32_gs_base, reinterpret_cast(cpu)); + + // Set the initial process as the kernel "process" + extern process &g_kernel_process; + cpu->process = &g_kernel_process; } void