1 /*
2 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3 * Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU Lesser General Public License 2.1.
7 * Please see the COPYING-LGPL-2.1 file for details.
8 */
9 #include <l4/sys/ipc.h>
10 #include <l4/sigma0/sigma0.h>
11
12 L4_CV int
l4sigma0_new_client(l4_cap_idx_t pager,l4_cap_idx_t gate)13 l4sigma0_new_client(l4_cap_idx_t pager, l4_cap_idx_t gate)
14 {
15 l4_msgtag_t tag = l4_msgtag(L4_PROTO_SIGMA0, 1, 0, 0);
16 l4_utcb_t *utcb = l4_utcb();
17 l4_msg_regs_t *m = l4_utcb_mr_u(utcb);
18 l4_buf_regs_t *b = l4_utcb_br_u(utcb);
19
20 m->mr[0] = SIGMA0_REQ_NEW_CLIENT;
21 b->bdr = 0;
22 b->br[0] = L4_ITEM_MAP;
23 b->br[1] = l4_obj_fpage(gate, 0, 0).raw;
24
25 tag = l4_ipc_call(pager, utcb, tag, L4_IPC_NEVER);
26 if (l4_msgtag_has_error(tag))
27 return -L4SIGMA0_IPCERROR;
28
29 if (l4_msgtag_items(tag) != 1)
30 return -L4SIGMA0_NOFPAGE;
31
32 return 0;
33 }
34