]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/thread-vcpu.cpp
update
[l4.git] / kernel / fiasco / src / kern / thread-vcpu.cpp
1 INTERFACE:
2
3 extern "C" void vcpu_resume(Trap_state *, Return_frame *sp)
4    FIASCO_FASTCALL FIASCO_NORETURN;
5
6
7 // --------------------------------------------------------------------------
8 IMPLEMENTATION:
9
10 #include "logdefs.h"
11 #include "vcpu.h"
12
13 PUBLIC inline NEEDS["logdefs.h", "vcpu.h"]
14 bool
15 Thread::vcpu_pagefault(Address pfa, Mword err, Mword ip)
16 {
17   (void)ip;
18   Vcpu_state *vcpu = access_vcpu();
19   if (vcpu_pagefaults_enabled(vcpu))
20     {
21       spill_user_state();
22       vcpu_enter_kernel_mode(vcpu);
23       LOG_TRACE("VCPU events", "vcpu", this, __context_vcpu_log_fmt,
24           Vcpu_log *l = tbe->payload<Vcpu_log>();
25           l->type = 3;
26           l->state = vcpu->_saved_state;
27           l->ip = ip;
28           l->sp = pfa;
29           l->space = vcpu_user_space() ? static_cast<Task*>(vcpu_user_space())->dbg_id() : ~0;
30           );
31       vcpu->_ts.set_pagefault(pfa, err);
32       vcpu_save_state_and_upcall();
33       return true;
34     }
35
36   return false;
37 }
38
39