diff --git a/base-hw/include/vm_session/capability.h b/base-hw/include/vm_session/capability.h new file mode 100644 index 000000000..91f178e4e --- /dev/null +++ b/base-hw/include/vm_session/capability.h @@ -0,0 +1,22 @@ +/* + * \brief VM-session capability type + * \author Stefan Kalkowski + * \date 2012-10-02 + */ + +/* + * Copyright (C) 2012 Genode Labs GmbH + * + * 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__CAPABILITY_H_ +#define _INCLUDE__VM_SESSION__CAPABILITY_H_ + +#include +#include + +namespace Genode { typedef Capability Vm_session_capability; } + +#endif /* _INCLUDE__VM_SESSION__CAPABILITY_H_ */ diff --git a/base-hw/include/vm_session/client.h b/base-hw/include/vm_session/client.h new file mode 100644 index 000000000..12dedf4d1 --- /dev/null +++ b/base-hw/include/vm_session/client.h @@ -0,0 +1,38 @@ +/* + * \brief Client-side vm session interface + * \author Stefan Kalkowski + * \date 2012-10-02 + */ + +/* + * Copyright (C) 2012 Genode Labs GmbH + * + * 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__CLIENT_H_ +#define _INCLUDE__VM_SESSION__CLIENT_H_ + +#include +#include + +namespace Genode { + + struct Vm_session_client : Rpc_client + { + explicit Vm_session_client(Vm_session_capability session) + : Rpc_client(session) { } + + Dataspace_capability cpu_state() { + return call(); } + + void exception_handler(Signal_context_capability handler) { + call(handler); } + + void run() { + call(); } + }; +} + +#endif /* _INCLUDE__VM_SESSION__CLIENT_H_ */ diff --git a/base-hw/include/vm_session/connection.h b/base-hw/include/vm_session/connection.h new file mode 100644 index 000000000..3a28139d3 --- /dev/null +++ b/base-hw/include/vm_session/connection.h @@ -0,0 +1,42 @@ +/* + * \brief Connection to VM service + * \author Stefan Kalkowski + * \date 2012-10-02 + */ + +/* + * Copyright (C) 2012 Genode Labs GmbH + * + * 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__CONNECTION_H_ +#define _INCLUDE__VM_SESSION__CONNECTION_H_ + +#include +#include +#include + +namespace Genode { + + struct Vm_connection : Connection, Vm_session_client + { + /** + * Constructor + * + * \param label initial session label + * \param priority designated priority of the VM + * \param affinity which physical CPU the VM should run on top of + */ + Vm_connection(const char *label = "", + long priority = Cpu_session::DEFAULT_PRIORITY, + unsigned long affinity = 0) + : Connection( + session("priority=0x%lx, affinity=0x%lx, ram_quota=8K, label=\"%s\"", + priority, affinity, label)), + Vm_session_client(cap()) { } + }; +} + +#endif /* _INCLUDE__VM_SESSION__CONNECTION_H_ */ diff --git a/base-hw/include/vm_session/vm_session.h b/base-hw/include/vm_session/vm_session.h new file mode 100644 index 000000000..9c9fdd470 --- /dev/null +++ b/base-hw/include/vm_session/vm_session.h @@ -0,0 +1,57 @@ + /* + * \brief Vm session interface + * \author Stefan Kalkowski + * \date 2012-10-02 + */ + +/* + * Copyright (C) 2012 Genode Labs GmbH + * + * 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_ + +#include +#include +#include +#include + +namespace Genode { + + struct Vm_session : Session + { + static const char *service_name() { return "VM"; } + + 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) {} + + /********************* + ** 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); + GENODE_RPC_INTERFACE(Rpc_cpu_state, Rpc_exception_handler, Rpc_run); + }; +} + +#endif /* _INCLUDE__VM_SESSION__VM_SESSION_H_ */