]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/syscalls.cpp
update
[l4.git] / kernel / fiasco / src / kern / syscalls.cpp
1 //---------------------------------------------------------------------------
2 IMPLEMENTATION [debug]:
3
4 #include "space.h"
5 #include "task.h"
6 #include "thread.h"
7
8 class Syscalls : public Thread { };
9
10 extern "C" void sys_invoke_debug(Kobject *o, Syscall_frame *f);
11
12 PUBLIC inline NOEXPORT ALWAYS_INLINE
13 void
14 Syscalls::sys_invoke_debug()
15 {
16   Syscall_frame *f = this->regs();
17   //printf("sys_invoke_debugger(f=%p, obj=%lx)\n", f, f->ref().raw());
18   Kobject_iface *o = space()->obj_space()->lookup_local(f->ref().cap());
19   if (o)
20     ::sys_invoke_debug(o->kobject(), f);
21   else
22     f->tag(commit_error(access_utcb(), L4_error::Not_existent));
23 }
24
25
26 // these wrappers must come last in the source so that the real sys-call
27 // implementations can be inlined by g++
28
29 extern "C" void sys_invoke_debug_wrapper()
30 { static_cast<Syscalls*>(current_thread())->sys_invoke_debug(); }
31
32 //---------------------------------------------------------------------------
33 IMPLEMENTATION [!debug]:
34
35 #include "thread.h"
36
37 extern "C" void sys_invoke_debug_wrapper() {}
38
39 //---------------------------------------------------------------------------
40 INTERFACE [ia32 || ux || amd64]:
41
42 extern void (*syscall_table[])();
43
44
45 //---------------------------------------------------------------------------
46 IMPLEMENTATION [ia32 || ux || amd64]:
47
48 void (*syscall_table[])() =
49 {
50   sys_ipc_wrapper,
51   0,
52   sys_invoke_debug_wrapper,
53 };
54