mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
parent
73837ef56a
commit
0a32fcf4e0
@ -211,20 +211,19 @@ set config_of_app {
|
||||
<binary name="virtualbox"/>
|
||||
<resource name="RAM" quantum="1280M"/>
|
||||
<config vbox_file="vm_auto_share.vbox" vm_name="AutoDisk">
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> <rtc/> </dir>
|
||||
<rom name="vm_auto_share.vbox"/>}
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> <rtc/> </dir>
|
||||
<rom name="vm_auto_share.vbox"/>}
|
||||
|
||||
append_if [expr $use_ram_fs] config_of_app {
|
||||
<dir name="ram"> <fs label="from_ram_fs"/> </dir>}
|
||||
<dir name="ram"> <fs label="from_ram_fs"/> </dir>}
|
||||
|
||||
append config_of_app {
|
||||
<dir name="from"> <fs label="share_ram_fs_from"/> </dir>
|
||||
<dir name="to"> <fs label="share_ram_fs_to"/> </dir>
|
||||
<fs/>
|
||||
</vfs>
|
||||
</libc>
|
||||
<dir name="from"> <fs label="share_ram_fs_from"/> </dir>
|
||||
<dir name="to"> <fs label="share_ram_fs_to"/> </dir>
|
||||
<fs/>
|
||||
</vfs>
|
||||
</config>
|
||||
<route>
|
||||
<service name="Report"> <child name="report_rom"/> </service>}
|
||||
|
@ -252,30 +252,29 @@ for { set i 1} { $i <= $use_vms } { incr i} {
|
||||
<config ld_verbose=\"yes\" vbox_file=\"${vbox_file}\" vm_name=\"${flavor}\" xhci=\"no\">"
|
||||
}
|
||||
append config_of_app {
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc">
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/> <rtc/>}
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
<vfs>
|
||||
<dir name="dev">
|
||||
<log/> <rtc/>}
|
||||
|
||||
append_if [expr !$use_rumpfs] config_of_app {
|
||||
<block name="sda3" label="raw" block_buffer_count="128" />}
|
||||
<block name="sda3" label="raw" block_buffer_count="128" />}
|
||||
append config_of_app {
|
||||
</dir>}
|
||||
</dir>}
|
||||
|
||||
append_if [expr $use_ram_fs] config_of_app {
|
||||
<dir name="ram"> <fs label="from_ram_fs"/> </dir>}
|
||||
<dir name="ram"> <fs label="from_ram_fs"/> </dir>}
|
||||
|
||||
append config_of_app "
|
||||
<rom name=\"${vbox_file}\"/>"
|
||||
<rom name=\"${vbox_file}\"/>"
|
||||
append_if [expr !$use_rumpfs] config_of_app "
|
||||
<rom name=\"${raw_image}\"/>"
|
||||
<rom name=\"${raw_image}\"/>"
|
||||
|
||||
append_if [expr $use_rumpfs || $use_ram_fs] config_of_app {
|
||||
<fs />}
|
||||
<fs />}
|
||||
|
||||
append config_of_app {
|
||||
</vfs>
|
||||
</libc>
|
||||
</vfs>
|
||||
</config>
|
||||
<route>}
|
||||
|
||||
|
@ -119,18 +119,17 @@ append config {
|
||||
<start name="virtualbox" priority="-2">
|
||||
<resource name="RAM" quantum="448M"/>
|
||||
<config vbox_file="test.vbox" vm_name="TestVM">
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc">
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> <rtc/> </dir>}
|
||||
<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
|
||||
<vfs>
|
||||
<dir name="dev"> <log/> <rtc/> </dir>}
|
||||
|
||||
append_if [expr $use_serial] config {
|
||||
<dir name="dev"> <terminal/> </dir>}
|
||||
<dir name="dev"> <terminal/> </dir>}
|
||||
|
||||
append config {
|
||||
<rom name="test.vbox" />
|
||||
<rom name="test.iso" />
|
||||
</vfs>
|
||||
</libc>
|
||||
<rom name="test.vbox" />
|
||||
<rom name="test.iso" />
|
||||
</vfs>
|
||||
</config>
|
||||
</start>
|
||||
</config>
|
||||
|
@ -94,7 +94,7 @@ void Component::construct(Genode::Env &env)
|
||||
|
||||
typedef Vcpu_dispatcher<Vmm::Vcpu_other_pd> Vcpu_o;
|
||||
|
||||
static Genode::Pd_connection remote_pd("VM");
|
||||
static Genode::Pd_connection remote_pd(env, "VM");
|
||||
static Vcpu_o vcpu_o_1(env, Vcpu_o::SVM, "vcpu_o_1", remote_pd);
|
||||
static Vcpu_o vcpu_o_2(env, Vcpu_o::SVM, "vcpu_o_2", remote_pd);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void genode_update_tsc(void (*update_func)(void), unsigned long update_us)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
Timer::Connection timer;
|
||||
Timer::Connection timer(genode_env());
|
||||
Signal_context sig_ctx;
|
||||
Signal_receiver sig_rec;
|
||||
Signal_context_capability sig_cap = sig_rec.manage(&sig_ctx);
|
||||
|
@ -30,6 +30,8 @@ extern "C" {
|
||||
#include "audio_int.h"
|
||||
}
|
||||
|
||||
/* VBox Genode specific */
|
||||
#include "vmm.h"
|
||||
|
||||
template <size_t CAPACITY>
|
||||
struct A_ring_buffer_to_bind_them
|
||||
@ -278,12 +280,12 @@ static int genode_init_out(HWVoiceOut *hw, audsettings_t *as)
|
||||
|
||||
for (int i = 0; i < VBOX_CHANNELS; i++) {
|
||||
try {
|
||||
out->audio[i] = new (Genode::env()->heap())
|
||||
Audio_out::Connection(channel_names[i]);
|
||||
out->audio[i] = new (vmm_heap())
|
||||
Audio_out::Connection(genode_env(), channel_names[i]);
|
||||
} catch (...) {
|
||||
Genode::error("could not establish Audio_out connection");
|
||||
while (--i > 0)
|
||||
Genode::destroy(Genode::env()->heap(), out->audio[i]);
|
||||
Genode::destroy(vmm_heap(), out->audio[i]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -306,7 +308,7 @@ static void genode_fini_out(HWVoiceOut *hw)
|
||||
{
|
||||
GenodeVoiceOut * const out = (GenodeVoiceOut *)hw;
|
||||
for (int i = 0; i < VBOX_CHANNELS; i++)
|
||||
Genode::destroy(Genode::env()->heap(), out->audio[i]);
|
||||
Genode::destroy(vmm_heap(), out->audio[i]);
|
||||
}
|
||||
|
||||
|
||||
@ -339,7 +341,7 @@ static int genode_init_in(HWVoiceIn *hw, audsettings_t *as)
|
||||
GenodeVoiceIn *in = (GenodeVoiceIn*)hw;
|
||||
|
||||
try {
|
||||
in->audio = new (Genode::env()->heap()) Audio_in::Connection("left");
|
||||
in->audio = new (vmm_heap()) Audio_in::Connection("left");
|
||||
} catch (...) {
|
||||
Genode::error("could not establish Audio_in connection");
|
||||
return -1;
|
||||
@ -362,7 +364,7 @@ static int genode_init_in(HWVoiceIn *hw, audsettings_t *as)
|
||||
static void genode_fini_in(HWVoiceIn *hw)
|
||||
{
|
||||
GenodeVoiceIn * const in = (GenodeVoiceIn*)hw;
|
||||
Genode::destroy(Genode::env()->heap(), in->audio);
|
||||
Genode::destroy(vmm_heap(), in->audio);
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,12 +12,13 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <VBoxDD.h>
|
||||
#include <VBoxDD2.h>
|
||||
|
||||
#include "vmm.h"
|
||||
|
||||
#define REGISTER(device) \
|
||||
do { \
|
||||
@ -79,7 +80,7 @@ extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
||||
static bool read_force_ioapic_from_config()
|
||||
{
|
||||
try {
|
||||
Genode::Attached_rom_dataspace config("config");
|
||||
Genode::Attached_rom_dataspace config(genode_env(), "config");
|
||||
return config.xml().attribute_value("force_ioapic", false);
|
||||
} catch (Genode::Rom_connection::Rom_connection_failed) {
|
||||
return false;
|
||||
|
@ -13,9 +13,8 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <util/list.h>
|
||||
|
||||
/* qemu-usb includes */
|
||||
@ -44,6 +43,8 @@
|
||||
#include <VBox/vusb.h>
|
||||
#include <VBoxDD.h>
|
||||
|
||||
/* VBox Genode specific */
|
||||
#include "vmm.h"
|
||||
|
||||
static bool const verbose_timer = false;
|
||||
|
||||
@ -115,7 +116,7 @@ struct Timer_queue : public Qemu::Timer_queue
|
||||
|
||||
void _append_new_context(void *qtimer, void (*cb)(void*), void *data)
|
||||
{
|
||||
Context *new_ctx = new (Genode::env()->heap()) Context(qtimer, cb, data);
|
||||
Context *new_ctx = new (vmm_heap()) Context(qtimer, cb, data);
|
||||
|
||||
_context_list.insert(new_ctx);
|
||||
}
|
||||
@ -255,7 +256,7 @@ struct Timer_queue : public Qemu::Timer_queue
|
||||
_deactivate_timer(qtimer);
|
||||
|
||||
_context_list.remove(c);
|
||||
Genode::destroy(Genode::env()->heap(), c);
|
||||
Genode::destroy(vmm_heap(), c);
|
||||
}
|
||||
|
||||
void activate_timer(void *qtimer, long long int expire_abs) override
|
||||
@ -453,8 +454,8 @@ static DECLCALLBACK(int) xhciR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFG
|
||||
PXHCI pThis = PDMINS_2_DATA(pDevIns, PXHCI);
|
||||
PDMDEV_CHECK_VERSIONS_RETURN(pDevIns);
|
||||
|
||||
pThis->usb_sig_rec = new (Genode::env()->heap()) Genode::Signal_receiver();
|
||||
pThis->destruction_helper = new (Genode::env()->heap())
|
||||
pThis->usb_sig_rec = new (vmm_heap()) Genode::Signal_receiver();
|
||||
pThis->destruction_helper = new (vmm_heap())
|
||||
Destruction_helper(*(pThis->usb_sig_rec));
|
||||
|
||||
int rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, Timer_queue::tm_timer_cb,
|
||||
@ -575,7 +576,7 @@ const PDMDEVREG g_DeviceXHCI =
|
||||
bool use_xhci_controller()
|
||||
{
|
||||
try {
|
||||
Genode::Attached_rom_dataspace config("config");
|
||||
Genode::Attached_rom_dataspace config(genode_env(), "config");
|
||||
return config.xml().attribute_value("xhci", false);
|
||||
} catch (Genode::Rom_connection::Rom_connection_failed) {
|
||||
return false;
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "fb.h"
|
||||
#include "../vmm.h"
|
||||
|
||||
static const bool debug = false;
|
||||
|
||||
@ -134,7 +135,7 @@ void fireStateChangedEvent(IEventSource* aSource,
|
||||
if (a_state != MachineState_PoweredOff)
|
||||
return;
|
||||
|
||||
Genode::env()->parent()->exit(0);
|
||||
genode_env().parent().exit(0);
|
||||
}
|
||||
|
||||
void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal,
|
||||
@ -348,7 +349,7 @@ void GenodeConsole::init_clipboard()
|
||||
if (mode == ClipboardMode_Bidirectional ||
|
||||
mode == ClipboardMode_HostToGuest) {
|
||||
|
||||
_clipboard_rom = new Genode::Attached_rom_dataspace("clipboard");
|
||||
_clipboard_rom = new Genode::Attached_rom_dataspace(genode_env(), "clipboard");
|
||||
_clipboard_rom->sigh(_clipboard_signal_dispatcher);
|
||||
|
||||
clipboard_rom = _clipboard_rom;
|
||||
@ -357,7 +358,7 @@ void GenodeConsole::init_clipboard()
|
||||
if (mode == ClipboardMode_Bidirectional ||
|
||||
mode == ClipboardMode_GuestToHost) {
|
||||
|
||||
_clipboard_reporter = new Genode::Reporter("clipboard");
|
||||
_clipboard_reporter = new Genode::Reporter(genode_env(), "clipboard");
|
||||
_clipboard_reporter->enabled(true);
|
||||
|
||||
clipboard_reporter = _clipboard_reporter;
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <input/event.h>
|
||||
#include <input/keycodes.h>
|
||||
#include <input_session/connection.h>
|
||||
#include <os/attached_dataspace.h>
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/reporter.h>
|
||||
#include <report_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
@ -29,10 +29,11 @@
|
||||
/* repos/ports includes */
|
||||
#include <vbox_pointer/shape_report.h>
|
||||
|
||||
#include "../vmm.h"
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include "ConsoleImpl.h"
|
||||
|
||||
|
||||
class Scan_code
|
||||
{
|
||||
private:
|
||||
@ -139,10 +140,12 @@ class GenodeConsole : public Console {
|
||||
GenodeConsole()
|
||||
:
|
||||
Console(),
|
||||
_input(genode_env()),
|
||||
_ax(0), _ay(0),
|
||||
_last_received_motion_event_was_absolute(false),
|
||||
_shape_report_connection("shape", sizeof(Vbox_pointer::Shape_report)),
|
||||
_shape_report_ds(_shape_report_connection.dataspace()),
|
||||
_shape_report_connection(genode_env(), "shape",
|
||||
sizeof(Vbox_pointer::Shape_report)),
|
||||
_shape_report_ds(genode_env().rm(), _shape_report_connection.dataspace()),
|
||||
_shape_report(_shape_report_ds.local_addr<Vbox_pointer::Shape_report>()),
|
||||
_clipboard_reporter(nullptr),
|
||||
_clipboard_rom(nullptr),
|
||||
|
@ -26,6 +26,7 @@ class Genodefb :
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
Fb_Genode::Connection _fb;
|
||||
|
||||
/* The mode matching the currently attached dataspace */
|
||||
@ -52,12 +53,14 @@ class Genodefb :
|
||||
|
||||
public:
|
||||
|
||||
Genodefb ()
|
||||
Genodefb (Genode::Env &env)
|
||||
:
|
||||
_env(env),
|
||||
_fb(env, Fb_Genode::Mode(0, 0, Fb_Genode::Mode::INVALID)),
|
||||
_fb_mode(_fb.mode()),
|
||||
_next_fb_mode(_fb_mode),
|
||||
_virtual_fb_mode(_fb_mode),
|
||||
_fb_base(Genode::env()->rm_session()->attach(_fb.dataspace()))
|
||||
_fb_base(env.rm().attach(_fb.dataspace()))
|
||||
{
|
||||
int rc = RTCritSectInit(&_fb_lock);
|
||||
Assert(rc == VINF_SUCCESS);
|
||||
@ -165,9 +168,9 @@ class Genodefb :
|
||||
|
||||
_virtual_fb_mode = Fb_Genode::Mode(w, h, Fb_Genode::Mode::RGB565);
|
||||
|
||||
Genode::env()->rm_session()->detach(_fb_base);
|
||||
_env.rm().detach(_fb_base);
|
||||
|
||||
_fb_base = Genode::env()->rm_session()->attach(_fb.dataspace());
|
||||
_fb_base = _env.rm().attach(_fb.dataspace());
|
||||
|
||||
result = S_OK;
|
||||
|
||||
|
@ -14,9 +14,10 @@
|
||||
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <libc/component.h>
|
||||
#include <os/config.h>
|
||||
|
||||
/* Virtualbox includes */
|
||||
#include <iprt/initterm.h>
|
||||
@ -87,7 +88,7 @@ RTDECL(int) RTPathUserHome(char *pszPath, size_t cchPath)
|
||||
}
|
||||
|
||||
|
||||
HRESULT setupmachine()
|
||||
HRESULT setupmachine(Genode::Env &env)
|
||||
{
|
||||
HRESULT rc;
|
||||
|
||||
@ -152,7 +153,7 @@ HRESULT setupmachine()
|
||||
unsigned uScreenId;
|
||||
for (uScreenId = 0; uScreenId < cMonitors; uScreenId++)
|
||||
{
|
||||
Genodefb *fb = new Genodefb();
|
||||
Genodefb *fb = new Genodefb(env);
|
||||
display->SetFramebuffer(uScreenId, fb);
|
||||
}
|
||||
|
||||
@ -194,7 +195,7 @@ HRESULT setupmachine()
|
||||
}
|
||||
|
||||
|
||||
static Genode::Env *genode_env_ptr;
|
||||
static Genode::Env *genode_env_ptr = nullptr;
|
||||
|
||||
|
||||
Genode::Env &genode_env()
|
||||
@ -207,6 +208,13 @@ Genode::Env &genode_env()
|
||||
}
|
||||
|
||||
|
||||
Genode::Allocator &vmm_heap()
|
||||
{
|
||||
static Genode::Heap heap (genode_env().ram(), genode_env().rm());
|
||||
return heap;
|
||||
}
|
||||
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
/* make Genode environment accessible via the global 'genode_env()' */
|
||||
@ -215,10 +223,10 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
try {
|
||||
using namespace Genode;
|
||||
|
||||
Xml_node node = config()->xml_node();
|
||||
Xml_node::Attribute vbox_file = node.attribute("vbox_file");
|
||||
Attached_rom_dataspace config(env, "config");
|
||||
Xml_node::Attribute vbox_file = config.xml().attribute("vbox_file");
|
||||
vbox_file.value(c_vbox_file, sizeof(c_vbox_file));
|
||||
Xml_node::Attribute vm_name = node.attribute("vm_name");
|
||||
Xml_node::Attribute vm_name = config.xml().attribute("vm_name");
|
||||
vm_name.value(c_vbox_vmname, sizeof(c_vbox_vmname));
|
||||
} catch (...) {
|
||||
Genode::error("missing attributes in configuration, minimum requirements: ");
|
||||
@ -237,7 +245,7 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
if (RT_FAILURE(rc))
|
||||
throw -1;
|
||||
|
||||
HRESULT hrc = setupmachine();
|
||||
HRESULT hrc = setupmachine(env);
|
||||
if (FAILED(hrc)) {
|
||||
Genode::error("startup of VMM failed - reason ", hrc, " - exiting ...");
|
||||
throw -2;
|
||||
|
@ -16,29 +16,19 @@
|
||||
#ifndef _GUEST_MEMORY_H_
|
||||
#define _GUEST_MEMORY_H_
|
||||
|
||||
/*
|
||||
* Work-around for a naming conflict between the enum definition of PAGE_SIZE
|
||||
* in 'os/attached_ram_dataspace.h' and the VirtualBox #define with the same
|
||||
* name.
|
||||
*/
|
||||
#define BACKUP_PAGESIZE PAGE_SIZE
|
||||
#undef PAGE_SIZE
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/lock.h>
|
||||
#include <base/log.h>
|
||||
#include <util/flex_iterator.h>
|
||||
#include <util/list.h>
|
||||
#include <os/attached_ram_dataspace.h>
|
||||
|
||||
#include "vmm.h"
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <VBox/vmm/pgm.h>
|
||||
#include <VBox/vmm/iom.h>
|
||||
#include <VBox/vmm/pdmdev.h>
|
||||
|
||||
#define PAGE_SIZE BACKUP_PAGESIZE
|
||||
|
||||
|
||||
class Guest_memory
|
||||
{
|
||||
@ -246,7 +236,7 @@ class Guest_memory
|
||||
/*
|
||||
* XXX check for overlapping regions
|
||||
*/
|
||||
_ram_regions.insert(new (Genode::env()->heap())
|
||||
_ram_regions.insert(new (vmm_heap())
|
||||
Region(GCPhys, cb, pv, 0, 0, 0, 0, 0, 0));
|
||||
}
|
||||
|
||||
@ -259,7 +249,7 @@ class Guest_memory
|
||||
/*
|
||||
* XXX check for overlapping regions
|
||||
*/
|
||||
_rom_regions.insert(new (Genode::env()->heap())
|
||||
_rom_regions.insert(new (vmm_heap())
|
||||
Region(GCPhys, cb,
|
||||
(void *)pv, pDevIns, 0, 0, 0, 0, 0));
|
||||
}
|
||||
@ -278,7 +268,7 @@ class Guest_memory
|
||||
/*
|
||||
* XXX check for overlapping regions
|
||||
*/
|
||||
_mmio_regions.insert(new (Genode::env()->heap())
|
||||
_mmio_regions.insert(new (vmm_heap())
|
||||
Region(GCPhys, cb, 0,
|
||||
pDevIns, pvUser, pfnWriteCallback,
|
||||
pfnReadCallback, pfnFillCallback, fFlags));
|
||||
|
@ -15,13 +15,14 @@
|
||||
#include <util/list.h>
|
||||
#include <base/log.h>
|
||||
#include <base/lock.h>
|
||||
#include <base/env.h>
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <VBox/vmm/iom.h>
|
||||
#include <VBox/err.h>
|
||||
#include <VBox/vmm/pdmdev.h>
|
||||
|
||||
#include "vmm.h"
|
||||
|
||||
static bool verbose = false;
|
||||
|
||||
class Guest_ioports
|
||||
@ -169,7 +170,7 @@ class Guest_ioports
|
||||
Genode::Hex(cPorts), " - '",
|
||||
pDevIns && pDevIns->pReg ? pDevIns->pReg->szName : 0, "'");
|
||||
|
||||
_ranges.insert(new (Genode::env()->heap())
|
||||
_ranges.insert(new (vmm_heap())
|
||||
Range(pDevIns, PortStart, cPorts, pvUser,
|
||||
pfnOutCallback, pfnInCallback,
|
||||
pfnOutStringCallback, pfnInStringCallback));
|
||||
@ -203,7 +204,7 @@ class Guest_ioports
|
||||
r = r->next();
|
||||
_ranges.remove(s);
|
||||
|
||||
destroy(Genode::env()->heap(), s);
|
||||
destroy(vmm_heap(), s);
|
||||
}
|
||||
|
||||
return deleted ? VINF_SUCCESS : VERR_GENERAL_FAILURE;
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include "util.h"
|
||||
#include "mm.h"
|
||||
|
||||
#include "vmm.h"
|
||||
|
||||
static struct {
|
||||
Sub_rm_connection * conn;
|
||||
@ -56,7 +56,7 @@ static Libc::Mem_alloc * heap_by_mmtag(MMTAG enmTag)
|
||||
if (memory_regions[enmTag].conn)
|
||||
return memory_regions[enmTag].heap;
|
||||
|
||||
memory_regions[enmTag].conn = new Sub_rm_connection(REGION_SIZE);
|
||||
memory_regions[enmTag].conn = new Sub_rm_connection(genode_env(), REGION_SIZE);
|
||||
memory_regions[enmTag].heap = new Libc::Mem_alloc_impl(memory_regions[enmTag].conn);
|
||||
|
||||
return memory_regions[enmTag].heap;
|
||||
|
@ -35,10 +35,11 @@ class Sub_rm_connection : private Genode::Rm_connection,
|
||||
|
||||
public:
|
||||
|
||||
Sub_rm_connection(Genode::size_t size)
|
||||
Sub_rm_connection(Genode::Env &env, Genode::size_t size)
|
||||
:
|
||||
Rm_connection(env),
|
||||
Genode::Region_map_client(Rm_connection::create(size)),
|
||||
_offset(Genode::env()->rm_session()->attach(dataspace())),
|
||||
_offset(env.rm().attach(dataspace())),
|
||||
_size(size)
|
||||
{ }
|
||||
|
||||
|
@ -41,6 +41,9 @@
|
||||
#include <nic/packet_allocator.h>
|
||||
#include <base/snprintf.h>
|
||||
|
||||
/* VBox Genode specific */
|
||||
#include "vmm.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* Structures and Typedefs *
|
||||
*******************************************************************************/
|
||||
@ -155,16 +158,15 @@ class Nic_client
|
||||
|
||||
static Nic::Packet_allocator* _packet_allocator()
|
||||
{
|
||||
using namespace Genode;
|
||||
return new (env()->heap())Nic::Packet_allocator(env()->heap());
|
||||
return new (vmm_heap()) Nic::Packet_allocator(&vmm_heap());
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Nic_client(PDRVNIC drvtap, char const *label)
|
||||
Nic_client(Genode::Env &env, PDRVNIC drvtap, char const *label)
|
||||
:
|
||||
_tx_block_alloc(_packet_allocator()),
|
||||
_nic(_tx_block_alloc, BUF_SIZE, BUF_SIZE, label),
|
||||
_nic(env, _tx_block_alloc, BUF_SIZE, BUF_SIZE, label),
|
||||
_link_state_dispatcher(_sig_rec, *this, &Nic_client::_handle_link_state),
|
||||
_rx_packet_avail_dispatcher(_sig_rec, *this, &Nic_client::_handle_rx_packet_avail),
|
||||
_rx_ready_to_ack_dispatcher(_sig_rec, *this, &Nic_client::_handle_rx_ready_to_ack),
|
||||
@ -175,8 +177,7 @@ class Nic_client
|
||||
|
||||
~Nic_client()
|
||||
{
|
||||
using namespace Genode;
|
||||
destroy(env()->heap(), _tx_block_alloc);
|
||||
destroy(vmm_heap(), _tx_block_alloc);
|
||||
}
|
||||
|
||||
void enable_signals()
|
||||
@ -478,7 +479,7 @@ static DECLCALLBACK(void) drvNicDestruct(PPDMDRVINS pDrvIns)
|
||||
destruct_lock()->lock();
|
||||
|
||||
if (nic_client)
|
||||
destroy(Genode::env()->heap(), nic_client);
|
||||
destroy(vmm_heap(), nic_client);
|
||||
}
|
||||
|
||||
|
||||
@ -543,7 +544,7 @@ static DECLCALLBACK(int) drvNicConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uin
|
||||
* Setup Genode nic_session connection
|
||||
*/
|
||||
try {
|
||||
pThis->nic_client = new (Genode::env()->heap()) Nic_client(pThis, label);
|
||||
pThis->nic_client = new (vmm_heap()) Nic_client(genode_env(), pThis, label);
|
||||
} catch (...) {
|
||||
return VERR_HOSTIF_INIT_FAILED;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ using Genode::Rm_session;
|
||||
|
||||
Vmm_memory *vmm_memory()
|
||||
{
|
||||
static Vmm_memory inst(*Genode::env()->ram_session());
|
||||
static Vmm_memory inst(genode_env());
|
||||
return &inst;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <base/env.h>
|
||||
#include <base/allocator_avl.h>
|
||||
|
||||
|
||||
@ -27,15 +26,13 @@
|
||||
#include <internal/iprt.h>
|
||||
|
||||
#include "mm.h"
|
||||
#include "vmm.h"
|
||||
|
||||
enum {
|
||||
MEMORY_MAX = 64 * 1024 * 1024,
|
||||
MEMORY_CACHED = 16 * 1024 * 1024,
|
||||
};
|
||||
|
||||
/* using managed dataspace to have all addresses within a 1 << 31 bit range */
|
||||
static Sub_rm_connection rt_memory(2 * MEMORY_MAX);
|
||||
|
||||
class Avl_ds : public Genode::Avl_node<Avl_ds>
|
||||
{
|
||||
private:
|
||||
@ -75,10 +72,10 @@ class Avl_ds : public Genode::Avl_node<Avl_ds>
|
||||
_mem_unused -= _size;
|
||||
_mem_allocated -= _size;
|
||||
|
||||
Genode::env()->ram_session()->free(_ds);
|
||||
genode_env().ram().free(_ds);
|
||||
Genode::log("free up ", _size, " ", _mem_allocated, "/",
|
||||
_mem_unused, " hit=", hit, "/", hit_coarse, " avail=",
|
||||
Genode::env()->ram_session()->avail());
|
||||
genode_env().ram().avail());
|
||||
}
|
||||
|
||||
void unused()
|
||||
@ -143,7 +140,7 @@ class Avl_ds : public Genode::Avl_node<Avl_ds>
|
||||
while (_unused_ds.first() && cbx &&
|
||||
(_mem_allocated + cb > MEMORY_MAX ||
|
||||
_mem_unused + cb > MEMORY_CACHED ||
|
||||
Genode::env()->ram_session()->avail() < cb * 2
|
||||
genode_env().ram().avail() < cb * 2
|
||||
)
|
||||
)
|
||||
{
|
||||
@ -153,7 +150,7 @@ class Avl_ds : public Genode::Avl_node<Avl_ds>
|
||||
continue;
|
||||
}
|
||||
|
||||
destroy(Genode::env()->heap(), ds_free);
|
||||
destroy(vmm_heap(), ds_free);
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,6 +185,9 @@ Genode::addr_t Avl_ds::_mem_unused = 0;
|
||||
|
||||
static void *alloc_mem(size_t cb, const char *pszTag, bool executable = false)
|
||||
{
|
||||
/* using managed dataspace to have all addresses within a 1 << 31 bit range */
|
||||
static Sub_rm_connection rt_memory(genode_env(), 2 * MEMORY_MAX);
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
if (!cb)
|
||||
@ -215,7 +215,7 @@ static void *alloc_mem(size_t cb, const char *pszTag, bool executable = false)
|
||||
Avl_ds::memory_freeup(cb);
|
||||
|
||||
try {
|
||||
Ram_dataspace_capability ds = env()->ram_session()->alloc(cb);
|
||||
Ram_dataspace_capability ds = genode_env().ram().alloc(cb);
|
||||
Assert(ds.valid());
|
||||
|
||||
Genode::size_t const whole_size = 0;
|
||||
@ -229,7 +229,7 @@ static void *alloc_mem(size_t cb, const char *pszTag, bool executable = false)
|
||||
|
||||
Assert(local_addr);
|
||||
|
||||
new (env()->heap()) Avl_ds(ds, local_addr, cb);
|
||||
new (vmm_heap()) Avl_ds(ds, local_addr, cb);
|
||||
|
||||
return local_addr;
|
||||
} catch (...) {
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/stdint.h>
|
||||
#include <os/attached_io_mem_dataspace.h>
|
||||
|
||||
namespace Genode
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <base/env.h>
|
||||
#include <base/lock.h>
|
||||
#include <util/list.h>
|
||||
#include <os/attached_io_mem_dataspace.h>
|
||||
#include <base/attached_io_mem_dataspace.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <muen/sinfo.h>
|
||||
|
||||
@ -33,7 +33,6 @@ struct Mem_region;
|
||||
struct Mem_region : Genode::List<Mem_region>::Element,
|
||||
Genode::Attached_io_mem_dataspace
|
||||
{
|
||||
typedef Genode::Ram_session Ram_session;
|
||||
typedef Genode::size_t size_t;
|
||||
typedef Genode::addr_t addr_t;
|
||||
|
||||
@ -46,7 +45,7 @@ struct Mem_region : Genode::List<Mem_region>::Element,
|
||||
size_t region_size;
|
||||
bool _clear;
|
||||
|
||||
addr_t _phys_base(size_t size)
|
||||
addr_t _phys_base(Genode::Env &env, size_t size)
|
||||
{
|
||||
struct Region_info
|
||||
{
|
||||
@ -77,10 +76,8 @@ struct Mem_region : Genode::List<Mem_region>::Element,
|
||||
Region_info cur_region;
|
||||
|
||||
if (!counter) {
|
||||
Genode::Rom_connection sinfo_rom("subject_info_page");
|
||||
Genode::Sinfo sinfo
|
||||
((addr_t)Genode::env()->rm_session()->attach
|
||||
(sinfo_rom.dataspace()));
|
||||
Genode::Rom_connection sinfo_rom(env, "subject_info_page");
|
||||
Genode::Sinfo sinfo ((addr_t)env.rm().attach (sinfo_rom.dataspace()));
|
||||
|
||||
struct Genode::Sinfo::Memregion_info region1, region4;
|
||||
if (!sinfo.get_memregion_info("vm_ram_1", ®ion1)) {
|
||||
@ -119,10 +116,10 @@ struct Mem_region : Genode::List<Mem_region>::Element,
|
||||
|
||||
size_t size() const { return region_size; }
|
||||
|
||||
Mem_region(Ram_session &ram, size_t size, PPDMDEVINS pDevIns,
|
||||
unsigned iRegion)
|
||||
Mem_region(Genode::Env &env, size_t size,
|
||||
PPDMDEVINS pDevIns, unsigned iRegion)
|
||||
:
|
||||
Attached_io_mem_dataspace(_phys_base(size), size),
|
||||
Attached_io_mem_dataspace(env, _phys_base(env, size), size),
|
||||
pDevIns(pDevIns),
|
||||
iRegion(iRegion),
|
||||
vm_phys(0), pfnHandlerR3(0), pvUserR3(0),
|
||||
|
@ -16,7 +16,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <os/attached_io_mem_dataspace.h>
|
||||
#include <base/attached_io_mem_dataspace.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <muen/sinfo.h>
|
||||
|
||||
@ -75,8 +75,6 @@ enum {
|
||||
cur_state->REG.base = pCtx->REG.u64Base; \
|
||||
cur_state->REG.access = pCtx->REG.Attr.u ? : VMCS_SEG_UNUSABLE
|
||||
|
||||
static Genode::Vm_handler vm_handler;
|
||||
|
||||
struct Subject_state *cur_state;
|
||||
|
||||
Genode::Guest_interrupts *guest_interrupts;
|
||||
@ -92,9 +90,9 @@ static Genode::Sinfo * sinfo()
|
||||
|
||||
if (!ptr) {
|
||||
try {
|
||||
static Rom_connection sinfo_rom("subject_info_page");
|
||||
static Rom_connection sinfo_rom(genode_env(), "subject_info_page");
|
||||
static Sinfo sinfo(
|
||||
(addr_t)env()->rm_session()->attach(sinfo_rom.dataspace()));
|
||||
(addr_t)genode_env().rm().attach(sinfo_rom.dataspace()));
|
||||
ptr = &sinfo;
|
||||
} catch (...) {
|
||||
error("unable to attach Sinfo ROM");
|
||||
@ -123,8 +121,9 @@ bool setup_subject_state()
|
||||
}
|
||||
|
||||
try {
|
||||
static Attached_io_mem_dataspace subject_ds(region.address,
|
||||
region.size);
|
||||
static Attached_io_mem_dataspace subject_ds(genode_env(),
|
||||
region.address,
|
||||
region.size);
|
||||
cur_state = subject_ds.local_addr<struct Subject_state>();
|
||||
return true;
|
||||
} catch (...) {
|
||||
@ -152,8 +151,9 @@ bool setup_subject_interrupts()
|
||||
}
|
||||
|
||||
try {
|
||||
static Attached_io_mem_dataspace subject_intrs(region.address,
|
||||
region.size);
|
||||
static Attached_io_mem_dataspace subject_intrs(genode_env(),
|
||||
region.address,
|
||||
region.size);
|
||||
static Guest_interrupts g((addr_t)subject_intrs.local_addr<addr_t>());
|
||||
guest_interrupts = &g;
|
||||
return true;
|
||||
@ -392,6 +392,8 @@ int SUPR3QueryVTxSupported(void) { return VINF_SUCCESS; }
|
||||
|
||||
int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu)
|
||||
{
|
||||
static Genode::Vm_handler vm_handler(genode_env());
|
||||
|
||||
switch (uOperation) {
|
||||
|
||||
case SUP_VMMR0_DO_HM_RUN:
|
||||
@ -718,7 +720,7 @@ void genode_update_tsc(void (*update_func)(void), unsigned long update_us)
|
||||
{
|
||||
using namespace Genode;
|
||||
|
||||
Timer::Connection timer;
|
||||
Timer::Connection timer(genode_env());
|
||||
Signal_context sig_ctx;
|
||||
Signal_receiver sig_rec;
|
||||
Signal_context_capability sig_cap = sig_rec.manage(&sig_ctx);
|
||||
|
@ -13,7 +13,6 @@
|
||||
#ifndef _VIRTUALBOX__SPEC__MUEN__VM_HANDLER_H_
|
||||
#define _VIRTUALBOX__SPEC__MUEN__VM_HANDLER_H_
|
||||
|
||||
#include <base/env.h>
|
||||
#include <base/signal.h>
|
||||
|
||||
#include <vm_session/vm_session.h>
|
||||
@ -34,21 +33,22 @@ class Genode::Vm_handler
|
||||
|
||||
Vm_connection _vm_session;
|
||||
Signal_context_capability _sig_cap;
|
||||
Signal_receiver *_sig_rcv;
|
||||
Signal_receiver _sig_rcv;
|
||||
Signal_transmitter _sig_xmit;
|
||||
Signal_context _sig_ctx;
|
||||
|
||||
public:
|
||||
|
||||
Vm_handler()
|
||||
Vm_handler(Genode::Env &env)
|
||||
:
|
||||
_vm_session(env)
|
||||
{
|
||||
_sig_rcv = new (env()->heap())Signal_receiver();
|
||||
_sig_cap = _sig_rcv->manage(&_sig_ctx);
|
||||
_sig_cap = _sig_rcv.manage(&_sig_ctx);
|
||||
_sig_xmit.context(_sig_cap);
|
||||
_vm_session.exception_handler(_sig_cap);
|
||||
}
|
||||
|
||||
~Vm_handler() { _sig_rcv->dissolve(&_sig_ctx); }
|
||||
~Vm_handler() { _sig_rcv.dissolve(&_sig_ctx); }
|
||||
|
||||
/**
|
||||
* Starts execution of the Vm and blocks until the Vm returns or the
|
||||
@ -57,7 +57,7 @@ class Genode::Vm_handler
|
||||
void run_vm()
|
||||
{
|
||||
_vm_session.run();
|
||||
_sig_rcv->wait_for_signal();
|
||||
_sig_rcv.wait_for_signal();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <util/flex_iterator.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <trace/timestamp.h>
|
||||
|
||||
#include <vmm/vcpu_thread.h>
|
||||
@ -35,6 +35,7 @@
|
||||
#include <VBox/err.h>
|
||||
|
||||
/* Genode's VirtualBox includes */
|
||||
#include "vmm.h"
|
||||
#include "vcpu.h"
|
||||
#include "vcpu_svm.h"
|
||||
#include "vcpu_vmx.h"
|
||||
@ -64,20 +65,22 @@ static Vcpu_handler *lookup_vcpu_handler(unsigned int cpu_id)
|
||||
|
||||
/* Genode specific function */
|
||||
|
||||
static Genode::Attached_rom_dataspace hip_rom("hypervisor_info_page");
|
||||
Nova::Hip &hip_rom()
|
||||
{
|
||||
static Genode::Attached_rom_dataspace hip_rom(genode_env(),
|
||||
"hypervisor_info_page");
|
||||
return *hip_rom.local_addr<Nova::Hip>();
|
||||
}
|
||||
|
||||
void SUPR3QueryHWACCLonGenodeSupport(VM * pVM)
|
||||
{
|
||||
try {
|
||||
Nova::Hip * hip = hip_rom.local_addr<Nova::Hip>();
|
||||
pVM->hm.s.svm.fSupported = hip_rom().has_feature_svm();
|
||||
pVM->hm.s.vmx.fSupported = hip_rom().has_feature_vmx();
|
||||
|
||||
pVM->hm.s.svm.fSupported = hip->has_feature_svm();
|
||||
pVM->hm.s.vmx.fSupported = hip->has_feature_vmx();
|
||||
|
||||
if (hip->has_feature_svm() || hip->has_feature_vmx()) {
|
||||
Genode::log("Using ",
|
||||
hip->has_feature_svm() ? "SVM" : "VMX", " "
|
||||
"virtualization extension.");
|
||||
if (hip_rom().has_feature_svm() || hip_rom().has_feature_vmx()) {
|
||||
Genode::log("Using ", hip_rom().has_feature_svm() ? "SVM" : "VMX",
|
||||
" virtualization extension.");
|
||||
return;
|
||||
}
|
||||
} catch (...) { /* if we get an exception let hardware support off */ }
|
||||
@ -192,14 +195,7 @@ uint64_t genode_cpu_hz()
|
||||
|
||||
if (!cpu_freq) {
|
||||
try {
|
||||
using namespace Genode;
|
||||
|
||||
Rom_connection hip_rom("hypervisor_info_page");
|
||||
|
||||
Nova::Hip * const hip = env()->rm_session()->attach(hip_rom.dataspace());
|
||||
|
||||
cpu_freq = hip->tsc_freq * 1000;
|
||||
|
||||
cpu_freq = hip_rom().tsc_freq * 1000;
|
||||
} catch (...) {
|
||||
Genode::error("could not read out CPU frequency");
|
||||
Genode::Lock lock;
|
||||
@ -282,7 +278,7 @@ extern "C" void pthread_yield(void)
|
||||
|
||||
void *operator new (__SIZE_TYPE__ size, int log2_align)
|
||||
{
|
||||
static Libc::Mem_alloc_impl heap(Genode::env()->rm_session());
|
||||
static Libc::Mem_alloc_impl heap(&genode_env().rm());
|
||||
return heap.alloc(size, log2_align);
|
||||
}
|
||||
|
||||
@ -294,22 +290,20 @@ bool create_emt_vcpu(pthread_t * pthread, size_t stack,
|
||||
Genode::Affinity::Location location,
|
||||
unsigned int cpu_id, const char * name)
|
||||
{
|
||||
Nova::Hip * hip = hip_rom.local_addr<Nova::Hip>();
|
||||
|
||||
if (!hip->has_feature_vmx() && !hip->has_feature_svm())
|
||||
if (!hip_rom().has_feature_vmx() && !hip_rom().has_feature_svm())
|
||||
return false;
|
||||
|
||||
static Genode::Pd_connection pd_vcpus("VM");
|
||||
static Genode::Pd_connection pd_vcpus(genode_env(), "VM");
|
||||
|
||||
Vcpu_handler *vcpu_handler = 0;
|
||||
|
||||
if (hip->has_feature_vmx())
|
||||
if (hip_rom().has_feature_vmx())
|
||||
vcpu_handler = new (0x10) Vcpu_handler_vmx(genode_env(),
|
||||
stack, attr, start_routine,
|
||||
arg, cpu_session, location,
|
||||
cpu_id, name, pd_vcpus);
|
||||
|
||||
if (hip->has_feature_svm())
|
||||
if (hip_rom().has_feature_svm())
|
||||
vcpu_handler = new (0x10) Vcpu_handler_svm(genode_env(),
|
||||
stack, attr, start_routine,
|
||||
arg, cpu_session, location,
|
||||
|
@ -18,6 +18,7 @@
|
||||
/* Genode includes */
|
||||
#include <base/log.h>
|
||||
#include <util/flex_iterator.h>
|
||||
#include <util/touch.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
|
@ -12,11 +12,12 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/attached_ram_dataspace.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
#include <trace/timestamp.h>
|
||||
|
||||
/* Genode/Virtualbox includes */
|
||||
#include "sup.h"
|
||||
#include "vmm.h"
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <iprt/semaphore.h>
|
||||
@ -31,7 +32,7 @@
|
||||
struct Attached_gip : Genode::Attached_ram_dataspace
|
||||
{
|
||||
Attached_gip()
|
||||
: Attached_ram_dataspace(Genode::env()->ram_session(), PAGE_SIZE)
|
||||
: Attached_ram_dataspace(genode_env().ram(), genode_env().rm(), PAGE_SIZE)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -46,9 +47,9 @@ enum {
|
||||
PSUPGLOBALINFOPAGE g_pSUPGlobalInfoPage;
|
||||
|
||||
|
||||
struct Periodic_gip : public Genode::Thread_deprecated<2*4096>
|
||||
struct Periodic_gip : public Genode::Thread
|
||||
{
|
||||
Periodic_gip() : Thread_deprecated("periodic_gip") { start(); }
|
||||
Periodic_gip(Genode::Env &env) : Thread(env, "periodic_gip", 8192) { start(); }
|
||||
|
||||
static void update()
|
||||
{
|
||||
@ -147,7 +148,7 @@ int SUPR3Init(PSUPDRVSESSION *ppSession)
|
||||
cpu->idApic = 0;
|
||||
|
||||
/* schedule periodic call of GIP update function */
|
||||
static Periodic_gip periodic_gip;
|
||||
static Periodic_gip periodic_gip (genode_env());
|
||||
|
||||
initialized = true;
|
||||
|
||||
@ -331,7 +332,7 @@ HRESULT genode_check_memory_config(ComObjPtr<Machine> machine)
|
||||
return rc;
|
||||
|
||||
/* Request max available memory */
|
||||
size_t memory_genode = Genode::env()->ram_session()->avail() >> 20;
|
||||
size_t memory_genode = genode_env().ram().avail() >> 20;
|
||||
size_t memory_vmm = 28;
|
||||
|
||||
if (memory_vbox + memory_vmm > memory_genode) {
|
||||
|
@ -48,8 +48,6 @@ void genode_update_tsc(void (*update_func)(void), unsigned long update_us);
|
||||
|
||||
Genode::Cpu_session * get_vcpu_cpu_session();
|
||||
|
||||
Genode::Env &genode_env();
|
||||
|
||||
void genode_VMMR0_DO_GVMM_CREATE_VM(PSUPVMMR0REQHDR pReqHdr);
|
||||
void genode_VMMR0_DO_GVMM_REGISTER_VMCPU(PVMR0 pVMR0, VMCPUID idCpu);
|
||||
|
||||
|
@ -21,7 +21,6 @@ SRC_CC = frontend/main.cc frontend/console.cc \
|
||||
hm.cc thread.cc dynlib.cc unimpl.cc
|
||||
|
||||
LIBS += base
|
||||
LIBS += config_args
|
||||
LIBS += stdcxx
|
||||
|
||||
LIBS += virtualbox-bios virtualbox-recompiler virtualbox-runtime \
|
||||
|
@ -14,13 +14,13 @@
|
||||
/* Genode */
|
||||
#include <base/log.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/env.h>
|
||||
#include <cpu_session/connection.h>
|
||||
|
||||
/* Genode libc pthread binding */
|
||||
#include "thread.h"
|
||||
|
||||
#include "sup.h"
|
||||
#include "vmm.h"
|
||||
|
||||
/* libc */
|
||||
#include <pthread.h>
|
||||
@ -51,11 +51,11 @@ static Genode::Cpu_connection * cpu_connection(RTTHREADTYPE type) {
|
||||
long const prio = (VIRTUAL_GENODE_VBOX_LEVELS - type) *
|
||||
Cpu_session::PRIORITY_LIMIT / VIRTUAL_GENODE_VBOX_LEVELS;
|
||||
|
||||
char * data = new (env()->heap()) char[16];
|
||||
char * data = new (vmm_heap()) char[16];
|
||||
|
||||
Genode::snprintf(data, 16, "vbox %u", type);
|
||||
|
||||
con[type - 1] = new (env()->heap()) Cpu_connection(data, prio);
|
||||
con[type - 1] = new (vmm_heap()) Cpu_connection(genode_env(), data, prio);
|
||||
|
||||
return con[type - 1];
|
||||
}
|
||||
@ -98,7 +98,7 @@ static int create_thread(pthread_t *thread, const pthread_attr_t *attr,
|
||||
*/
|
||||
}
|
||||
|
||||
pthread_t thread_obj = new (Genode::env()->heap())
|
||||
pthread_t thread_obj = new (vmm_heap())
|
||||
pthread(attr ? *attr : 0, start_routine,
|
||||
arg, stack_size, rtthread->szName,
|
||||
cpu_connection(rtthread->enmType),
|
||||
|
10
repos/ports/src/virtualbox/vmm.h
Normal file
10
repos/ports/src/virtualbox/vmm.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef _VMM_H_
|
||||
#define _VMM_H_
|
||||
|
||||
#include <base/env.h>
|
||||
#include <base/allocator.h>
|
||||
|
||||
Genode::Env & genode_env();
|
||||
Genode::Allocator & vmm_heap();
|
||||
|
||||
#endif /* _VMM_H_ */
|
@ -14,14 +14,6 @@
|
||||
#ifndef _VMM_MEMORY_H_
|
||||
#define _VMM_MEMORY_H_
|
||||
|
||||
/*
|
||||
* Work-around for a naming conflict between the enum definition of PAGE_SIZE
|
||||
* in 'os/attached_ram_dataspace.h' and the VirtualBox #define with the same
|
||||
* name.
|
||||
*/
|
||||
#define BACKUP_PAGESIZE PAGE_SIZE
|
||||
#undef PAGE_SIZE
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/env.h>
|
||||
#include <base/lock.h>
|
||||
@ -29,8 +21,7 @@
|
||||
|
||||
/* Genode/Virtualbox includes */
|
||||
#include "mem_region.h"
|
||||
|
||||
#define PAGE_SIZE BACKUP_PAGESIZE
|
||||
#include "vmm.h"
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <VBox/vmm/pgm.h>
|
||||
@ -38,21 +29,19 @@
|
||||
|
||||
class Vmm_memory
|
||||
{
|
||||
typedef Genode::Ram_session Ram_session;
|
||||
typedef Genode::Region_map Region_map;
|
||||
typedef Genode::size_t size_t;
|
||||
typedef Genode::Lock Lock;
|
||||
typedef Genode::List<Mem_region> Mem_region_list;
|
||||
|
||||
private:
|
||||
|
||||
Lock _lock;
|
||||
Mem_region_list _regions;
|
||||
Lock _lock;
|
||||
Mem_region_list _regions;
|
||||
Genode::Env &_env;
|
||||
|
||||
/**
|
||||
* Backing store
|
||||
*/
|
||||
Genode::Ram_session &_ram;
|
||||
|
||||
Mem_region *_lookup_unsynchronized(PPDMDEVINS pDevIns, unsigned iRegion)
|
||||
{
|
||||
@ -75,7 +64,7 @@ class Vmm_memory
|
||||
|
||||
public:
|
||||
|
||||
Vmm_memory(Ram_session &ram) : _ram(ram) { }
|
||||
Vmm_memory(Genode::Env &env) : _env(env) { }
|
||||
|
||||
/**
|
||||
* \throw Ram_session::Alloc_failed
|
||||
@ -86,17 +75,17 @@ class Vmm_memory
|
||||
Lock::Guard guard(_lock);
|
||||
|
||||
try {
|
||||
Mem_region *r = new (Genode::env()->heap())
|
||||
Mem_region(_ram, cb, pDevIns, iRegion);
|
||||
Mem_region *r = new (vmm_heap()) Mem_region(_env, cb,
|
||||
pDevIns, iRegion);
|
||||
_regions.insert(r);
|
||||
|
||||
return r->local_addr<void>();
|
||||
|
||||
} catch (Ram_session::Alloc_failed) {
|
||||
} catch (Genode::Ram_session::Alloc_failed) {
|
||||
Genode::error("Vmm_memory::alloc(", Genode::Hex(cb), "): "
|
||||
"RAM allocation failed");
|
||||
throw;
|
||||
} catch (Region_map::Attach_failed) {
|
||||
} catch (Genode::Region_map::Attach_failed) {
|
||||
Genode::error("Vmm_memory::alloc(", Genode::Hex(cb), "): "
|
||||
"RM attach failed");
|
||||
throw;
|
||||
|
@ -30,9 +30,6 @@ struct Mem_region : public Genode::List<Mem_region>::Element,
|
||||
private Genode::Rm_connection,
|
||||
public Genode::Region_map_client
|
||||
{
|
||||
typedef Genode::Ram_session Ram_session;
|
||||
typedef Genode::Region_map Region_map;
|
||||
|
||||
PPDMDEVINS pDevIns;
|
||||
unsigned const iRegion;
|
||||
RTGCPHYS vm_phys;
|
||||
@ -43,14 +40,16 @@ struct Mem_region : public Genode::List<Mem_region>::Element,
|
||||
Genode::addr_t _base;
|
||||
Genode::size_t _size;
|
||||
|
||||
Mem_region(Ram_session &ram, size_t size, PPDMDEVINS pDevIns,
|
||||
unsigned iRegion, unsigned sub_rm_max_ds = 32 * 1024 * 1024)
|
||||
Mem_region(Genode::Env &env, size_t size,
|
||||
PPDMDEVINS pDevIns, unsigned iRegion,
|
||||
unsigned sub_rm_max_ds = 32 * 1024 * 1024)
|
||||
:
|
||||
Rm_connection(env),
|
||||
Region_map_client(Rm_connection::create(size)),
|
||||
pDevIns(pDevIns),
|
||||
iRegion(iRegion),
|
||||
vm_phys(0), pfnHandlerR3(0), pvUserR3(0),
|
||||
_base(Genode::env()->rm_session()->attach(Region_map_client::dataspace())),
|
||||
_base(env.rm().attach(Region_map_client::dataspace())),
|
||||
_size(size)
|
||||
|
||||
{
|
||||
@ -58,7 +57,7 @@ struct Mem_region : public Genode::List<Mem_region>::Element,
|
||||
Genode::addr_t map_size = rest_size < sub_rm_max_ds ? rest_size : sub_rm_max_ds;
|
||||
|
||||
do {
|
||||
Genode::Ram_dataspace_capability ds = Genode::env()->ram_session()->alloc(map_size);
|
||||
Genode::Ram_dataspace_capability ds = env.ram().alloc(map_size);
|
||||
attach_at(ds, _size - rest_size, map_size);
|
||||
|
||||
rest_size -= map_size;
|
||||
|
@ -12,12 +12,13 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <VBoxDD.h>
|
||||
#include <VBoxDD2.h>
|
||||
|
||||
#include "vmm.h"
|
||||
|
||||
#define REGISTER(device) \
|
||||
do { \
|
||||
@ -75,7 +76,7 @@ extern "C" int VBoxDevicesRegister(PPDMDEVREGCB pCallbacks, uint32_t u32Version)
|
||||
static bool read_force_ioapic_from_config()
|
||||
{
|
||||
try {
|
||||
Genode::Attached_rom_dataspace config("config");
|
||||
Genode::Attached_rom_dataspace config(genode_env(), "config");
|
||||
return config.xml().attribute_value("force_ioapic", false);
|
||||
} catch (Genode::Rom_connection::Rom_connection_failed) {
|
||||
return false;
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "fb.h"
|
||||
#include "vmm.h"
|
||||
|
||||
static const bool debug = false;
|
||||
|
||||
@ -73,7 +74,7 @@ void fireStateChangedEvent(IEventSource* aSource,
|
||||
if (a_state != MachineState_PoweredOff)
|
||||
return;
|
||||
|
||||
Genode::env()->parent()->exit(0);
|
||||
genode_env().parent().exit(0);
|
||||
}
|
||||
|
||||
void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal,
|
||||
@ -296,7 +297,7 @@ void GenodeConsole::init_clipboard()
|
||||
if (mode == ClipboardMode_Bidirectional ||
|
||||
mode == ClipboardMode_HostToGuest) {
|
||||
|
||||
_clipboard_rom = new Genode::Attached_rom_dataspace("clipboard");
|
||||
_clipboard_rom = new Genode::Attached_rom_dataspace(genode_env(), "clipboard");
|
||||
_clipboard_rom->sigh(_clipboard_signal_dispatcher);
|
||||
|
||||
clipboard_rom = _clipboard_rom;
|
||||
@ -305,7 +306,7 @@ void GenodeConsole::init_clipboard()
|
||||
if (mode == ClipboardMode_Bidirectional ||
|
||||
mode == ClipboardMode_GuestToHost) {
|
||||
|
||||
_clipboard_reporter = new Genode::Reporter("clipboard");
|
||||
_clipboard_reporter = new Genode::Reporter(genode_env(), "clipboard");
|
||||
_clipboard_reporter->enabled(true);
|
||||
|
||||
clipboard_reporter = _clipboard_reporter;
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include <input/event.h>
|
||||
#include <input/keycodes.h>
|
||||
#include <input_session/connection.h>
|
||||
#include <os/attached_dataspace.h>
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <base/attached_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <os/reporter.h>
|
||||
#include <report_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
@ -29,10 +29,11 @@
|
||||
/* repos/ports includes */
|
||||
#include <vbox_pointer/shape_report.h>
|
||||
|
||||
#include "../vmm.h"
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include "ConsoleImpl.h"
|
||||
|
||||
|
||||
class Scan_code
|
||||
{
|
||||
private:
|
||||
@ -139,10 +140,12 @@ class GenodeConsole : public Console {
|
||||
GenodeConsole()
|
||||
:
|
||||
Console(),
|
||||
_input(genode_env()),
|
||||
_ax(0), _ay(0),
|
||||
_last_received_motion_event_was_absolute(false),
|
||||
_shape_report_connection("shape", sizeof(Vbox_pointer::Shape_report)),
|
||||
_shape_report_ds(_shape_report_connection.dataspace()),
|
||||
_shape_report_connection(genode_env(), "shape",
|
||||
sizeof(Vbox_pointer::Shape_report)),
|
||||
_shape_report_ds(genode_env().rm(), _shape_report_connection.dataspace()),
|
||||
_shape_report(_shape_report_ds.local_addr<Vbox_pointer::Shape_report>()),
|
||||
_clipboard_reporter(nullptr),
|
||||
_clipboard_rom(nullptr),
|
||||
|
@ -31,6 +31,7 @@ class Genodefb :
|
||||
{
|
||||
private:
|
||||
|
||||
Genode::Env &_env;
|
||||
Fb_Genode::Connection _fb;
|
||||
|
||||
/* The mode matching the currently attached dataspace */
|
||||
@ -57,12 +58,14 @@ class Genodefb :
|
||||
|
||||
public:
|
||||
|
||||
Genodefb ()
|
||||
Genodefb (Genode::Env &env)
|
||||
:
|
||||
_env(env),
|
||||
_fb(env, Fb_Genode::Mode(0, 0, Fb_Genode::Mode::INVALID)),
|
||||
_fb_mode(_fb.mode()),
|
||||
_next_fb_mode(_fb_mode),
|
||||
_virtual_fb_mode(_fb_mode),
|
||||
_fb_base(Genode::env()->rm_session()->attach(_fb.dataspace()))
|
||||
_fb_base(env.rm().attach(_fb.dataspace()))
|
||||
{
|
||||
int rc = RTCritSectInit(&_fb_lock);
|
||||
Assert(rc == VINF_SUCCESS);
|
||||
@ -120,9 +123,9 @@ class Genodefb :
|
||||
|
||||
_virtual_fb_mode = Fb_Genode::Mode(w, h, Fb_Genode::Mode::RGB565);
|
||||
|
||||
Genode::env()->rm_session()->detach(_fb_base);
|
||||
_env.rm().detach(_fb_base);
|
||||
|
||||
_fb_base = Genode::env()->rm_session()->attach(_fb.dataspace());
|
||||
_fb_base = _env.rm().attach(_fb.dataspace());
|
||||
|
||||
result = S_OK;
|
||||
|
||||
|
@ -14,9 +14,10 @@
|
||||
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/heap.h>
|
||||
#include <base/log.h>
|
||||
#include <libc/component.h>
|
||||
#include <os/config.h>
|
||||
|
||||
/* Virtualbox includes */
|
||||
#include <iprt/initterm.h>
|
||||
@ -35,12 +36,14 @@
|
||||
/* Genode port specific includes */
|
||||
#include "console.h"
|
||||
#include "fb.h"
|
||||
#include "vmm.h"
|
||||
|
||||
static char c_vbox_file[128];
|
||||
static char c_vbox_vmname[128];
|
||||
|
||||
extern "C" void init_libc_vbox_logger(void);
|
||||
|
||||
|
||||
/**
|
||||
* xpcom style memory allocation
|
||||
*/
|
||||
@ -88,7 +91,7 @@ RTDECL(int) RTPathUserHome(char *pszPath, size_t cchPath)
|
||||
extern "C" VirtualBox * genode_global_vbox_pointer;
|
||||
VirtualBox * genode_global_vbox_pointer = nullptr;
|
||||
|
||||
HRESULT setupmachine()
|
||||
HRESULT setupmachine(Genode::Env &env)
|
||||
{
|
||||
HRESULT rc;
|
||||
|
||||
@ -118,11 +121,9 @@ HRESULT setupmachine()
|
||||
return rc;
|
||||
|
||||
rc = virtualbox->RegisterMachine(machine);
|
||||
|
||||
if (FAILED(rc))
|
||||
return rc;
|
||||
|
||||
|
||||
// open a session
|
||||
ComObjPtr<Session> session;
|
||||
rc = session.createObject();
|
||||
@ -140,7 +141,7 @@ HRESULT setupmachine()
|
||||
return rc;
|
||||
|
||||
/* request max available memory */
|
||||
size_t memory_genode = Genode::env()->ram_session()->avail() >> 20;
|
||||
size_t memory_genode = genode_env().ram().avail() >> 20;
|
||||
size_t memory_vmm = 28;
|
||||
|
||||
if (memory_vbox + memory_vmm > memory_genode) {
|
||||
@ -181,7 +182,7 @@ HRESULT setupmachine()
|
||||
unsigned uScreenId;
|
||||
for (uScreenId = 0; uScreenId < cMonitors; uScreenId++)
|
||||
{
|
||||
Genodefb *fb = new Genodefb();
|
||||
Genodefb *fb = new Genodefb(env);
|
||||
HRESULT rc = display->AttachFramebuffer(uScreenId, fb, gaFramebufferId[uScreenId].asOutParam());
|
||||
if (FAILED(rc))
|
||||
return rc;
|
||||
@ -225,7 +226,7 @@ HRESULT setupmachine()
|
||||
}
|
||||
|
||||
|
||||
static Genode::Env *genode_env_ptr;
|
||||
static Genode::Env *genode_env_ptr = nullptr;
|
||||
|
||||
|
||||
Genode::Env &genode_env()
|
||||
@ -238,6 +239,13 @@ Genode::Env &genode_env()
|
||||
}
|
||||
|
||||
|
||||
Genode::Allocator &vmm_heap()
|
||||
{
|
||||
static Genode::Heap heap (genode_env().ram(), genode_env().rm());
|
||||
return heap;
|
||||
}
|
||||
|
||||
|
||||
void Libc::Component::construct(Libc::Env &env)
|
||||
{
|
||||
/* make Genode environment accessible via the global 'genode_env()' */
|
||||
@ -246,10 +254,10 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
try {
|
||||
using namespace Genode;
|
||||
|
||||
Xml_node node = config()->xml_node();
|
||||
Xml_node::Attribute vbox_file = node.attribute("vbox_file");
|
||||
Attached_rom_dataspace config(env, "config");
|
||||
Xml_node::Attribute vbox_file = config.xml().attribute("vbox_file");
|
||||
vbox_file.value(c_vbox_file, sizeof(c_vbox_file));
|
||||
Xml_node::Attribute vm_name = node.attribute("vm_name");
|
||||
Xml_node::Attribute vm_name = config.xml().attribute("vm_name");
|
||||
vm_name.value(c_vbox_vmname, sizeof(c_vbox_vmname));
|
||||
} catch (...) {
|
||||
Genode::error("missing attributes in configuration, minimum requirements: ");
|
||||
@ -268,7 +276,7 @@ void Libc::Component::construct(Libc::Env &env)
|
||||
if (RT_FAILURE(rc))
|
||||
throw -1;
|
||||
|
||||
HRESULT hrc = setupmachine();
|
||||
HRESULT hrc = setupmachine(env);
|
||||
if (FAILED(hrc)) {
|
||||
Genode::error("startup of VMM failed - reason ", hrc, " '",
|
||||
RTErrCOMGet(hrc)->pszMsgFull, "' - exiting ...");
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <util/string.h>
|
||||
#include <rm_session/connection.h>
|
||||
|
||||
#include <os/attached_ram_dataspace.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
|
||||
/* VirtualBox includes */
|
||||
#include <VBox/vmm/mm.h>
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
#include "util.h"
|
||||
#include "mm.h"
|
||||
#include "vmm.h"
|
||||
|
||||
enum { VERBOSE_MM = false };
|
||||
|
||||
@ -59,7 +60,7 @@ static Libc::Mem_alloc * heap_by_mmtag(MMTAG enmTag)
|
||||
if (memory_regions[enmTag].conn)
|
||||
return memory_regions[enmTag].heap;
|
||||
|
||||
memory_regions[enmTag].conn = new Sub_rm_connection(REGION_SIZE);
|
||||
memory_regions[enmTag].conn = new Sub_rm_connection(genode_env(), REGION_SIZE);
|
||||
memory_regions[enmTag].heap = new Libc::Mem_alloc_impl(memory_regions[enmTag].conn);
|
||||
|
||||
return memory_regions[enmTag].heap;
|
||||
@ -433,7 +434,9 @@ VMMDECL(RTHCPHYS) MMPage2Phys(PVM pVM, void *pvPage) {
|
||||
VMMR3DECL(void *) MMR3PageAlloc(PVM pVM)
|
||||
{
|
||||
using Genode::Attached_ram_dataspace;
|
||||
Attached_ram_dataspace * ds = new Attached_ram_dataspace(Genode::env()->ram_session(), 4096);
|
||||
Attached_ram_dataspace * ds = new Attached_ram_dataspace(genode_env().ram(),
|
||||
genode_env().rm(),
|
||||
4096);
|
||||
return ds->local_addr<void>();
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@
|
||||
#include <util/flex_iterator.h>
|
||||
#include <rom_session/connection.h>
|
||||
#include <timer_session/connection.h>
|
||||
#include <os/attached_rom_dataspace.h>
|
||||
#include <os/attached_ram_dataspace.h>
|
||||
#include <base/attached_rom_dataspace.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
#include <trace/timestamp.h>
|
||||
|
||||
#include <vmm/vcpu_thread.h>
|
||||
@ -29,6 +29,7 @@
|
||||
#include <nova/syscalls.h>
|
||||
|
||||
/* Genode's VirtualBox includes */
|
||||
#include "vmm.h"
|
||||
#include "vcpu.h"
|
||||
#include "vcpu_svm.h"
|
||||
#include "vcpu_vmx.h"
|
||||
@ -40,11 +41,6 @@
|
||||
|
||||
extern "C" bool PGMUnmapMemoryGenode(void *, ::size_t);
|
||||
|
||||
/* XXX does not work on 32bit host - since vm memory is from 0 - 4G and
|
||||
* such large areas can't be attached to a process
|
||||
* We need several sub_rm areas .... XXX
|
||||
*/
|
||||
static Sub_rm_connection vm_memory((sizeof(void *) == 4 ? 2UL : 4UL) * 1024 * 1024 * 1024);
|
||||
|
||||
static Genode::List<Vcpu_handler> &vcpu_handler_list()
|
||||
{
|
||||
@ -67,19 +63,23 @@ static Vcpu_handler *lookup_vcpu_handler(unsigned int cpu_id)
|
||||
|
||||
/* Genode specific function */
|
||||
|
||||
static Genode::Attached_rom_dataspace hip_rom("hypervisor_info_page");
|
||||
Nova::Hip &hip_rom()
|
||||
{
|
||||
static Genode::Attached_rom_dataspace hip_rom(genode_env(),
|
||||
"hypervisor_info_page");
|
||||
return *hip_rom.local_addr<Nova::Hip>();
|
||||
}
|
||||
|
||||
|
||||
void SUPR3QueryHWACCLonGenodeSupport(VM * pVM)
|
||||
{
|
||||
try {
|
||||
Nova::Hip * hip = hip_rom.local_addr<Nova::Hip>();
|
||||
pVM->hm.s.svm.fSupported = hip_rom().has_feature_svm();
|
||||
pVM->hm.s.vmx.fSupported = hip_rom().has_feature_vmx();
|
||||
|
||||
pVM->hm.s.svm.fSupported = hip->has_feature_svm();
|
||||
pVM->hm.s.vmx.fSupported = hip->has_feature_vmx();
|
||||
|
||||
if (hip->has_feature_svm() || hip->has_feature_vmx()) {
|
||||
Genode::log("Using ", hip->has_feature_svm() ? "SVM " : "VMX ",
|
||||
"virtualization extension.");
|
||||
if (hip_rom().has_feature_svm() || hip_rom().has_feature_vmx()) {
|
||||
Genode::log("Using ", hip_rom().has_feature_svm() ? "SVM" : "VMX",
|
||||
" virtualization extension.");
|
||||
return;
|
||||
}
|
||||
} catch (...) { /* if we get an exception let hardware support off */ }
|
||||
@ -113,7 +113,9 @@ int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages,
|
||||
" r3=", ppvPages, " r0=", pR0Ptr);
|
||||
|
||||
using Genode::Attached_ram_dataspace;
|
||||
Attached_ram_dataspace * ds = new Attached_ram_dataspace(Genode::env()->ram_session(), cPages * 4096); /* XXX PAGE_SIZE ? */
|
||||
Attached_ram_dataspace * ds = new Attached_ram_dataspace(genode_env().ram(),
|
||||
genode_env().rm(),
|
||||
cPages * 4096); /* XXX PAGE_SIZE ? */
|
||||
*ppvPages = ds->local_addr<void>();
|
||||
if (pR0Ptr)
|
||||
*pR0Ptr = reinterpret_cast<RTR0PTR>(*ppvPages);
|
||||
@ -136,6 +138,12 @@ int SUPR3PageAllocEx(::size_t cPages, uint32_t fFlags, void **ppvPages,
|
||||
int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned
|
||||
uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr)
|
||||
{
|
||||
/* XXX does not work on 32bit host - since vm memory is from 0 - 4G and
|
||||
* such large areas can't be attached to a process
|
||||
* We need several sub_rm areas .... XXX
|
||||
*/
|
||||
static Sub_rm_connection vm_memory(genode_env(), (sizeof(void *) == 4 ? 2UL : 4UL) * 1024 * 1024 * 1024);
|
||||
|
||||
static unsigned long chunkid = 1500;
|
||||
|
||||
switch (uOperation) {
|
||||
@ -251,7 +259,7 @@ int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned
|
||||
Assert(req->idChunkUnmap == NIL_GMM_CHUNKID);
|
||||
Assert(req->idChunkMap != NIL_GMM_CHUNKID);
|
||||
|
||||
Genode::Ram_dataspace_capability ds = Genode::env()->ram_session()->alloc(GMM_CHUNK_SIZE);
|
||||
Genode::Ram_dataspace_capability ds = genode_env().ram().alloc(GMM_CHUNK_SIZE);
|
||||
Genode::addr_t local_addr_offset = (req->idChunkMap - 1) << GMM_CHUNK_SHIFT;
|
||||
|
||||
enum { OFFSET_DS = 0, USE_LOCAL_ADDR = true };
|
||||
@ -462,16 +470,9 @@ uint64_t genode_cpu_hz()
|
||||
|
||||
if (!cpu_freq) {
|
||||
try {
|
||||
using namespace Genode;
|
||||
|
||||
Rom_connection hip_rom("hypervisor_info_page");
|
||||
|
||||
Nova::Hip * const hip = env()->rm_session()->attach(hip_rom.dataspace());
|
||||
|
||||
cpu_freq = hip->tsc_freq * 1000;
|
||||
|
||||
cpu_freq = hip_rom().tsc_freq * 1000;
|
||||
} catch (...) {
|
||||
Genode::error("could not read out CPU frequency.");
|
||||
Genode::error("could not read out CPU frequency");
|
||||
Genode::Lock lock;
|
||||
lock.lock();
|
||||
}
|
||||
@ -543,7 +544,7 @@ extern "C" void pthread_yield(void)
|
||||
|
||||
void *operator new (__SIZE_TYPE__ size, int log2_align)
|
||||
{
|
||||
static Libc::Mem_alloc_impl heap(Genode::env()->rm_session());
|
||||
static Libc::Mem_alloc_impl heap(&genode_env().rm());
|
||||
return heap.alloc(size, log2_align);
|
||||
}
|
||||
|
||||
@ -555,22 +556,20 @@ bool create_emt_vcpu(pthread_t * pthread, ::size_t stack,
|
||||
Genode::Affinity::Location location,
|
||||
unsigned int cpu_id, const char * name)
|
||||
{
|
||||
Nova::Hip * hip = hip_rom.local_addr<Nova::Hip>();
|
||||
|
||||
if (!hip->has_feature_vmx() && !hip->has_feature_svm())
|
||||
if (!hip_rom().has_feature_vmx() && !hip_rom().has_feature_svm())
|
||||
return false;
|
||||
|
||||
static Genode::Pd_connection pd_vcpus("VM");
|
||||
static Genode::Pd_connection pd_vcpus(genode_env(), "VM");
|
||||
|
||||
Vcpu_handler *vcpu_handler = 0;
|
||||
|
||||
if (hip->has_feature_vmx())
|
||||
if (hip_rom().has_feature_vmx())
|
||||
vcpu_handler = new (0x10) Vcpu_handler_vmx(genode_env(),
|
||||
stack, attr, start_routine,
|
||||
arg, cpu_session, location,
|
||||
cpu_id, name, pd_vcpus);
|
||||
|
||||
if (hip->has_feature_svm())
|
||||
if (hip_rom().has_feature_svm())
|
||||
vcpu_handler = new (0x10) Vcpu_handler_svm(genode_env(),
|
||||
stack, attr, start_routine,
|
||||
arg, cpu_session, location,
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
/* Genode includes */
|
||||
#include <os/attached_ram_dataspace.h>
|
||||
#include <base/attached_ram_dataspace.h>
|
||||
#include <trace/timestamp.h>
|
||||
|
||||
/* Genode/Virtualbox includes */
|
||||
@ -27,6 +27,7 @@
|
||||
/* libc memory allocator */
|
||||
#include <libc_mem_alloc.h>
|
||||
|
||||
#include "vmm.h"
|
||||
|
||||
enum {
|
||||
UPDATE_HZ = 1000,
|
||||
@ -38,9 +39,9 @@ enum {
|
||||
PSUPGLOBALINFOPAGE g_pSUPGlobalInfoPage;
|
||||
|
||||
|
||||
struct Periodic_gip : public Genode::Thread_deprecated<4096>
|
||||
struct Periodic_gip : public Genode::Thread
|
||||
{
|
||||
Periodic_gip() : Thread_deprecated("periodic_gip") { start(); }
|
||||
Periodic_gip(Genode::Env &env) : Thread(env, "periodic_gip", 8192) { start(); }
|
||||
|
||||
static void update()
|
||||
{
|
||||
@ -98,7 +99,7 @@ struct Periodic_gip : public Genode::Thread_deprecated<4096>
|
||||
struct Attached_gip : Genode::Attached_ram_dataspace
|
||||
{
|
||||
Attached_gip()
|
||||
: Attached_ram_dataspace(Genode::env()->ram_session(), PAGE_SIZE)
|
||||
: Attached_ram_dataspace(genode_env().ram(), genode_env().rm(), PAGE_SIZE)
|
||||
{
|
||||
g_pSUPGlobalInfoPage = local_addr<SUPGLOBALINFOPAGE>();
|
||||
|
||||
@ -134,13 +135,15 @@ struct Attached_gip : Genode::Attached_ram_dataspace
|
||||
cpu->idApic = 0;
|
||||
|
||||
/* schedule periodic call of GIP update function */
|
||||
static Periodic_gip periodic_gip;
|
||||
static Periodic_gip periodic_gip(genode_env());
|
||||
}
|
||||
} static gip;
|
||||
};
|
||||
|
||||
|
||||
int SUPR3Init(PSUPDRVSESSION *ppSession)
|
||||
{
|
||||
static Attached_gip gip;
|
||||
|
||||
return VINF_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ vpath rt.cc $(REP_DIR)/src/virtualbox
|
||||
vpath thread.cc $(REP_DIR)/src/virtualbox
|
||||
|
||||
LIBS += base
|
||||
LIBS += config_args
|
||||
LIBS += stdcxx
|
||||
|
||||
LIBS += virtualbox5-bios virtualbox5-recompiler virtualbox5-runtime \
|
||||
|
Loading…
x
Reference in New Issue
Block a user