From b277b84e19f34f134eb88d2a402643ffb96ad93d Mon Sep 17 00:00:00 2001 From: Benjamin Lamowski Date: Tue, 2 May 2023 19:30:20 +0200 Subject: [PATCH] base: extend Vcpu_state for base-hw x86 virtualization Changes are preliminary and will most certainly be removed when fully enabling the virtualization feature on base-hw. Ref #4826 --- repos/base/include/spec/x86/cpu/vcpu_state.h | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/repos/base/include/spec/x86/cpu/vcpu_state.h b/repos/base/include/spec/x86/cpu/vcpu_state.h index 0df15b1c94..dbeeb5b965 100644 --- a/repos/base/include/spec/x86/cpu/vcpu_state.h +++ b/repos/base/include/spec/x86/cpu/vcpu_state.h @@ -2,11 +2,12 @@ * \brief Virtual CPU context for x86 * \author Alexander Boettcher * \author Christian Helmuth + * \author Benjamin Lamowski * \date 2018-10-09 */ /* - * Copyright (C) 2018-2021 Genode Labs GmbH + * Copyright (C) 2018-2023 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. @@ -81,6 +82,26 @@ class Genode::Vcpu_state _charged = true; _value = value; } + + /* + * Charge without changing value + * + * \noapi + */ + void set_charged() { _charged = true; } + + /* + * Update value if not yet charged + * + * \noapi + */ + void update(T const &value) + { + if (!_charged) { + _value = value; + _charged = true; + } + } }; struct Range