Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some SMP fixes (enable timers and FPU on APs) and minor changes #277

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions common/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,21 @@ static void __text_init init_vga_console(void) {
register_console_callback(vga_console_write, paddr_to_virt_kern(VGA_START_ADDR));
}

void __text_init init_timers(cpu_t *cpu) {
if (cpu->bsp) {
wipawel marked this conversation as resolved.
Show resolved Hide resolved
bool hpet_initialized = false;

if (opt_hpet)
hpet_initialized = init_hpet(cpu);

if (!hpet_initialized && opt_pit)
init_pit(cpu);
}

if (opt_apic_timer)
init_apic_timer();
}

void __noreturn __text_init kernel_start(uint32_t multiboot_magic, unsigned long *mbi) {
/* Zero-out BSS sections */
zero_bss();
Expand Down Expand Up @@ -215,17 +230,9 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic, unsigned long
init_tasks();

/* Initialize timers */
bool hpet_initialized = false;
if (opt_hpet)
hpet_initialized = init_hpet(bsp);

if (!hpet_initialized && opt_pit)
init_pit(bsp);

if (opt_apic_timer)
init_apic_timer();
init_timers(bsp);

/* Try to initialize ACPI (and MADT) */
/* Try to initialize ACPI (and MADT) */
#ifndef KTF_ACPICA
if (init_acpi() < 0) {
#else
Expand Down
1 change: 1 addition & 0 deletions include/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ extern void set_bsp_cpu_id(unsigned cpu_id);

extern void zap_boot_mappings(void);

extern void init_timers(cpu_t *cpu);
#endif /* __ASSEMBLY__ */

#endif /* KTF_SETUP_H */
2 changes: 2 additions & 0 deletions smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ void __noreturn ap_startup(void) {
ap_callin = true;
smp_wmb();

init_timers(cpu);

wipawel marked this conversation as resolved.
Show resolved Hide resolved
run_tasks(cpu);

while (true)
Expand Down