]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/syscalls.cpp
cabc8259b8fabfe681dff02b377622cf434630b1
[l4.git] / kernel / fiasco / src / kern / syscalls.cpp
1 INTERFACE:
2
3 class Sys_ex_regs_frame;
4
5
6 IMPLEMENTATION:
7
8 #include <cstdio>
9
10 #include "l4_types.h"
11
12 #include "config.h"
13 #include "entry_frame.h"
14 #include "feature.h"
15 #include "irq.h"
16 #include "logdefs.h"
17 #include "map_util.h"
18 #include "processor.h"
19 #include "ram_quota.h"
20 #include "space.h"
21 #include "std_macros.h"
22 #include "task.h"
23 #include "thread.h"
24 #include "thread_state.h"
25 #include "warn.h"
26
27 class Syscalls : public Thread
28 {
29
30 public:
31   void sys_invoke_object();
32 protected:
33   Syscalls();
34 };
35
36
37 extern "C" void sys_invoke_debug(Kobject *o, Syscall_frame *f) __attribute__((weak));
38
39
40 PUBLIC inline NOEXPORT ALWAYS_INLINE
41 void
42 Syscalls::sys_invoke_debug()
43 {
44   if (!&::sys_invoke_debug)
45     return;
46
47   Syscall_frame *f = this->regs();
48   //printf("sys_invoke_debugger(f=%p, obj=%lx)\n", f, f->ref().raw());
49   Kobject_iface *o = space()->obj_space()->lookup_local(f->ref().cap());
50   if (o)
51     ::sys_invoke_debug(o->kobject(), f);
52   else
53     f->tag(commit_error(access_utcb(), L4_error::Not_existent));
54 }
55
56
57 // these wrappers must come last in the source so that the real sys-call
58 // implementations can be inlined by g++
59
60 extern "C" void sys_invoke_debug_wrapper()
61 { static_cast<Syscalls*>(current_thread())->sys_invoke_debug(); }
62
63
64 //---------------------------------------------------------------------------
65 INTERFACE [ia32 || ux || amd64]:
66
67 extern void (*syscall_table[])();
68
69
70 //---------------------------------------------------------------------------
71 IMPLEMENTATION [ia32 || ux || amd64]:
72
73 void (*syscall_table[])() =
74 {
75   sys_ipc_wrapper,
76   0,
77   sys_invoke_debug_wrapper,
78 };
79