genode/repos/base/include/vm_session/vm_session.h

101 lines
2.8 KiB
C
Raw Normal View History

/*
* \brief VM-session interface
* \author Stefan Kalkowski
* \date 2012-10-02
*/
/*
* Copyright (C) 2012-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _INCLUDE__VM_SESSION__VM_SESSION_H_
#define _INCLUDE__VM_SESSION__VM_SESSION_H_
/* Genode includes */
#include <base/rpc_args.h>
#include <base/signal.h>
base/os: remove deprecated APIs This commit removes APIs that were previously marked as deprecated. This change has the following implications: - The use of the global 'env()' accessor is not possible anymore. - Boolean accessor methods are no longer prefixed with 'is_'. E.g., instead of 'is_valid()', use 'valid()'. - The last traces of 'Ram_session' are gone now. The 'Env::ram()' accessor returns the 'Ram_allocator' interface, which is a subset of the 'Pd_session' interface. - All connection constructors need the 'Env' as argument. - The 'Reporter' constructor needs an 'Env' argument now because the reporter creates a report connection. - The old overload 'Child_policy::resolve_session_request' that returned a 'Service' does not exist anymore. - The base/printf.h header has been removed, use base/log.h instead. - The old notion of 'Signal_dispatcher' is gone. Use 'Signal_handler'. - Transitional headers like os/server.h, cap_session/, volatile_object.h, os/attached*_dataspace.h, signal_rpc_dispatcher.h have been removed. - The distinction between 'Thread_state' and 'Thread_state_base' does not exist anymore. - The header cpu_thread/capability.h along with the type definition of 'Cpu_thread_capability' has been removed. Use the type 'Thread_capability' define in cpu_session/cpu_session.h instead. - Several XML utilities (i.e., at os/include/decorator) could be removed because their functionality is nowadays covered by util/xml_node.h. - The 'os/ram_session_guard.h' has been removed. Use 'Constrained_ram_allocator' provided by base/ram_allocator.h instead. Issue #1987
2019-01-30 16:27:46 +00:00
#include <base/ram_allocator.h>
#include <cpu_session/cpu_session.h>
#include <session/session.h>
namespace Genode { struct Vm_session; }
struct Genode::Vm_session : Session
{
static const char *service_name() { return "VM"; }
struct Vcpu_id { unsigned id; };
struct Attach_attr
{
addr_t offset;
addr_t size;
bool executable;
bool writeable;
};
enum { CAP_QUOTA = 3 };
class Invalid_dataspace : Exception { };
class Region_conflict : Exception { };
/**
* Destructor
*/
virtual ~Vm_session();
/**
* Attach dataspace to the guest-physical memory address space
*
* \param ds dataspace to be attached
* \param vm_addr address in guest-physical memory address space
*/
virtual void attach(Dataspace_capability ds, addr_t, Attach_attr) = 0;
/**
* Invalidate region of the guest-physical memory address space
*
* \param vm_addr address in guest-physical memory address space
* \param size size of the region to invalidate
*/
virtual void detach(addr_t vm_addr, size_t size) = 0;
/**
* Attach cpu-local interrupt-controller's interface to
* guest-physical memory address space.
*
* \param vm_addr address in guest-physical memory address space
*
* Note: this is currently only support for ARM interrupt-controller
* hardware virtualization
*/
virtual void attach_pic(addr_t vm_addr) = 0;
/*********************
** RPC declaration **
*********************/
GENODE_RPC(Rpc_cpu_state, Dataspace_capability, _cpu_state, Vcpu_id);
GENODE_RPC(Rpc_exception_handler, void, _exception_handler,
Signal_context_capability, Vcpu_id);
GENODE_RPC(Rpc_run, void, _run, Vcpu_id);
GENODE_RPC(Rpc_pause, void, _pause, Vcpu_id);
GENODE_RPC_THROW(Rpc_attach, void, attach,
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps, Region_conflict,
Invalid_dataspace),
Dataspace_capability, addr_t, Attach_attr);
GENODE_RPC(Rpc_detach, void, detach, addr_t, size_t);
GENODE_RPC(Rpc_attach_pic, void, attach_pic, addr_t);
GENODE_RPC_THROW(Rpc_create_vcpu, void, _create_vcpu,
GENODE_TYPE_LIST(Out_of_ram, Out_of_caps),
Thread_capability);
GENODE_RPC_INTERFACE(Rpc_cpu_state, Rpc_exception_handler,
Rpc_run, Rpc_pause, Rpc_attach, Rpc_detach,
Rpc_attach_pic, Rpc_create_vcpu);
};
#endif /* _INCLUDE__VM_SESSION__VM_SESSION_H_ */