L4Re - L4 Runtime Environment
ipc_gate.h
Go to the documentation of this file.
1 
18 /*
19  * (c) 2009-2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
20  * Alexander Warg <warg@os.inf.tu-dresden.de>
21  * economic rights: Technische Universit├Ąt Dresden (Germany)
22  *
23  * This file is part of TUD:OS and distributed under the terms of the
24  * GNU General Public License 2.
25  * Please see the COPYING-GPL-2 file for details.
26  *
27  * As a special exception, you may use this file as part of a free software
28  * library without restriction. Specifically, if other files instantiate
29  * templates or use macros or inline functions from this file, or you compile
30  * this file and link it with other files to produce an executable, this
31  * file does not by itself cause the resulting executable to be covered by
32  * the GNU General Public License. This exception does not however
33  * invalidate any other reasons why the executable file might be covered by
34  * the GNU General Public License.
35  */
36 #pragma once
37 
38 #include <l4/sys/utcb.h>
39 #include <l4/sys/types.h>
40 #include <l4/sys/rcv_endpoint.h>
41 
58 L4_INLINE l4_msgtag_t
60  l4_umword_t label)
61  L4_DEPRECATED("Use l4_rcv_ep_bind_thread().");
62 
67 L4_INLINE l4_msgtag_t
68 l4_ipc_gate_bind_thread_u(l4_cap_idx_t gate, l4_cap_idx_t thread,
69  l4_umword_t label, l4_utcb_t *utcb)
70  L4_DEPRECATED("Use l4_rcv_ep_bind_thread_u().");
71 
78 L4_INLINE l4_msgtag_t
80 
85 L4_INLINE l4_msgtag_t
86 l4_ipc_gate_get_infos_u(l4_cap_idx_t gate, l4_umword_t *label, l4_utcb_t *utcb);
87 
95 {
98 };
99 
100 
101 /* IMPLEMENTATION -----------------------------------------------------------*/
102 
103 #include <l4/sys/ipc.h>
104 
105 L4_INLINE l4_msgtag_t
106 l4_ipc_gate_bind_thread_u(l4_cap_idx_t gate,
107  l4_cap_idx_t thread, l4_umword_t label,
108  l4_utcb_t *utcb)
109 {
110  return l4_rcv_ep_bind_thread_u(gate, thread, label, utcb);
111 }
112 
113 L4_INLINE l4_msgtag_t
114 l4_ipc_gate_get_infos_u(l4_cap_idx_t gate, l4_umword_t *label, l4_utcb_t *utcb)
115 {
116  l4_msgtag_t tag;
117  l4_msg_regs_t *m = l4_utcb_mr_u(utcb);
118  m->mr[0] = L4_IPC_GATE_GET_INFO_OP;
119  tag = l4_ipc_call(gate, utcb, l4_msgtag(L4_PROTO_KOBJECT, 1, 0, 0),
120  L4_IPC_NEVER);
121  if (!l4_msgtag_has_error(tag) && l4_msgtag_label(tag) >= 0)
122  *label = m->mr[0];
123 
124  return tag;
125 }
126 
127 
128 
129 L4_INLINE l4_msgtag_t
131  l4_umword_t label)
132 {
133  return l4_rcv_ep_bind_thread_u(gate, thread, label, l4_utcb());
134 }
135 
136 L4_INLINE l4_msgtag_t
138 {
139  return l4_ipc_gate_get_infos_u(gate, label, l4_utcb());
140 }
Encapsulation of the message-register block in the UTCB.
Definition: utcb.h:78
Bind operation.
Definition: ipc_gate.h:96
Protocol for messages to a a generic kobject.
Definition: types.h:62
unsigned l4_msgtag_has_error(l4_msgtag_t t) L4_NOTHROW
Test for error indicator flag.
Definition: types.h:435
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition: utcb.h:80
Common L4 ABI Data Types.
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition: ipc.h:445
unsigned long l4_cap_idx_t
L4 Capability selector Type.
Definition: types.h:341
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition: utcb.h:67
#define L4_IPC_NEVER
never timeout
Definition: __timeout.h:80
long l4_msgtag_label(l4_msgtag_t t) L4_NOTHROW
Get the protocol of tag.
Definition: types.h:418
L4_ipc_gate_ops
Operations on the IPC-gate.
Definition: ipc_gate.h:94
l4_msgtag_t l4_ipc_gate_bind_thread(l4_cap_idx_t gate, l4_cap_idx_t thread, l4_umword_t label)
Bind the IPC gate to a thread.
Definition: ipc_gate.h:130
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
Receive endpoint C interface.
Info operation.
Definition: ipc_gate.h:97
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition: utcb.h:340
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition: types.h:407
l4_msgtag_t l4_ipc_gate_get_infos(l4_cap_idx_t gate, l4_umword_t *label)
Get information about the IPC-gate.
Definition: ipc_gate.h:137
Message tag data structure.
Definition: types.h:158
#define L4_DEPRECATED(s)
Mark symbol deprecated.
Definition: compiler.h:239