6 class Kobject_helper_base
9 static Mword _utcb_dummy[];
10 static Utcb *utcb_dummy()
12 char *x = reinterpret_cast<char*>(&_utcb_dummy);
13 return reinterpret_cast<Utcb*>(x);
16 static L4_msg_tag no_reply() { return L4_msg_tag(L4_msg_tag::Schedule); }
17 static bool have_receive(Utcb *rcv) { return rcv != utcb_dummy(); }
20 template<typename T, typename Base = Kobject>
21 class Kobject_h : public Base, protected Kobject_helper_base
24 static Sender *_sender(Thread *, Sender *t) { return t; }
25 static Sender *_sender(Thread *ct, ...) { return ct; }
29 explicit Kobject_h() : Base() {}
31 template< typename A >
32 explicit Kobject_h(A a) : Base(a) {}
34 void invoke(L4_obj_ref self, Mword rights, Syscall_frame *f, Utcb *u)
37 if (EXPECT_TRUE(self.op() & L4_obj_ref::Ipc_send))
38 res = static_cast<T*>(this)->T::kinvoke(self, rights, f, (Utcb const *)u,
39 self.have_recv() ? u : utcb_dummy());
41 if (EXPECT_FALSE(res.has_error()))
51 Thread *t = current_thread();
52 Sender *s = (self.op() & L4_obj_ref::Ipc_open_wait) ? 0 : _sender(t, static_cast<T*>(this));
53 t->do_ipc(f->tag(), 0, 0, true, s, f->timeout(), f, rights);
66 Mword Kobject_helper_base::_utcb_dummy[(sizeof(Utcb) + sizeof(Mword) - 1) / sizeof(Mword)];