From b0d23abaa761bdfc1a78e852f323ce4bfcd3819a Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 15 Jan 2013 15:07:23 +0100 Subject: [PATCH] vancouver: keep one cap_session Cap_sessions and portals created via the sessions are nowadays freed up during c++ object destruction. Because of that the exception portals for a vCPU thread get be revoked as soon as the cap_session object leaves its scope. Keep one cap_session for the whole lifetime of the vmm to avoid disappearing exception portals. Related to #582. --- ports/src/vancouver/main.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ports/src/vancouver/main.cc b/ports/src/vancouver/main.cc index 3202d12330..6e0584f823 100644 --- a/ports/src/vancouver/main.cc +++ b/ports/src/vancouver/main.cc @@ -349,6 +349,8 @@ class Vcpu_dispatcher : public Genode::Thread, { private: + Genode::Cap_connection _cap_session; + /** * Pointer to corresponding VCPU model */ @@ -794,12 +796,11 @@ class Vcpu_dispatcher : public Genode::Thread, using namespace Genode; /* Create the portal at the desired selector index */ - Cap_connection conn; - conn.rcv_window(exc_base + EV); + _cap_session.rcv_window(exc_base + EV); Native_capability thread(tid().ec_sel); Native_capability handler = - conn.alloc(thread, (Nova::mword_t)portal_entry, + _cap_session.alloc(thread, (Nova::mword_t)portal_entry, mtd.value()); if (!handler.valid() || @@ -812,7 +813,6 @@ class Vcpu_dispatcher : public Genode::Thread, Vcpu_dispatcher(VCpu *vcpu, Guest_memory &guest_memory, Motherboard &motherboard, - Genode::Cap_connection &cap_session, bool has_svm, bool has_vmx) : @@ -1086,11 +1086,9 @@ class Machine : public StaticReceiver if (verbose_debug) Logging::printf("OP_VCPU_CREATE_BACKEND\n"); - static Genode::Cap_connection cap_session; - Vcpu_dispatcher *vcpu_dispatcher = new Vcpu_dispatcher(msg.vcpu, _guest_memory, - _motherboard, cap_session, + _motherboard, _hip->has_svm(), _hip->has_vmx()); msg.value = vcpu_dispatcher->sel_sm_ec();