From 345c01677ddbbc4b45e0b2a41414a6b45c04265c Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 10 Nov 2022 04:20:20 +0100 Subject: [PATCH] hw: fix 'Kernel::time()' deviation in ARM generic timer Issue #4360 --- repos/base-hw/src/core/spec/arm/generic_timer.cc | 5 ++--- repos/base-hw/src/core/spec/arm/generic_timer.h | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/repos/base-hw/src/core/spec/arm/generic_timer.cc b/repos/base-hw/src/core/spec/arm/generic_timer.cc index 5bf6195059..659e28b145 100644 --- a/repos/base-hw/src/core/spec/arm/generic_timer.cc +++ b/repos/base-hw/src/core/spec/arm/generic_timer.cc @@ -5,7 +5,7 @@ */ /* - * Copyright (C) 2019 Genode Labs GmbH + * Copyright (C) 2019-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. @@ -34,7 +34,6 @@ Board::Timer::Timer(unsigned) : ticks_per_ms((unsigned)(_freq() / 1000)) void Timer::_start_one_shot(time_t const ticks) { - _device.last_time = Cpu::Cntpct::read(); Cpu::Cntp_tval::write((Cpu::Cntp_tval::access_t)ticks); Cpu::Cntp_ctl::access_t ctl = Cpu::Cntp_ctl::read(); Cpu::Cntp_ctl::Istatus::set(ctl, 0); @@ -44,7 +43,7 @@ void Timer::_start_one_shot(time_t const ticks) time_t Timer::_duration() const { - return Cpu::Cntpct::read() - _device.last_time; + return Cpu::Cntpct::read() - _time; } diff --git a/repos/base-hw/src/core/spec/arm/generic_timer.h b/repos/base-hw/src/core/spec/arm/generic_timer.h index c06f18ee9c..a047670ac1 100644 --- a/repos/base-hw/src/core/spec/arm/generic_timer.h +++ b/repos/base-hw/src/core/spec/arm/generic_timer.h @@ -26,8 +26,6 @@ struct Board::Timer unsigned const ticks_per_ms; - Kernel::time_t last_time { 0 }; - Timer(unsigned); };