diff --git a/repos/base-hw/include/spec/arm/cpu/vcpu_state_trustzone.h b/repos/base-hw/include/spec/arm/cpu/vcpu_state_trustzone.h index cddce937af..7c1be51611 100644 --- a/repos/base-hw/include/spec/arm/cpu/vcpu_state_trustzone.h +++ b/repos/base-hw/include/spec/arm/cpu/vcpu_state_trustzone.h @@ -27,7 +27,7 @@ namespace Genode { * CPU context of a virtual machine */ struct Vcpu_state; - using Vm_data = Vcpu_state; + using Vcpu_data = Vcpu_state; struct Vcpu_state; } diff --git a/repos/base-hw/include/spec/arm/cpu/vcpu_state_virtualization.h b/repos/base-hw/include/spec/arm/cpu/vcpu_state_virtualization.h index 0c127046f4..21b69a4eab 100644 --- a/repos/base-hw/include/spec/arm/cpu/vcpu_state_virtualization.h +++ b/repos/base-hw/include/spec/arm/cpu/vcpu_state_virtualization.h @@ -26,7 +26,7 @@ namespace Genode { * CPU context of a virtual machine */ struct Vcpu_state; - using Vm_data = Vcpu_state; + using Vcpu_data = Vcpu_state; } diff --git a/repos/base-hw/include/spec/arm_64/cpu/vcpu_state_virtualization.h b/repos/base-hw/include/spec/arm_64/cpu/vcpu_state_virtualization.h index b23baa94fa..fabaee76b5 100644 --- a/repos/base-hw/include/spec/arm_64/cpu/vcpu_state_virtualization.h +++ b/repos/base-hw/include/spec/arm_64/cpu/vcpu_state_virtualization.h @@ -26,7 +26,7 @@ namespace Genode { * CPU context of a virtual machine */ struct Vcpu_state; - using Vm_data = Vcpu_state; + using Vcpu_data = Vcpu_state; using uint128_t = __uint128_t; } diff --git a/repos/base-hw/include/spec/x86_64/cpu/vcpu_state_virtualization.h b/repos/base-hw/include/spec/x86_64/cpu/vcpu_state_virtualization.h index 87c414c6d1..ba3ad7f5d9 100644 --- a/repos/base-hw/include/spec/x86_64/cpu/vcpu_state_virtualization.h +++ b/repos/base-hw/include/spec/x86_64/cpu/vcpu_state_virtualization.h @@ -23,10 +23,10 @@ namespace Genode { /** * CPU context of a virtual machine */ - struct Vm_data; + struct Vcpu_data; } -struct Genode::Vm_data +struct Genode::Vcpu_data { alignas(Genode::get_page_size()) uint8_t vmcb[get_page_size()]; diff --git a/repos/base-hw/src/core/board/virt_qemu_arm_v8a/board.h b/repos/base-hw/src/core/board/virt_qemu_arm_v8a/board.h index 28ce9031c9..8783090205 100644 --- a/repos/base-hw/src/core/board/virt_qemu_arm_v8a/board.h +++ b/repos/base-hw/src/core/board/virt_qemu_arm_v8a/board.h @@ -43,7 +43,7 @@ namespace Board { struct Vcpu_context; using Vcpu_state = Genode::Vcpu_state; - using Vm_data = Vcpu_state; + using Vcpu_data = Vcpu_state; }; diff --git a/repos/base-hw/src/core/kernel/vm.h b/repos/base-hw/src/core/kernel/vm.h index 4d13a80cfc..b742822f7e 100644 --- a/repos/base-hw/src/core/kernel/vm.h +++ b/repos/base-hw/src/core/kernel/vm.h @@ -82,7 +82,7 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job */ Vm(Irq::Pool & user_irq_pool, Cpu & cpu, - Genode::Vm_data & data, + Genode::Vcpu_data & data, Kernel::Signal_context & context, Identity & id); diff --git a/repos/base-hw/src/core/kernel/vm_thread_on.cc b/repos/base-hw/src/core/kernel/vm_thread_on.cc index f7ee013e76..d2023d83b9 100644 --- a/repos/base-hw/src/core/kernel/vm_thread_on.cc +++ b/repos/base-hw/src/core/kernel/vm_thread_on.cc @@ -26,7 +26,7 @@ void Kernel::Thread::_call_new_vm() } _call_new(_user_irq_pool, _cpu_pool.cpu((unsigned)user_arg_2()), - *(Board::Vm_data*)user_arg_3(), + *(Board::Vcpu_data*)user_arg_3(), *context, *(Vm::Identity*)user_arg_4()); } diff --git a/repos/base-hw/src/core/spec/arm/trustzone_board.h b/repos/base-hw/src/core/spec/arm/trustzone_board.h index 58d4ef321f..63a669dbd2 100644 --- a/repos/base-hw/src/core/spec/arm/trustzone_board.h +++ b/repos/base-hw/src/core/spec/arm/trustzone_board.h @@ -25,7 +25,7 @@ namespace Kernel { class Cpu; } namespace Board { using Core::Vcpu_state; - using Vm_data = Core::Vcpu_state; + using Vcpu_data = Core::Vcpu_state; enum { VCPU_MAX = 1 }; diff --git a/repos/base-hw/src/core/spec/arm/virtualization/board.h b/repos/base-hw/src/core/spec/arm/virtualization/board.h index 8772b08703..cd1987b75b 100644 --- a/repos/base-hw/src/core/spec/arm/virtualization/board.h +++ b/repos/base-hw/src/core/spec/arm/virtualization/board.h @@ -32,7 +32,7 @@ namespace Board { struct Vcpu_context; using Vcpu_state = Genode::Vcpu_state; - using Vm_data = Genode::Vcpu_state; + using Vcpu_data = Genode::Vcpu_state; }; diff --git a/repos/base-hw/src/core/spec/arm/virtualization/vm_session_component.cc b/repos/base-hw/src/core/spec/arm/virtualization/vm_session_component.cc index 6f278b9c62..2876420bc9 100644 --- a/repos/base-hw/src/core/spec/arm/virtualization/vm_session_component.cc +++ b/repos/base-hw/src/core/spec/arm/virtualization/vm_session_component.cc @@ -103,7 +103,7 @@ static Vmid_allocator &alloc() } -Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr) +Genode::addr_t Vm_session_component::_alloc_vcpu_data(Genode::addr_t ds_addr) { return ds_addr; } diff --git a/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc b/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc index de97c25aff..2ecdb663a0 100644 --- a/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/arm_v7/trustzone/kernel/vm.cc @@ -23,7 +23,7 @@ using namespace Kernel; Vm::Vm(Irq::Pool & user_irq_pool, Cpu & cpu, - Genode::Vm_data & data, + Genode::Vcpu_data & data, Kernel::Signal_context & context, Identity & id) : diff --git a/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.cc b/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.cc index 0fae85fd3a..b0aa8ee57a 100644 --- a/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.cc +++ b/repos/base-hw/src/core/spec/arm_v7/trustzone/vm_session_component.cc @@ -52,7 +52,7 @@ void * Vm_session_component::_alloc_table() static unsigned id_alloc = 0; -Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr) +Genode::addr_t Vm_session_component::_alloc_vcpu_data(Genode::addr_t ds_addr) { return ds_addr; } diff --git a/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc b/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc index b9465d9159..99b02b1be8 100644 --- a/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/arm_v7/virtualization/kernel/vm.cc @@ -135,7 +135,7 @@ void Board::Vcpu_context::Virtual_timer_irq::disable() Kernel::Vm::Vm(Irq::Pool & user_irq_pool, Cpu & cpu, - Genode::Vm_data & data, + Genode::Vcpu_data & data, Kernel::Signal_context & context, Identity & id) : diff --git a/repos/base-hw/src/core/spec/arm_v8/virtualization/kernel/vm.cc b/repos/base-hw/src/core/spec/arm_v8/virtualization/kernel/vm.cc index ab823725cb..8b22806c84 100644 --- a/repos/base-hw/src/core/spec/arm_v8/virtualization/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/arm_v8/virtualization/kernel/vm.cc @@ -110,7 +110,7 @@ void Board::Vcpu_context::Virtual_timer_irq::disable() Vm::Vm(Irq::Pool & user_irq_pool, Cpu & cpu, - Genode::Vm_data & data, + Genode::Vcpu_data & data, Kernel::Signal_context & context, Identity & id) : diff --git a/repos/base-hw/src/core/spec/x86_64/virtualization/board.h b/repos/base-hw/src/core/spec/x86_64/virtualization/board.h index 28a20860d9..67792284a3 100644 --- a/repos/base-hw/src/core/spec/x86_64/virtualization/board.h +++ b/repos/base-hw/src/core/spec/x86_64/virtualization/board.h @@ -31,7 +31,7 @@ namespace Board { struct Vcpu_context; - using Vm_data = Genode::Vm_data; + using Vcpu_data = Genode::Vcpu_data; using Vcpu_state = Genode::Vcpu_state; enum { diff --git a/repos/base-hw/src/core/spec/x86_64/virtualization/kernel/vm.cc b/repos/base-hw/src/core/spec/x86_64/virtualization/kernel/vm.cc index 06367eaea2..5e31c6093a 100644 --- a/repos/base-hw/src/core/spec/x86_64/virtualization/kernel/vm.cc +++ b/repos/base-hw/src/core/spec/x86_64/virtualization/kernel/vm.cc @@ -37,7 +37,7 @@ using Board::Vmcb; Vm::Vm(Irq::Pool & user_irq_pool, Cpu & cpu, - Genode::Vm_data & data, + Genode::Vcpu_data & data, Kernel::Signal_context & context, Identity & id) : @@ -78,7 +78,7 @@ void Vm::proceed(Cpu & cpu) * we can pop it later */ _vcpu_context.regs->trapno = _vcpu_context.vmcb.root_vmcb_phys; - Hypervisor::switch_world(_vcpu_context.vmcb.vm_data()->vmcb_phys_addr, + Hypervisor::switch_world(_vcpu_context.vmcb.vcpu_data()->vmcb_phys_addr, (addr_t) &_vcpu_context.regs->r8, _vcpu_context.regs->fpu_context()); /* diff --git a/repos/base-hw/src/core/spec/x86_64/virtualization/svm.h b/repos/base-hw/src/core/spec/x86_64/virtualization/svm.h index 1ac88f2d3e..34297da6ed 100644 --- a/repos/base-hw/src/core/spec/x86_64/virtualization/svm.h +++ b/repos/base-hw/src/core/spec/x86_64/virtualization/svm.h @@ -155,9 +155,9 @@ struct alignas(Genode::get_page_size()) Board::Vmcb sizeof(Board::Vmcb_state_save_area) - Board::Vmcb_control_area::total_size]; - Genode::Vm_data * vm_data() + Genode::Vcpu_data * vcpu_data() { - return reinterpret_cast(this); + return reinterpret_cast(this); } /* diff --git a/repos/base-hw/src/core/spec/x86_64/virtualization/vm_session_component.cc b/repos/base-hw/src/core/spec/x86_64/virtualization/vm_session_component.cc index f32622b0fc..515ecc65dd 100644 --- a/repos/base-hw/src/core/spec/x86_64/virtualization/vm_session_component.cc +++ b/repos/base-hw/src/core/spec/x86_64/virtualization/vm_session_component.cc @@ -101,23 +101,23 @@ static Vmid_allocator &alloc() } -Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr) +Genode::addr_t Vm_session_component::_alloc_vcpu_data(Genode::addr_t ds_addr) { - void * vm_data_ptr = cma() - .alloc_aligned(sizeof(Board::Vm_data), 12) - .convert( - [&](void *ptr) { return ptr; }, - [&](Range_allocator::Alloc_error) -> void * { - /* XXX handle individual error conditions */ - error("failed to allocate kernel object"); - throw Insufficient_ram_quota(); - } + void * vcpu_data_ptr = cma() + .alloc_aligned(sizeof(Board::Vcpu_data), 12) + .convert( + [&](void *ptr) { return ptr; }, + [&](Range_allocator::Alloc_error) -> void * { + /* XXX handle individual error conditions */ + error("failed to allocate kernel object"); + throw Insufficient_ram_quota(); + } ); - Genode::Vm_data* vm_data = (Genode::Vm_data *) vm_data_ptr; - vm_data->vcpu_state = (Genode::Vcpu_state *) ds_addr; - vm_data->vmcb_phys_addr = (addr_t)cma().phys_addr(vm_data->vmcb); - return (Genode::addr_t) vm_data_ptr; + Genode::Vcpu_data* vcpu_data = (Genode::Vcpu_data *) vcpu_data_ptr; + vcpu_data->vcpu_state = (Genode::Vcpu_state *) ds_addr; + vcpu_data->vmcb_phys_addr = (addr_t)cma().phys_addr(vcpu_data->vmcb); + return (Genode::addr_t) vcpu_data_ptr; } diff --git a/repos/base-hw/src/core/vm_session_component.cc b/repos/base-hw/src/core/vm_session_component.cc index f176afd4e0..b214823092 100644 --- a/repos/base-hw/src/core/vm_session_component.cc +++ b/repos/base-hw/src/core/vm_session_component.cc @@ -65,7 +65,7 @@ Capability Vm_session_component::create_vcpu(Thread_cap try { vcpu.ds_cap = _constrained_md_ram_alloc.alloc(_ds_size(), Cache::UNCACHED); - vcpu.ds_addr = _alloc_vm_data(_region_map.attach(vcpu.ds_cap)); + vcpu.ds_addr = _alloc_vcpu_data(_region_map.attach(vcpu.ds_cap)); } catch (...) { if (vcpu.ds_cap.valid()) _constrained_md_ram_alloc.free(vcpu.ds_cap); diff --git a/repos/base-hw/src/core/vm_session_component.h b/repos/base-hw/src/core/vm_session_component.h index df535d230e..c9bc0d4f65 100644 --- a/repos/base-hw/src/core/vm_session_component.h +++ b/repos/base-hw/src/core/vm_session_component.h @@ -92,7 +92,7 @@ class Core::Vm_session_component unsigned _vcpu_id_alloc { 0 }; static size_t _ds_size(); - static size_t _alloc_vm_data(Genode::addr_t ds_addr); + static size_t _alloc_vcpu_data(Genode::addr_t ds_addr); void * _alloc_table(); void _attach(addr_t phys_addr, addr_t vm_addr, size_t size);