mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
base-hw: pass generic Vm_data structure to the kernel object
This enables passing additional data structures to the kernel on x86. Ref #4826
This commit is contained in:
parent
312b638220
commit
1e3836f8b5
@ -24,6 +24,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vm_state;
|
||||
using Vm_data = Vm_state;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vm_state;
|
||||
using Vm_data = Vm_state;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vm_state;
|
||||
using Vm_data = Vm_state;
|
||||
|
||||
using uint128_t = __uint128_t;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ namespace Genode {
|
||||
* CPU context of a virtual machine
|
||||
*/
|
||||
struct Vm_state;
|
||||
using Vm_data = Vm_state;
|
||||
}
|
||||
|
||||
struct Genode::Vm_state : Genode::Vcpu_state
|
||||
|
@ -43,6 +43,7 @@ namespace Board {
|
||||
struct Vcpu_context;
|
||||
|
||||
using Vm_state = Genode::Vm_state;
|
||||
using Vm_data = Vm_state;
|
||||
};
|
||||
|
||||
|
||||
|
@ -73,7 +73,7 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
|
||||
*/
|
||||
Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_state & state,
|
||||
Genode::Vm_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id);
|
||||
|
||||
@ -91,7 +91,7 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
|
||||
* Create a virtual machine that is stopped initially
|
||||
*
|
||||
* \param dst memory donation for the VM object
|
||||
* \param state location of the CPU state of the VM
|
||||
* \param data location of the CPU data of the VM
|
||||
* \param signal_context_id kernel name of the signal context for VM events
|
||||
* \param id VM identity
|
||||
*
|
||||
@ -99,12 +99,12 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
|
||||
*/
|
||||
static capid_t syscall_create(Core::Kernel_object<Vm> &vm,
|
||||
unsigned cpu,
|
||||
void * const state,
|
||||
void * const data,
|
||||
capid_t const signal_context_id,
|
||||
Identity &id)
|
||||
{
|
||||
return (capid_t)call(call_id_new_vm(), (Call_arg)&vm, (Call_arg)cpu,
|
||||
(Call_arg)state, (Call_arg)&id, signal_context_id);
|
||||
(Call_arg)data, (Call_arg)&id, signal_context_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,7 @@ void Kernel::Thread::_call_new_vm()
|
||||
}
|
||||
|
||||
_call_new<Vm>(_user_irq_pool, _cpu_pool.cpu((unsigned)user_arg_2()),
|
||||
*(Board::Vm_state*)user_arg_3(),
|
||||
*(Board::Vm_data*)user_arg_3(),
|
||||
*context, *(Vm::Identity*)user_arg_4());
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ namespace Kernel { class Cpu; }
|
||||
namespace Board {
|
||||
|
||||
using Core::Vm_state;
|
||||
using Vm_data = Core::Vm_state;
|
||||
|
||||
enum { VCPU_MAX = 1 };
|
||||
|
||||
|
@ -32,6 +32,7 @@ namespace Board {
|
||||
struct Vcpu_context;
|
||||
|
||||
using Vm_state = Genode::Vm_state;
|
||||
using Vm_data = Genode::Vm_state;
|
||||
};
|
||||
|
||||
|
||||
|
@ -103,6 +103,12 @@ static Vmid_allocator &alloc()
|
||||
}
|
||||
|
||||
|
||||
Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr)
|
||||
{
|
||||
return ds_addr;
|
||||
}
|
||||
|
||||
|
||||
Vm_session_component::Vm_session_component(Rpc_entrypoint &ds_ep,
|
||||
Resources resources,
|
||||
Label const &,
|
||||
|
@ -22,14 +22,14 @@ using namespace Kernel;
|
||||
|
||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_state & state,
|
||||
Genode::Vm_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
Kernel::Object { *this },
|
||||
Cpu_job(Cpu_priority::min(), 0),
|
||||
_user_irq_pool(user_irq_pool),
|
||||
_state(state),
|
||||
_state(data),
|
||||
_context(context),
|
||||
_id(id),
|
||||
_vcpu_context(cpu)
|
||||
|
@ -52,6 +52,12 @@ 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)
|
||||
{
|
||||
return ds_addr;
|
||||
}
|
||||
|
||||
|
||||
Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||
Resources resources,
|
||||
Label const &,
|
||||
|
@ -134,14 +134,14 @@ void Board::Vcpu_context::Virtual_timer_irq::disable()
|
||||
|
||||
Kernel::Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_state & state,
|
||||
Genode::Vm_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
Kernel::Object { *this },
|
||||
Cpu_job(Cpu_priority::min(), 0),
|
||||
_user_irq_pool(user_irq_pool),
|
||||
_state(state),
|
||||
_state(data),
|
||||
_context(context),
|
||||
_id(id),
|
||||
_vcpu_context(cpu)
|
||||
|
@ -109,14 +109,14 @@ void Board::Vcpu_context::Virtual_timer_irq::disable()
|
||||
|
||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_state & state,
|
||||
Genode::Vm_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
Kernel::Object { *this },
|
||||
Cpu_job(Cpu_priority::min(), 0),
|
||||
_user_irq_pool(user_irq_pool),
|
||||
_state(state),
|
||||
_state(data),
|
||||
_context(context),
|
||||
_id(id),
|
||||
_vcpu_context(cpu)
|
||||
|
@ -32,6 +32,7 @@ namespace Board {
|
||||
struct Vcpu_context;
|
||||
|
||||
using Vm_state = Genode::Vm_state;
|
||||
using Vm_data = Genode::Vm_data;
|
||||
|
||||
enum {
|
||||
VCPU_MAX = 16
|
||||
|
@ -36,14 +36,14 @@ using Board::Vmcb;
|
||||
|
||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||
Cpu & cpu,
|
||||
Genode::Vm_state & state,
|
||||
Genode::Vm_data & data,
|
||||
Kernel::Signal_context & context,
|
||||
Identity & id)
|
||||
:
|
||||
Kernel::Object { *this },
|
||||
Cpu_job(Cpu_priority::min(), 0),
|
||||
_user_irq_pool(user_irq_pool),
|
||||
_state(state),
|
||||
_state(data),
|
||||
_context(context),
|
||||
_id(id),
|
||||
_vcpu_context(cpu)
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <base/stdint.h>
|
||||
#include <cpu/vcpu_state.h>
|
||||
#include <util/mmio.h>
|
||||
#include <util/string.h>
|
||||
|
||||
namespace Board
|
||||
{
|
||||
|
@ -101,6 +101,12 @@ static Vmid_allocator &alloc()
|
||||
}
|
||||
|
||||
|
||||
Genode::addr_t Vm_session_component::_alloc_vm_data(Genode::addr_t ds_addr)
|
||||
{
|
||||
return ds_addr;
|
||||
}
|
||||
|
||||
|
||||
Vm_session_component::Vm_session_component(Rpc_entrypoint &ds_ep,
|
||||
Resources resources,
|
||||
Label const &,
|
||||
|
@ -92,6 +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);
|
||||
|
||||
void * _alloc_table();
|
||||
void _attach(addr_t phys_addr, addr_t vm_addr, size_t size);
|
||||
|
Loading…
Reference in New Issue
Block a user