x86_64: zero-init BSP and AP CPU cpu_data before use

This commit is contained in:
2023-05-07 21:40:12 +01:00
parent 9f3c080e41
commit aaad77aea5
2 changed files with 3 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ extern "C" void ap_trampoline_exit(void)
this_cpu->c_cpu_id = cpu_id; this_cpu->c_cpu_id = cpu_id;
struct cpu_data *self = get_this_cpu(); struct cpu_data *self = get_this_cpu();
memset(self, 0x0, sizeof *self);
self->c_flags = CPU_ONLINE; self->c_flags = CPU_ONLINE;
self->c_id = cpu_id; self->c_id = cpu_id;
this_cpu->c_data = self; this_cpu->c_data = self;

View File

@@ -63,6 +63,8 @@ int ml_init(uintptr_t arg)
init_per_cpu_areas(); init_per_cpu_areas();
struct cpu_data *this_cpu = get_this_cpu(); struct cpu_data *this_cpu = get_this_cpu();
memset(this_cpu, 0x0, sizeof *this_cpu);
this_cpu->c_flags = CPU_ONLINE; this_cpu->c_flags = CPU_ONLINE;
this_cpu->c_id = this_cpu(); this_cpu->c_id = this_cpu();
g_bootstrap_cpu.c_data = this_cpu; g_bootstrap_cpu.c_data = this_cpu;