vbox: re-enable chunk-wise memory allocation

disabled by "vbox: Implement hwaccl support for Muen" for nova
This commit is contained in:
Alexander Boettcher 2016-08-22 20:18:09 +02:00 committed by Christian Helmuth
parent 7760aa1bf0
commit e39dc445b1
3 changed files with 87 additions and 104 deletions

View File

@ -1,13 +1,11 @@
/*
* \brief Memory region types
* \author Norman Feske
* \author Adrian-Ken Rueegsegger
* \author Reto Buerki
* \date 2013-09-02
* \author Alexander Boettcher
* \date 2016-08-22
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
@ -15,61 +13,5 @@
#ifndef _VIRTUALBOX__ACCLOFF__MEM_REGION_H_
#define _VIRTUALBOX__ACCLOFF__MEM_REGION_H_
/* Genode includes */
#include <util/list.h>
#include <rm_session/connection.h>
#include <region_map/client.h>
/* VirtualBox includes */
#include <VBox/vmm/pgm.h>
struct Mem_region;
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;
PFNPGMR3PHYSHANDLER pfnHandlerR3;
void *pvUserR3;
PGMPHYSHANDLERTYPE enmType;
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)
:
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())),
_size(size)
{
Genode::addr_t rest_size = _size;
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);
attach_at(ds, _size - rest_size, map_size);
rest_size -= map_size;
map_size = rest_size < sub_rm_max_ds ? rest_size : sub_rm_max_ds;
} while (rest_size);
}
size_t size() { return _size; }
template <typename T>
T * local_addr() { return reinterpret_cast<T *>(_base); }
};
#endif /* _VIRTUALBOX__ACCLOFF__MEM_REGION_H_ */
#include "vmm_region.h"
#endif

View File

@ -1,51 +1,17 @@
/*
* \brief Memory region types
* \author Norman Feske
* \author Adrian-Ken Rueegsegger
* \author Reto Buerki
* \date 2013-09-02
* \author Alexander Boettcher
* \date 2016-08-22
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
* Copyright (C) 2016 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifndef _VIRTUALBOX__SPEC__NOVA__MEM_REGION_H_
#define _VIRTUALBOX__SPEC__NOVA__MEM_REGION_H_
/* Genode includes */
#include <util/list.h>
#include <os/attached_ram_dataspace.h>
/* VirtualBox includes */
#include <VBox/vmm/pgm.h>
struct Mem_region;
struct Mem_region : Genode::List<Mem_region>::Element,
Genode::Attached_ram_dataspace
{
typedef Genode::Ram_session Ram_session;
PPDMDEVINS pDevIns;
unsigned const iRegion;
RTGCPHYS vm_phys;
PFNPGMR3PHYSHANDLER pfnHandlerR3;
void *pvUserR3;
PGMPHYSHANDLERTYPE enmType;
Mem_region(Ram_session &ram, size_t size, PPDMDEVINS pDevIns,
unsigned iRegion)
:
Attached_ram_dataspace(&ram, size),
pDevIns(pDevIns),
iRegion(iRegion),
vm_phys(0), pfnHandlerR3(0), pvUserR3(0)
{ }
};
#endif /* _VIRTUALBOX__SPEC__NOVA__MEM_REGION_H_ */
#ifndef _VIRTUALBOX__SPEC__NOVA__VMM_REGION_H_
#define _VIRTUALBOX__SPEC__NOVA__VMM_REGION_H_
#include "vmm_region.h"
#endif

View File

@ -0,0 +1,75 @@
/*
* \brief Memory region types
* \author Norman Feske
* \author Adrian-Ken Rueegsegger
* \author Reto Buerki
* \date 2013-09-02
*/
/*
* Copyright (C) 2013 Genode Labs GmbH
*
* This file is distributed under the terms of the GNU General Public License
* version 2.
*/
#ifndef _VIRTUALBOX__VMM_REGION_H_
#define _VIRTUALBOX__VMM_REGION_H_
/* Genode includes */
#include <util/list.h>
#include <rm_session/connection.h>
#include <region_map/client.h>
/* VirtualBox includes */
#include <VBox/vmm/pgm.h>
struct Mem_region;
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;
PFNPGMR3PHYSHANDLER pfnHandlerR3;
void *pvUserR3;
PGMPHYSHANDLERTYPE enmType;
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)
:
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())),
_size(size)
{
Genode::addr_t rest_size = _size;
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);
attach_at(ds, _size - rest_size, map_size);
rest_size -= map_size;
map_size = rest_size < sub_rm_max_ds ? rest_size : sub_rm_max_ds;
} while (rest_size);
}
size_t size() { return _size; }
template <typename T>
T * local_addr() { return reinterpret_cast<T *>(_base); }
};
#endif /* _VIRTUALBOX__ACCLOFF__MEM_REGION_H_ */