mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-31 08:25:38 +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
|
* CPU context of a virtual machine
|
||||||
*/
|
*/
|
||||||
struct Vm_state;
|
struct Vm_state;
|
||||||
|
using Vm_data = Vm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ namespace Genode {
|
|||||||
* CPU context of a virtual machine
|
* CPU context of a virtual machine
|
||||||
*/
|
*/
|
||||||
struct Vm_state;
|
struct Vm_state;
|
||||||
|
using Vm_data = Vm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ namespace Genode {
|
|||||||
* CPU context of a virtual machine
|
* CPU context of a virtual machine
|
||||||
*/
|
*/
|
||||||
struct Vm_state;
|
struct Vm_state;
|
||||||
|
using Vm_data = Vm_state;
|
||||||
|
|
||||||
using uint128_t = __uint128_t;
|
using uint128_t = __uint128_t;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ namespace Genode {
|
|||||||
* CPU context of a virtual machine
|
* CPU context of a virtual machine
|
||||||
*/
|
*/
|
||||||
struct Vm_state;
|
struct Vm_state;
|
||||||
|
using Vm_data = Vm_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Genode::Vm_state : Genode::Vcpu_state
|
struct Genode::Vm_state : Genode::Vcpu_state
|
||||||
|
@ -43,6 +43,7 @@ namespace Board {
|
|||||||
struct Vcpu_context;
|
struct Vcpu_context;
|
||||||
|
|
||||||
using Vm_state = Genode::Vm_state;
|
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,
|
Vm(Irq::Pool & user_irq_pool,
|
||||||
Cpu & cpu,
|
Cpu & cpu,
|
||||||
Genode::Vm_state & state,
|
Genode::Vm_data & data,
|
||||||
Kernel::Signal_context & context,
|
Kernel::Signal_context & context,
|
||||||
Identity & id);
|
Identity & id);
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ class Kernel::Vm : private Kernel::Object, public Cpu_job
|
|||||||
* Create a virtual machine that is stopped initially
|
* Create a virtual machine that is stopped initially
|
||||||
*
|
*
|
||||||
* \param dst memory donation for the VM object
|
* \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 signal_context_id kernel name of the signal context for VM events
|
||||||
* \param id VM identity
|
* \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,
|
static capid_t syscall_create(Core::Kernel_object<Vm> &vm,
|
||||||
unsigned cpu,
|
unsigned cpu,
|
||||||
void * const state,
|
void * const data,
|
||||||
capid_t const signal_context_id,
|
capid_t const signal_context_id,
|
||||||
Identity &id)
|
Identity &id)
|
||||||
{
|
{
|
||||||
return (capid_t)call(call_id_new_vm(), (Call_arg)&vm, (Call_arg)cpu,
|
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()),
|
_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());
|
*context, *(Vm::Identity*)user_arg_4());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ namespace Kernel { class Cpu; }
|
|||||||
namespace Board {
|
namespace Board {
|
||||||
|
|
||||||
using Core::Vm_state;
|
using Core::Vm_state;
|
||||||
|
using Vm_data = Core::Vm_state;
|
||||||
|
|
||||||
enum { VCPU_MAX = 1 };
|
enum { VCPU_MAX = 1 };
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ namespace Board {
|
|||||||
struct Vcpu_context;
|
struct Vcpu_context;
|
||||||
|
|
||||||
using Vm_state = Genode::Vm_state;
|
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,
|
Vm_session_component::Vm_session_component(Rpc_entrypoint &ds_ep,
|
||||||
Resources resources,
|
Resources resources,
|
||||||
Label const &,
|
Label const &,
|
||||||
|
@ -22,14 +22,14 @@ using namespace Kernel;
|
|||||||
|
|
||||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||||
Cpu & cpu,
|
Cpu & cpu,
|
||||||
Genode::Vm_state & state,
|
Genode::Vm_data & data,
|
||||||
Kernel::Signal_context & context,
|
Kernel::Signal_context & context,
|
||||||
Identity & id)
|
Identity & id)
|
||||||
:
|
:
|
||||||
Kernel::Object { *this },
|
Kernel::Object { *this },
|
||||||
Cpu_job(Cpu_priority::min(), 0),
|
Cpu_job(Cpu_priority::min(), 0),
|
||||||
_user_irq_pool(user_irq_pool),
|
_user_irq_pool(user_irq_pool),
|
||||||
_state(state),
|
_state(data),
|
||||||
_context(context),
|
_context(context),
|
||||||
_id(id),
|
_id(id),
|
||||||
_vcpu_context(cpu)
|
_vcpu_context(cpu)
|
||||||
|
@ -52,6 +52,12 @@ void * Vm_session_component::_alloc_table()
|
|||||||
static unsigned id_alloc = 0;
|
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,
|
Vm_session_component::Vm_session_component(Rpc_entrypoint &ep,
|
||||||
Resources resources,
|
Resources resources,
|
||||||
Label const &,
|
Label const &,
|
||||||
|
@ -134,14 +134,14 @@ void Board::Vcpu_context::Virtual_timer_irq::disable()
|
|||||||
|
|
||||||
Kernel::Vm::Vm(Irq::Pool & user_irq_pool,
|
Kernel::Vm::Vm(Irq::Pool & user_irq_pool,
|
||||||
Cpu & cpu,
|
Cpu & cpu,
|
||||||
Genode::Vm_state & state,
|
Genode::Vm_data & data,
|
||||||
Kernel::Signal_context & context,
|
Kernel::Signal_context & context,
|
||||||
Identity & id)
|
Identity & id)
|
||||||
:
|
:
|
||||||
Kernel::Object { *this },
|
Kernel::Object { *this },
|
||||||
Cpu_job(Cpu_priority::min(), 0),
|
Cpu_job(Cpu_priority::min(), 0),
|
||||||
_user_irq_pool(user_irq_pool),
|
_user_irq_pool(user_irq_pool),
|
||||||
_state(state),
|
_state(data),
|
||||||
_context(context),
|
_context(context),
|
||||||
_id(id),
|
_id(id),
|
||||||
_vcpu_context(cpu)
|
_vcpu_context(cpu)
|
||||||
|
@ -109,14 +109,14 @@ void Board::Vcpu_context::Virtual_timer_irq::disable()
|
|||||||
|
|
||||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||||
Cpu & cpu,
|
Cpu & cpu,
|
||||||
Genode::Vm_state & state,
|
Genode::Vm_data & data,
|
||||||
Kernel::Signal_context & context,
|
Kernel::Signal_context & context,
|
||||||
Identity & id)
|
Identity & id)
|
||||||
:
|
:
|
||||||
Kernel::Object { *this },
|
Kernel::Object { *this },
|
||||||
Cpu_job(Cpu_priority::min(), 0),
|
Cpu_job(Cpu_priority::min(), 0),
|
||||||
_user_irq_pool(user_irq_pool),
|
_user_irq_pool(user_irq_pool),
|
||||||
_state(state),
|
_state(data),
|
||||||
_context(context),
|
_context(context),
|
||||||
_id(id),
|
_id(id),
|
||||||
_vcpu_context(cpu)
|
_vcpu_context(cpu)
|
||||||
|
@ -32,6 +32,7 @@ namespace Board {
|
|||||||
struct Vcpu_context;
|
struct Vcpu_context;
|
||||||
|
|
||||||
using Vm_state = Genode::Vm_state;
|
using Vm_state = Genode::Vm_state;
|
||||||
|
using Vm_data = Genode::Vm_data;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VCPU_MAX = 16
|
VCPU_MAX = 16
|
||||||
|
@ -36,14 +36,14 @@ using Board::Vmcb;
|
|||||||
|
|
||||||
Vm::Vm(Irq::Pool & user_irq_pool,
|
Vm::Vm(Irq::Pool & user_irq_pool,
|
||||||
Cpu & cpu,
|
Cpu & cpu,
|
||||||
Genode::Vm_state & state,
|
Genode::Vm_data & data,
|
||||||
Kernel::Signal_context & context,
|
Kernel::Signal_context & context,
|
||||||
Identity & id)
|
Identity & id)
|
||||||
:
|
:
|
||||||
Kernel::Object { *this },
|
Kernel::Object { *this },
|
||||||
Cpu_job(Cpu_priority::min(), 0),
|
Cpu_job(Cpu_priority::min(), 0),
|
||||||
_user_irq_pool(user_irq_pool),
|
_user_irq_pool(user_irq_pool),
|
||||||
_state(state),
|
_state(data),
|
||||||
_context(context),
|
_context(context),
|
||||||
_id(id),
|
_id(id),
|
||||||
_vcpu_context(cpu)
|
_vcpu_context(cpu)
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include <base/stdint.h>
|
#include <base/stdint.h>
|
||||||
#include <cpu/vcpu_state.h>
|
#include <cpu/vcpu_state.h>
|
||||||
#include <util/mmio.h>
|
#include <util/mmio.h>
|
||||||
|
#include <util/string.h>
|
||||||
|
|
||||||
namespace Board
|
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,
|
Vm_session_component::Vm_session_component(Rpc_entrypoint &ds_ep,
|
||||||
Resources resources,
|
Resources resources,
|
||||||
Label const &,
|
Label const &,
|
||||||
|
@ -92,6 +92,7 @@ class Core::Vm_session_component
|
|||||||
unsigned _vcpu_id_alloc { 0 };
|
unsigned _vcpu_id_alloc { 0 };
|
||||||
|
|
||||||
static size_t _ds_size();
|
static size_t _ds_size();
|
||||||
|
static size_t _alloc_vm_data(Genode::addr_t ds_addr);
|
||||||
|
|
||||||
void * _alloc_table();
|
void * _alloc_table();
|
||||||
void _attach(addr_t phys_addr, addr_t vm_addr, size_t size);
|
void _attach(addr_t phys_addr, addr_t vm_addr, size_t size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user