2012-10-02 09:01:15 +00:00
|
|
|
/*
|
2012-10-23 15:12:09 +00:00
|
|
|
* \brief VM-session interface
|
2012-10-02 09:01:15 +00:00
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2012-10-02
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 20:44:47 +00:00
|
|
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
2012-10-02 09:01:15 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _INCLUDE__VM_SESSION__VM_SESSION_H_
|
|
|
|
#define _INCLUDE__VM_SESSION__VM_SESSION_H_
|
|
|
|
|
2012-10-23 15:12:09 +00:00
|
|
|
/* Genode includes */
|
2012-10-02 09:01:15 +00:00
|
|
|
#include <base/rpc_args.h>
|
|
|
|
#include <base/signal.h>
|
|
|
|
#include <session/session.h>
|
|
|
|
#include <ram_session/ram_session.h>
|
|
|
|
|
|
|
|
namespace Genode {
|
|
|
|
|
|
|
|
struct Vm_session : Session
|
|
|
|
{
|
|
|
|
static const char *service_name() { return "VM"; }
|
|
|
|
|
2015-02-19 13:50:27 +00:00
|
|
|
class Invalid_dataspace : Exception { };
|
|
|
|
|
2012-10-23 15:12:09 +00:00
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
2012-10-02 09:01:15 +00:00
|
|
|
virtual ~Vm_session() { }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get dataspace of the CPU state of the VM
|
|
|
|
*/
|
|
|
|
virtual Dataspace_capability cpu_state(void) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register signal handler for exceptions of the Vm
|
|
|
|
*/
|
|
|
|
virtual void exception_handler(Signal_context_capability handler) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* (Re-)Start execution of the VM
|
|
|
|
*/
|
|
|
|
virtual void run(void) {}
|
|
|
|
|
2013-05-08 13:22:28 +00:00
|
|
|
/**
|
|
|
|
* Stop execution of the VM
|
|
|
|
*/
|
|
|
|
virtual void pause(void) {}
|
|
|
|
|
2015-02-19 13:50:27 +00:00
|
|
|
/**
|
|
|
|
* 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 vm_addr) = 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;
|
|
|
|
|
2013-05-08 13:22:28 +00:00
|
|
|
|
2012-10-02 09:01:15 +00:00
|
|
|
/*********************
|
|
|
|
** RPC declaration **
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
GENODE_RPC(Rpc_cpu_state, Dataspace_capability, cpu_state);
|
|
|
|
GENODE_RPC(Rpc_exception_handler, void, exception_handler,
|
|
|
|
Signal_context_capability);
|
|
|
|
GENODE_RPC(Rpc_run, void, run);
|
2013-05-08 13:22:28 +00:00
|
|
|
GENODE_RPC(Rpc_pause, void, pause);
|
2015-02-19 13:50:27 +00:00
|
|
|
GENODE_RPC_THROW(Rpc_attach, void, attach,
|
|
|
|
GENODE_TYPE_LIST(Invalid_dataspace),
|
|
|
|
Dataspace_capability, addr_t);
|
|
|
|
GENODE_RPC(Rpc_detach, void, detach, addr_t, size_t);
|
|
|
|
GENODE_RPC(Rpc_attach_pic, void, attach_pic, addr_t);
|
2013-05-08 13:22:28 +00:00
|
|
|
GENODE_RPC_INTERFACE(Rpc_cpu_state, Rpc_exception_handler,
|
2015-02-19 13:50:27 +00:00
|
|
|
Rpc_run, Rpc_pause, Rpc_attach, Rpc_detach,
|
|
|
|
Rpc_attach_pic);
|
2012-10-02 09:01:15 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _INCLUDE__VM_SESSION__VM_SESSION_H_ */
|