[kernel] Protect against null ctor

This should never happen, but if there's a null in the ctors list, don't
just blindly call it.
This commit is contained in:
Justin C. Miller
2021-04-07 23:01:26 -07:00
parent 4436145eaf
commit 19a799656a

View File

@@ -78,7 +78,7 @@ run_constructors()
void (**p)(void) = &__ctors;
while (p < &__ctors_end) {
void (*ctor)(void) = *p++;
ctor();
if (ctor) ctor();
}
}
@@ -126,7 +126,6 @@ kernel_main(args::header *header)
extern cpu_data g_bsp_cpu_data;
extern uintptr_t idle_stack_end;
cpu_data *cpu = &g_bsp_cpu_data;
kutil::memset(cpu, 0, sizeof(cpu_data));