diff --git a/Makefile b/Makefile index 2873c3f0..976af3e4 100644 --- a/Makefile +++ b/Makefile @@ -301,6 +301,11 @@ style: $(VERBOSE) docker run --rm --workdir /src -v $(PWD):/src$(DOCKER_MOUNT_OPTS) clang-format-lint --clang-format-executable /clang-format/clang-format10 \ -r $(SOURCES) $(HEADERS) | grep -v -E '^Processing [0-9]* files:' | patch -s -p1 ||: +.PHONY: commit_style +commit_style: + @echo "COMMIT_STYLE" + $(VERBOSE) git clang-format HEAD^1 > /dev/null + DOCKERFILE := $(shell find $(KTF_ROOT) -type f -name Dockerfile) DOCKERIMAGE := "ktf:build" DOCKERUSERFLAGS := --user $(shell id -u):$(shell id -g) $(shell printf -- "--group-add=%q " $(shell id -G)) diff --git a/common/setup.c b/common/setup.c index ae5d7af2..3a4f36c7 100644 --- a/common/setup.c +++ b/common/setup.c @@ -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) { + 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(); @@ -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 diff --git a/include/setup.h b/include/setup.h index 9b6d4cc2..aeaf800a 100644 --- a/include/setup.h +++ b/include/setup.h @@ -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 */ diff --git a/smp/smp.c b/smp/smp.c index 311e630d..47457119 100644 --- a/smp/smp.c +++ b/smp/smp.c @@ -59,6 +59,11 @@ void __noreturn ap_startup(void) { ap_callin = true; smp_wmb(); + init_timers(cpu); + + if (opt_fpu) + enable_fpu(); + run_tasks(cpu); while (true)