2 * (c) 2008-2009 Technische Universität Dresden
3 * This file is part of TUD:OS and distributed under the terms of the
4 * GNU Lesser General Public License 2.1.
5 * Please see the COPYING-LGPL-2.1 file for details.
7 #include <l4/sys/ipc.h>
8 #include <l4/sigma0/sigma0.h>
13 * \param pager pager implementing Sigma0 protocol
14 * \param gate slot to attach to
15 * \return #0 on success
16 * -#L4SIGMA0_IPCERROR IPC error
17 * -#L4SIGMA0_NOFPAGE no fpage received
19 int l4sigma0_new_client(l4_cap_idx_t pager, l4_cap_idx_t gate)
21 l4_msgtag_t tag = l4_msgtag(L4_PROTO_SIGMA0, 1, 0, 0);
22 l4_utcb_t *utcb = l4_utcb();
23 l4_msg_regs_t *m = l4_utcb_mr_u(utcb);
24 l4_buf_regs_t *b = l4_utcb_br_u(utcb);
26 m->mr[0] = SIGMA0_REQ_NEW_CLIENT;
28 b->br[0] = L4_ITEM_MAP;
29 b->br[1] = l4_obj_fpage(gate, 0, 0).raw;
31 tag = l4_ipc_call(pager, utcb, tag, L4_IPC_NEVER);
32 if (l4_msgtag_has_error(tag))
33 return -L4SIGMA0_IPCERROR;
35 if (l4_msgtag_items(tag) != 1)
36 return -L4SIGMA0_NOFPAGE;