From: cheloha Date: Thu, 8 Sep 2022 03:09:40 +0000 (+0000) Subject: riscv64: cpu_initclocks: install tb_timecounter before cpu_startclock() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b168b2fee5d9b3e3e348e6289c4398471e43947a;p=openbsd riscv64: cpu_initclocks: install tb_timecounter before cpu_startclock() In the future, the clock interrupt code will need a real timecounter to work correctly. Nudge the tc_init(9) call for tb_timecounter up before cpu_startclock(). --- diff --git a/sys/arch/riscv64/riscv64/clock.c b/sys/arch/riscv64/riscv64/clock.c index 75643f998f5..b1ddd387a40 100644 --- a/sys/arch/riscv64/riscv64/clock.c +++ b/sys/arch/riscv64/riscv64/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.4 2022/08/09 04:49:08 cheloha Exp $ */ +/* $OpenBSD: clock.c,v 1.5 2022/09/08 03:09:40 cheloha Exp $ */ /* * Copyright (c) 2020 Mark Kettenis @@ -63,6 +63,9 @@ tb_get_timecount(struct timecounter *tc) void cpu_initclocks(void) { + tb_timecounter.tc_frequency = tb_freq; + tc_init(&tb_timecounter); + tick_increment = tb_freq / hz; stathz = 100; @@ -77,9 +80,6 @@ cpu_initclocks(void) evcount_attach(&stat_count, "stat", NULL); cpu_startclock(); - - tb_timecounter.tc_frequency = tb_freq; - tc_init(&tb_timecounter); } void