From acb6bbb649d8bf65faee18565d5a9fa76be8df04 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Mon, 21 Nov 2022 11:58:40 +0100 Subject: [PATCH] hw: fix 'Kernel::time()' deviation in RISC-V timer Issue #4360 --- repos/base-hw/src/core/spec/riscv/timer.cc | 7 +++---- repos/base-hw/src/core/spec/riscv/timer.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/repos/base-hw/src/core/spec/riscv/timer.cc b/repos/base-hw/src/core/spec/riscv/timer.cc index 4538533bfb..1747414ba5 100644 --- a/repos/base-hw/src/core/spec/riscv/timer.cc +++ b/repos/base-hw/src/core/spec/riscv/timer.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2021 Genode Labs GmbH + * Copyright (C) 2021-2022 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. @@ -39,8 +39,7 @@ time_t Board::Timer::stime() const void Timer::_start_one_shot(time_t const ticks) { - _device.last_time = _device.stime(); - Sbi::set_timer(_device.last_time + ticks); + Sbi::set_timer(_time + ticks); } @@ -58,7 +57,7 @@ time_t Timer::_max_value() const { time_t Timer::_duration() const { - return _device.stime() - _device.last_time; + return _device.stime() - _time; } diff --git a/repos/base-hw/src/core/spec/riscv/timer.h b/repos/base-hw/src/core/spec/riscv/timer.h index 04138565cd..a1d30a1d90 100644 --- a/repos/base-hw/src/core/spec/riscv/timer.h +++ b/repos/base-hw/src/core/spec/riscv/timer.h @@ -31,8 +31,6 @@ struct Board::Timer TICKS_PER_US = TICKS_PER_MS / 1000, }; - Kernel::time_t last_time { 0 }; - Kernel::time_t stime() const; Timer(unsigned);