Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
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) {
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 */
5 changes: 5 additions & 0 deletions smp/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down