smp: zero new processors cpu structs on allocation

This commit is contained in:
Matheus
2024-07-10 19:45:41 -03:00
parent a8a097192d
commit e06018ee71
+3 -1
View File
@@ -59,9 +59,11 @@ void arch_smp_wakeup() {
printf("smp: %d processor%s\n", response->cpu_count, response->cpu_count > 1 ? "s" : "");
// use physical pages so the other cpus have it on the hhdm
cpu_t *apcpu = pmm_alloc(ROUND_UP(sizeof(cpu_t) * response->cpu_count, PAGE_SIZE) / PAGE_SIZE, PMM_SECTION_DEFAULT);
size_t apcpusize = ROUND_UP(sizeof(cpu_t) * response->cpu_count, PAGE_SIZE);
cpu_t *apcpu = pmm_alloc(apcpusize / PAGE_SIZE, PMM_SECTION_DEFAULT);
__assert(apcpu);
apcpu = MAKE_HHDM(apcpu);
memset(apcpu, 0, apcpusize);
void (*wakeupfn)(struct limine_smp_info *) = cmdline_get("nosmp") ? cpuwakeuphalt : cpuwakeup;