mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-23 09:15:36 +00:00
vm_session: extensions
- support to create multiple vCPUs - support to implement Vm_session methods client side within base library - adjust muen specific virtualbox4 version to compile/link Issue #3111
This commit is contained in:
committed by
Norman Feske
parent
c5786b212b
commit
0c24e1efdc
@ -14,8 +14,10 @@
|
||||
#ifndef _SRC__SERVER__VMM__INCLUDE__MMU_H_
|
||||
#define _SRC__SERVER__VMM__INCLUDE__MMU_H_
|
||||
|
||||
/* base includes */
|
||||
#include <cpu/vm_state.h>
|
||||
|
||||
/* local includes */
|
||||
#include <vm_state.h>
|
||||
#include <ram.h>
|
||||
|
||||
class Mmu
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include <rom_session/connection.h>
|
||||
#include <vm_session/connection.h>
|
||||
#include <util/noncopyable.h>
|
||||
#include <cpu/vm_state.h>
|
||||
|
||||
/* local includes */
|
||||
#include <vm_state.h>
|
||||
#include <ram.h>
|
||||
|
||||
namespace Genode
|
||||
@ -70,8 +70,8 @@ class Genode::Vm_base : Noncopyable, Interface
|
||||
Board_revision const _board;
|
||||
Ram const _ram;
|
||||
Vm_connection _vm { _env };
|
||||
Vm_state &_state { *(Vm_state*)_env.rm()
|
||||
.attach(_vm.cpu_state()) };
|
||||
Vm_session::Vcpu_id _vcpu_id;
|
||||
Vm_state &_state { *(Vm_state*)_env.rm().attach(_vm.cpu_state(_vcpu_id)) };
|
||||
|
||||
void _load_kernel();
|
||||
|
||||
@ -90,13 +90,12 @@ class Genode::Vm_base : Noncopyable, Interface
|
||||
size_t ram_size,
|
||||
off_t kernel_off,
|
||||
Machine_type machine,
|
||||
Board_revision board);
|
||||
Board_revision board,
|
||||
Allocator &alloc,
|
||||
Vm_handler_base &handler);
|
||||
|
||||
void exception_handler(Signal_context_capability handler) {
|
||||
_vm.exception_handler(handler); }
|
||||
|
||||
void run() { _vm.run(); }
|
||||
void pause() { _vm.pause(); }
|
||||
void run() { _vm.run(_vcpu_id); }
|
||||
void pause() { _vm.pause(_vcpu_id); }
|
||||
|
||||
void start();
|
||||
void dump();
|
||||
|
@ -44,7 +44,7 @@ class Main
|
||||
Vm::Kernel_name const _kernel_name { "linux" };
|
||||
Vm::Command_line const _cmd_line { "console=ttymxc0,115200" };
|
||||
Attached_rom_dataspace _config { _env, "config" };
|
||||
Signal_handler<Main> _exception_handler { _env.ep(), *this,
|
||||
Vm_handler<Main> _exception_handler { _env.ep(), *this,
|
||||
&Main::_handle_exception };
|
||||
|
||||
Heap _heap { &_env.ram(), &_env.rm() };
|
||||
@ -52,7 +52,8 @@ class Main
|
||||
Trustzone::NONSECURE_RAM_BASE,
|
||||
Trustzone::NONSECURE_RAM_SIZE,
|
||||
KERNEL_OFFSET, Machine_type(MACHINE_QSB),
|
||||
Board_revision(BOARD_QSB) };
|
||||
Board_revision(BOARD_QSB),
|
||||
_heap, _exception_handler };
|
||||
M4if _m4if { _env, Imx53::M4IF_BASE, Imx53::M4IF_SIZE };
|
||||
Serial_driver _serial { _env.ram() };
|
||||
Block_driver _block { _env.ep(), _config.xml(), _heap, _vm };
|
||||
@ -106,7 +107,6 @@ class Main
|
||||
log("Start virtual machine ...");
|
||||
_m4if.set_region0(Trustzone::SECURE_RAM_BASE,
|
||||
Trustzone::SECURE_RAM_SIZE);
|
||||
_vm.exception_handler(_exception_handler);
|
||||
_vm.start();
|
||||
_vm.run();
|
||||
}
|
||||
|
@ -46,8 +46,12 @@ class Genode::Vm : public Vm_base
|
||||
size_t ram_sz,
|
||||
off_t kernel_off,
|
||||
Machine_type mach,
|
||||
Board_revision board)
|
||||
: Vm_base(env, kernel, cmdl, ram, ram_sz, kernel_off, mach, board) { }
|
||||
Board_revision board,
|
||||
Allocator &alloc,
|
||||
Vm_handler_base &handler)
|
||||
: Vm_base(env, kernel, cmdl, ram, ram_sz, kernel_off, mach, board,
|
||||
alloc, handler)
|
||||
{ }
|
||||
|
||||
void on_vmm_exit() { }
|
||||
void on_vmm_entry() { };
|
||||
|
@ -50,8 +50,12 @@ class Genode::Vm : public Vm_base
|
||||
size_t ram_sz,
|
||||
off_t kernel_off,
|
||||
Machine_type mach,
|
||||
Board_revision board)
|
||||
: Vm_base(env, kernel, cmdl, ram, ram_sz, kernel_off, mach, board) { }
|
||||
Board_revision board,
|
||||
Allocator &alloc,
|
||||
Vm_handler_base &handler)
|
||||
: Vm_base(env, kernel, cmdl, ram, ram_sz, kernel_off, mach, board,
|
||||
alloc, handler)
|
||||
{ }
|
||||
|
||||
void on_vmm_exit() { _led.write(true); }
|
||||
void on_vmm_entry();
|
||||
|
@ -38,10 +38,13 @@ Vm_base::Vm_base(Env &env,
|
||||
size_t ram_size,
|
||||
off_t kernel_off,
|
||||
Machine_type machine,
|
||||
Board_revision board)
|
||||
Board_revision board,
|
||||
Allocator &alloc,
|
||||
Vm_handler_base &handler)
|
||||
:
|
||||
_env(env), _kernel(kernel), _cmdline(cmdline), _kernel_off(kernel_off),
|
||||
_machine(machine), _board(board), _ram(env, ram_base, ram_size)
|
||||
_machine(machine), _board(board), _ram(env, ram_base, ram_size),
|
||||
_vcpu_id(_vm.create_vcpu(alloc, env, handler))
|
||||
{
|
||||
_state.irq_injection = 0;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/component.h>
|
||||
#include <base/exception.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <cpu/cpu_state.h>
|
||||
#include <drivers/defs/exynos5.h>
|
||||
@ -26,7 +27,7 @@
|
||||
#include <util/mmio.h>
|
||||
#include <vm_session/connection.h>
|
||||
|
||||
#include <vm_state.h>
|
||||
#include <cpu/vm_state.h>
|
||||
#include <board.h>
|
||||
|
||||
|
||||
@ -119,11 +120,13 @@ class Vm {
|
||||
DTB_OFFSET = 64 * 1024 * 1024,
|
||||
};
|
||||
|
||||
Genode::Vm_connection _vm_con;
|
||||
Genode::Vm_connection _vm;
|
||||
Genode::Attached_rom_dataspace _kernel_rom;
|
||||
Genode::Attached_rom_dataspace _dtb_rom;
|
||||
Genode::Attached_ram_dataspace _vm_ram;
|
||||
Ram _ram;
|
||||
Genode::Heap _heap;
|
||||
Genode::Vm_session::Vcpu_id _vcpu_id;
|
||||
State & _state;
|
||||
bool _active = true;
|
||||
|
||||
@ -170,20 +173,21 @@ class Vm {
|
||||
|
||||
|
||||
Vm(const char *kernel, const char *dtb, Genode::size_t const ram_size,
|
||||
Genode::Signal_context_capability sig_cap, Genode::Env & env)
|
||||
: _vm_con(env),
|
||||
Genode::Vm_handler_base &handler, Genode::Env & env)
|
||||
: _vm(env),
|
||||
_kernel_rom(env, kernel),
|
||||
_dtb_rom(env, dtb),
|
||||
_vm_ram(env.ram(), env.rm(), ram_size, Genode::UNCACHED),
|
||||
_ram(RAM_ADDRESS, ram_size, (Genode::addr_t)_vm_ram.local_addr<void>()),
|
||||
_state(*((State*)env.rm().attach(_vm_con.cpu_state())))
|
||||
_heap(env.ram(), env.rm()),
|
||||
_vcpu_id(_vm.create_vcpu(_heap, env, handler)),
|
||||
_state(*((State*)env.rm().attach(_vm.cpu_state(_vcpu_id))))
|
||||
{
|
||||
Genode::log("ram is at ",
|
||||
Genode::Hex(Genode::Dataspace_client(_vm_ram.cap()).phys_addr()));
|
||||
|
||||
_vm_con.exception_handler(sig_cap);
|
||||
_vm_con.attach(_vm_ram.cap(), RAM_ADDRESS);
|
||||
_vm_con.attach_pic(0x2C002000);
|
||||
_vm.attach(_vm_ram.cap(), RAM_ADDRESS);
|
||||
_vm.attach_pic(0x2C002000);
|
||||
}
|
||||
|
||||
void start()
|
||||
@ -209,8 +213,8 @@ class Vm {
|
||||
Genode::log("ready to run");
|
||||
}
|
||||
|
||||
void run() { if (_active) _vm_con.run(); }
|
||||
void pause() { _vm_con.pause(); }
|
||||
void run() { if (_active) _vm.run(_vcpu_id); }
|
||||
void pause() { _vm.pause(_vcpu_id); }
|
||||
void wait_for_interrupt() { _active = false; }
|
||||
void interrupt() { _active = true; }
|
||||
bool active() { return _active; }
|
||||
@ -265,9 +269,9 @@ class Vmm
|
||||
private:
|
||||
|
||||
template <typename T>
|
||||
struct Signal_handler : Genode::Signal_handler<Signal_handler<T>>
|
||||
struct Signal_handler : Genode::Vm_handler<Signal_handler<T>>
|
||||
{
|
||||
using Base = Genode::Signal_handler<Signal_handler<T>>;
|
||||
using Base = Genode::Vm_handler<Signal_handler<T>>;
|
||||
|
||||
Vmm & vmm;
|
||||
T & obj;
|
||||
|
Reference in New Issue
Block a user