X-Git-Url: https://rtime.felk.cvut.cz/gitweb/l4.git/blobdiff_plain/846ee6a4a27b3178b23b551e333750133da39d27..7d8b3f45f98773ba02057b81b90c31a12320c09e:/kernel/fiasco/src/kern/thread-vcpu.cpp diff --git a/kernel/fiasco/src/kern/thread-vcpu.cpp b/kernel/fiasco/src/kern/thread-vcpu.cpp index b4d0a84ba..ac188e637 100644 --- a/kernel/fiasco/src/kern/thread-vcpu.cpp +++ b/kernel/fiasco/src/kern/thread-vcpu.cpp @@ -1,21 +1,36 @@ -INTERFACE: - -extern "C" void vcpu_resume(Trap_state *, Return_frame *sp) - FIASCO_FASTCALL FIASCO_NORETURN; - - -// -------------------------------------------------------------------------- IMPLEMENTATION: #include "logdefs.h" +#include "task.h" #include "vcpu.h" +PUBLIC inline NEEDS["task.h"] +void +Thread::vcpu_set_user_space(Task *t) +{ + assert_kdb (current() == this); + if (t) + t->inc_ref(); + + Task *old = static_cast(_space.vcpu_user()); + _space.vcpu_user(t); + + if (old) + { + if (!old->dec_ref()) + { + rcu_wait(); + delete old; + } + } +} + PUBLIC inline NEEDS["logdefs.h", "vcpu.h"] bool Thread::vcpu_pagefault(Address pfa, Mword err, Mword ip) { (void)ip; - Vcpu_state *vcpu = access_vcpu(); + Vcpu_state *vcpu = vcpu_state().access(); if (vcpu_pagefaults_enabled(vcpu)) { spill_user_state();