1 /**
2  * \internal
3  * \file
4  * \brief  IPC system call for x86
5  */
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  *               Alexander Warg <warg@os.inf.tu-dresden.de>,
9  *               Frank Mehnert <fm3@os.inf.tu-dresden.de>,
10  *               Jork Löser <jork@os.inf.tu-dresden.de>
11  *     economic rights: Technische Universität Dresden (Germany)
12  *
13  * This file is part of TUD:OS and distributed under the terms of the
14  * GNU General Public License 2.
15  * Please see the COPYING-GPL-2 file for details.
16  *
17  * As a special exception, you may use this file as part of a free software
18  * library without restriction.  Specifically, if other files instantiate
19  * templates or use macros or inline functions from this file, or you compile
20  * this file and link it with other files to produce an executable, this
21  * file does not by itself cause the resulting executable to be covered by
22  * the GNU General Public License.  This exception does not however
23  * invalidate any other reasons why the executable file might be covered by
24  * the GNU General Public License.
25  */
26 #pragma once
27 
28 #include <l4/sys/consts.h>
29 
30 L4_INLINE l4_msgtag_t
l4_ipc(l4_cap_idx_t dest,l4_utcb_t * u,l4_umword_t flags,l4_umword_t slabel,l4_msgtag_t tag,l4_umword_t * rlabel,l4_timeout_t timeout)31 l4_ipc(l4_cap_idx_t dest, l4_utcb_t *u,
32        l4_umword_t flags,
33        l4_umword_t slabel,
34        l4_msgtag_t tag,
35        l4_umword_t *rlabel,
36        l4_timeout_t timeout) L4_NOTHROW
37 {
38   l4_umword_t dummy, dummy1, dummy2;
39 
40   (void)u;
41 
42   __asm__ __volatile__
43     (L4_ENTER_KERNEL
44      :
45      "=d" (dummy2),
46      "=S" (slabel),
47      "=c" (dummy1),
48      "=D" (dummy),
49      "=a" (tag.raw)
50      :
51      "S" (slabel),
52      "c" (timeout),
53      "a" (tag.raw),
54      "d" (dest | flags)
55      L4S_PIC_SYSCALL
56      :
57      "memory", "cc" L4S_PIC_CLOBBER
58      );
59 
60   if (rlabel)
61     *rlabel = slabel;
62 
63   return tag;
64 }
65