1 /*!
2 * \file
3 * \brief L4 IPC System Calls, PPC
4 * \ingroup api_calls
5 */
6 /*
7 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
8 * economic rights: Technische Universität Dresden (Germany)
9 *
10 * This file is part of TUD:OS and distributed under the terms of the
11 * GNU General Public License 2.
12 * Please see the COPYING-GPL-2 file for details.
13 *
14 * As a special exception, you may use this file as part of a free software
15 * library without restriction. Specifically, if other files instantiate
16 * templates or use macros or inline functions from this file, or you compile
17 * this file and link it with other files to produce an executable, this
18 * file does not by itself cause the resulting executable to be covered by
19 * the GNU General Public License. This exception does not however
20 * invalidate any other reasons why the executable file might be covered by
21 * the GNU General Public License.
22 */
23 #pragma once
24
25 #ifdef __GNUC__
26
27 #include <l4/sys/compiler.h>
28
29 #include_next <l4/sys/ipc.h>
30
31 #ifndef L4_SYSCALL_MAGIC_OFFSET
32 # define L4_SYSCALL_MAGIC_OFFSET 8
33 #endif
34 #define L4_SYSCALL_INVOKE (-0x00000004-L4_SYSCALL_MAGIC_OFFSET)
35
36 L4_INLINE l4_msgtag_t
l4_ipc(l4_cap_idx_t dest,l4_utcb_t * utcb,l4_umword_t flags,l4_umword_t slabel,l4_msgtag_t tag,l4_umword_t * rlabel,l4_timeout_t timeout)37 l4_ipc(l4_cap_idx_t dest, l4_utcb_t *utcb,
38 l4_umword_t flags,
39 l4_umword_t slabel,
40 l4_msgtag_t tag,
41 l4_umword_t *rlabel,
42 l4_timeout_t timeout) L4_NOTHROW
43 {
44 register l4_umword_t _dest __asm__("r4") = dest | flags;
45 register l4_umword_t _timeout __asm__("r5") = timeout.raw;
46 register l4_mword_t _tag __asm__("r3") = tag.raw;
47 register l4_umword_t _lab __asm__("r6") = slabel;
48 (void)utcb;
49
50 __asm__ __volatile__
51 ("bla %[addr]"
52 :
53 "+r" (_dest),
54 "+r" (_timeout),
55 "+r" (_lab),
56 "+r" (_tag)
57 :
58 [addr] "i" (L4_SYSCALL_INVOKE)
59 :
60 "memory", "lr");
61
62 if (rlabel)
63 *rlabel = _lab;
64 tag.raw = _tag;
65 return tag;
66 }
67
68 #endif //__GNUC__
69