]> rtime.felk.cvut.cz Git - l4.git/blobdiff - kernel/fiasco/src/kern/syscalls.cpp
update
[l4.git] / kernel / fiasco / src / kern / syscalls.cpp
index 69b3a44ed651ff3f8c9bccf588568a81a8098d19..16f42d800f7cc9e98d4575dde6f928f24521e8b9 100644 (file)
@@ -1,34 +1,51 @@
+IMPLEMENTATION:
+
+#include "thread_object.h"
+#include "thread_state.h"
+
+extern "C"
+void
+sys_ipc_wrapper()
+{
+  // FIXME: use UTCB from user, not the kernel var (remove access utcb
+  assert_kdb (!(current()->state() & Thread_drq_ready));
+
+  Thread *curr = current_thread();
+  Syscall_frame *f = curr->regs();
+
+  Obj_cap obj = f->ref();
+  Utcb *utcb = curr->access_utcb();
+  // printf("sys_invoke_object(f=%p, obj=%x)\n", f, f->obj_ref());
+  unsigned char rights;
+  Kobject_iface *o = obj.deref(&rights);
+  L4_msg_tag e;
+  if (EXPECT_TRUE(o!=0))
+    o->invoke(obj, rights, f, utcb);
+  else
+    f->tag(curr->commit_error(utcb, L4_error::Not_existent));
+}
+
+
 //---------------------------------------------------------------------------
 IMPLEMENTATION [debug]:
 
 #include "space.h"
 #include "task.h"
-#include "thread.h"
-
-class Syscalls : public Thread { };
 
 extern "C" void sys_invoke_debug(Kobject *o, Syscall_frame *f);
 
-PUBLIC inline NOEXPORT ALWAYS_INLINE
-void
-Syscalls::sys_invoke_debug()
+extern "C" void sys_invoke_debug_wrapper()
 {
-  Syscall_frame *f = this->regs();
+  Thread *curr = current_thread();
+  Syscall_frame *f = curr->regs();
   //printf("sys_invoke_debugger(f=%p, obj=%lx)\n", f, f->ref().raw());
-  Kobject_iface *o = space()->obj_space()->lookup_local(f->ref().cap());
+  Kobject_iface *o = curr->space()->obj_space()->lookup_local(f->ref().cap());
   if (o)
     ::sys_invoke_debug(o->kobject(), f);
   else
-    f->tag(commit_error(access_utcb(), L4_error::Not_existent));
+    f->tag(curr->commit_error(curr->access_utcb(), L4_error::Not_existent));
 }
 
-
-// these wrappers must come last in the source so that the real sys-call
-// implementations can be inlined by g++
-
-extern "C" void sys_invoke_debug_wrapper()
-{ static_cast<Syscalls*>(current_thread())->sys_invoke_debug(); }
-
 //---------------------------------------------------------------------------
 IMPLEMENTATION [!debug]: