L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
ipc_types
Go to the documentation of this file.
1// vi:set ft=cpp: -*- Mode: C++ -*-
2/*
3 * (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com>
4 *
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU General Public License 2.
7 * Please see the COPYING-GPL-2 file for details.
8 *
9 * As a special exception, you may use this file as part of a free software
10 * library without restriction. Specifically, if other files instantiate
11 * templates or use macros or inline functions from this file, or you compile
12 * this file and link it with other files to produce an executable, this
13 * file does not by itself cause the resulting executable to be covered by
14 * the GNU General Public License. This exception does not however
15 * invalidate any other reasons why the executable file might be covered by
16 * the GNU General Public License.
17 */
18#pragma once
19
20#include "capability.h"
21#include "types"
22#include "ipc_basics"
27namespace L4 {
28
30typedef int Opcode;
31
32namespace Ipc {
33
42template<typename T> struct L4_EXPORT Out;
43
44
52template<typename T> struct L4_EXPORT In_out
53{
54 T v;
55 In_out() {}
56 In_out(T v) : v(v) {}
57 operator T () const { return v; }
58 operator T & () { return v; }
59};
60
61namespace Msg {
62template<typename A> struct Elem< In_out<A *> > : Elem<A *> {};
63
64template<typename A>
65struct Svr_xmit< In_out<A *> > : Svr_xmit<A *>, Svr_xmit<A const *>
66{
67 using Svr_xmit<A *>::from_svr;
68 using Svr_xmit<A const *>::to_svr;
69};
70
71template<typename A>
72struct Clnt_xmit< In_out<A *> > : Clnt_xmit<A *>, Clnt_xmit<A const *>
73{
74 using Clnt_xmit<A *>::from_msg;
75 using Clnt_xmit<A const *>::to_msg;
76};
77
78template<typename A>
79struct Is_valid_rpc_type< In_out<A *> > : Is_valid_rpc_type<A *> {};
80template<typename A>
81struct Is_valid_rpc_type< In_out<A const *> > : L4::Types::False {};
82
83#ifdef CONFIG_ALLOW_REFS
84template<typename A> struct Elem< In_out<A &> > : Elem<A &> {};
85
86template<typename A>
87struct Svr_xmit< In_out<A &> > : Svr_xmit<A &>, Svr_xmit<A const &>
88{
89 using Svr_xmit<A &>::from_svr;
90 using Svr_xmit<A const &>::to_svr;
91};
92
93template<typename A>
94struct Clnt_xmit< In_out<A &> > : Clnt_xmit<A &>, Clnt_xmit<A const &>
95{
96 using Clnt_xmit<A &>::from_msg;
97 using Clnt_xmit<A const &>::to_msg;
98};
99
100template<typename A>
101struct Is_valid_rpc_type< In_out<A &> > : Is_valid_rpc_type<A &> {};
102template<typename A>
103struct Is_valid_rpc_type< In_out<A const &> > : L4::Types::False {};
104
105#else
106
107template<typename A>
108struct Is_valid_rpc_type< In_out<A &> > : L4::Types::False {};
109
110#endif
111
112// Value types don't make sense for output.
113template<typename A>
114struct Is_valid_rpc_type< In_out<A> > : L4::Types::False {};
115
116}
117
118
127template<typename T> struct L4_EXPORT As_value
128{
129 typedef T value_type;
130 T v;
131 As_value() noexcept {}
132 As_value(T v) noexcept : v(v) {}
133 operator T () const noexcept { return v; }
134 operator T & () noexcept { return v; }
135};
136
137namespace Msg {
138template<typename T> struct Class< As_value<T> > : Cls_data {};
139template<typename T> struct Elem< As_value<T> > : Elem<T> {};
140template<typename T> struct Elem< As_value<T> *> : Elem<T *> {};
141}
142
143
147template<typename T> struct L4_EXPORT Opt
148{
150 bool _valid;
151
153 Opt() noexcept : _valid(false) {}
154
156 Opt(T value) noexcept : _value(value), _valid(true) {}
157
159 Opt &operator = (T value) noexcept
160 {
161 this->_value = value;
162 this->_valid = true;
163 return *this;
164 }
165
167 void set_valid(bool valid = true) noexcept { _valid = valid; }
168
170 T *operator -> () noexcept { return &this->_value; }
172 T const *operator -> () const noexcept { return &this->_value; }
174 T value() const noexcept { return this->_value; }
176 T &value() noexcept { return this->_value; }
178 bool is_valid() const noexcept { return this->_valid; }
179};
180
181namespace Msg {
182template<typename T> struct Elem< Opt<T &> > : Elem<T &>
183{
184 enum { Is_optional = true };
185 typedef Opt<typename Elem<T &>::svr_type> &svr_arg_type;
186 typedef Opt<typename Elem<T &>::svr_type> svr_type;
187};
188
189template<typename T> struct Elem< Opt<T *> > : Elem<T *>
190{
191 enum { Is_optional = true };
192 typedef Opt<typename Elem<T *>::svr_type> &svr_arg_type;
193 typedef Opt<typename Elem<T *>::svr_type> svr_type;
194};
195
196
197
198template<typename T, typename CLASS>
199struct Svr_val_ops<Opt<T>, Dir_out, CLASS> : Svr_noops< Opt<T> >
200{
201 typedef Opt<T> svr_type;
202 typedef Svr_val_ops<T, Dir_out, CLASS> Native;
203
204 using Svr_noops< Opt<T> >::to_svr;
205 static int to_svr(char *msg, unsigned offset, unsigned limit,
206 Opt<T> &arg, Dir_out, CLASS) noexcept
207 {
208 return Native::to_svr(msg, offset, limit, arg.value(), Dir_out(), CLASS());
209 }
210
211 using Svr_noops< Opt<T> >::from_svr;
212 static int from_svr(char *msg, unsigned offset, unsigned limit, long ret,
213 svr_type &arg, Dir_out, CLASS) noexcept
214 {
215 if (arg.is_valid())
216 return Native::from_svr(msg, offset, limit, ret, arg.value(),
217 Dir_out(), CLASS());
218 return offset;
219 }
220};
221
222template<typename T> struct Elem< Opt<T> > : Elem<T>
223{
224 enum { Is_optional = true };
225 typedef Opt<T> arg_type;
226};
227
228template<typename T> struct Elem< Opt<T const *> > : Elem<T const *>
229{
230 enum { Is_optional = true };
231 typedef Opt<T const *> arg_type;
232};
233
234template<typename T>
235struct Is_valid_rpc_type< Opt<T const &> > : L4::Types::False {};
236
237template<typename T, typename CLASS>
238struct Clnt_val_ops<Opt<T>, Dir_in, CLASS> : Clnt_noops< Opt<T> >
239{
240 typedef Opt<T> arg_type;
241 typedef Detail::_Clnt_val_ops<typename Elem<T>::arg_type, Dir_in, CLASS> Native;
242
243 using Clnt_noops< Opt<T> >::to_msg;
244 static int to_msg(char *msg, unsigned offset, unsigned limit,
245 arg_type arg, Dir_in, CLASS) noexcept
246 {
247 if (arg.is_valid())
248 return Native::to_msg(msg, offset, limit,
249 Detail::_Plain<T>::deref(arg.value()),
250 Dir_in(), CLASS());
251 return offset;
252 }
253};
254
255template<typename T> struct Class< Opt<T> > :
256 Class< typename Detail::_Plain<T>::type > {};
257template<typename T> struct Direction< Opt<T> > : Direction<T> {};
258}
259
269{
270public:
278 explicit Small_buf(L4::Cap<void> cap, unsigned long flags = 0) noexcept
279 : _data(cap.cap() | L4_RCV_ITEM_SINGLE_CAP | flags) {}
280
285 explicit Small_buf(l4_cap_idx_t cap, unsigned long flags = 0) noexcept
286 : _data(cap | L4_RCV_ITEM_SINGLE_CAP | flags) {}
287
288 l4_umword_t raw() const noexcept { return _data; }
289private:
290 l4_umword_t _data;
291};
292
297{
298public:
300 enum Type
301 {
302 Special = L4_FPAGE_SPECIAL << 4,
303 Memory = L4_FPAGE_MEMORY << 4,
304 Io = L4_FPAGE_IO << 4,
305 Obj = L4_FPAGE_OBJ << 4
306 };
307
310 {
311 Map = L4_MAP_ITEM_MAP,
312 Grant = L4_MAP_ITEM_GRANT,
313 };
314
317 {
318 None = 0,
319 Cached = L4_FPAGE_CACHEABLE << 4,
320 Buffered = L4_FPAGE_BUFFERABLE << 4,
321 Uncached = L4_FPAGE_UNCACHEABLE << 4
322 };
323
324 enum Continue
325 {
326 Single = 0,
327 Last = 0,
328 More = L4_ITEM_CONT,
329 Compound = L4_ITEM_CONT,
330 };
331
332 Gen_fpage(l4_umword_t base, l4_umword_t data) noexcept
333 : _base(base), _data(data)
334 {}
335
336 Gen_fpage(Type type, l4_addr_t base, int order,
337 unsigned char rights,
338 l4_addr_t snd_base,
339 Map_type map_type,
340 Cacheopt cache, Continue cont) noexcept
341 : _base(L4_ITEM_MAP | (snd_base & (~0UL << 12)) | l4_umword_t(map_type)
342 | l4_umword_t(cache) | l4_umword_t(cont)),
343 _data(base | l4_umword_t(type) | rights | (l4_umword_t(order) << 6))
344 {}
345
346 unsigned order() const noexcept { return (_data >> 6) & 0x3f; }
347 unsigned snd_order() const noexcept { return (_data >> 6) & 0x3f; }
348 unsigned rcv_order() const noexcept { return (_base >> 6) & 0x3f; }
349 l4_addr_t base() const noexcept { return _data & (~0UL << 12); }
350 l4_addr_t snd_base() const noexcept { return _base & (~0UL << 12); }
351 void snd_base(l4_addr_t b) noexcept { _base = (_base & ~(~0UL << 12)) | (b & (~0UL << 12)); }
352
354 bool is_valid() const noexcept { return _base & L4_ITEM_MAP; }
365 bool cap_received() const noexcept { return (_base & 0x3e) == 0x38; }
377 bool id_received() const noexcept { return (_base & 0x3e) == 0x3c; }
387 bool local_id_received() const noexcept { return (_base & 0x3e) == 0x3e; }
388
395 bool is_compound() const noexcept { return _base & 1; }
397 l4_umword_t data() const noexcept { return _data; }
399 l4_umword_t base_x() const noexcept { return _base; }
400
401protected:
402 l4_umword_t _base;
403 l4_umword_t _data;
404};
405
407class Snd_fpage : public Gen_fpage
408{
409public:
410 Snd_fpage(l4_umword_t base = 0, l4_umword_t data = 0) noexcept
411 : Gen_fpage(base, data)
412 {}
413
414 Snd_fpage(l4_fpage_t const &fp, l4_addr_t snd_base = 0,
415 Map_type map_type = Map,
416 Cacheopt cache = None, Continue cont = Last) noexcept
417 : Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12)) | l4_umword_t(map_type)
418 | l4_umword_t(cache) | l4_umword_t(cont),
419 fp.raw)
420 {}
421
422 Snd_fpage(L4::Cap<void> cap, unsigned rights, Map_type map_type = Map) noexcept
423 : Gen_fpage(L4_ITEM_MAP | l4_umword_t(map_type) | (rights & 0xf0),
424 cap.fpage(rights).raw)
425 {}
426
427 static Snd_fpage obj(l4_cap_idx_t base, int order,
428 unsigned char rights,
429 l4_addr_t snd_base = 0,
430 Map_type map_type = Map,
431 Continue cont = Last) noexcept
432 {
433 return Snd_fpage(l4_obj_fpage(base, order, rights), snd_base,
434 map_type, None, cont);
435 }
436
437 static Snd_fpage mem(l4_addr_t base, int order,
438 unsigned char rights,
439 l4_addr_t snd_base = 0,
440 Map_type map_type = Map,
441 Cacheopt cache = None, Continue cont = Last) noexcept
442 {
443 return Snd_fpage(l4_fpage(base, order, rights), snd_base, map_type, cache,
444 cont);
445 }
446
447 static Snd_fpage io(unsigned long base, int order,
448 unsigned char rights,
449 l4_addr_t snd_base = 0,
450 Map_type map_type = Map,
451 Continue cont = Last) noexcept
452 {
453 return Snd_fpage(l4_fpage_set_rights(l4_iofpage(base, order), rights),
454 snd_base, map_type, None, cont);
455 }
456};
457
459class Rcv_fpage : public Gen_fpage
460{
461public:
462 Rcv_fpage() noexcept : Gen_fpage(0, 0), _rcv_task(L4_INVALID_CAP) {}
463 Rcv_fpage(l4_fpage_t const &fp, l4_addr_t snd_base = 0,
464 l4_cap_idx_t rcv_task = L4_INVALID_CAP) noexcept
465 : Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12))
466 | (l4_is_valid_cap(rcv_task) ? Compound : 0),
467 fp.raw),
468 _rcv_task(rcv_task)
469 {}
470
471 static Rcv_fpage obj(l4_cap_idx_t base, int order, l4_addr_t snd_base = 0,
472 L4::Cap<void> rcv_task = L4::Cap<void>::Invalid) noexcept
473 {
474 return Rcv_fpage(l4_obj_fpage(base, order, 0), snd_base,
475 rcv_task.cap());
476 }
477
478 static Rcv_fpage mem(l4_addr_t base, int order, l4_addr_t snd_base = 0,
479 L4::Cap<void> rcv_task = L4::Cap<void>::Invalid) noexcept
480 {
481 return Rcv_fpage(l4_fpage(base, order, 0), snd_base, rcv_task.cap());
482 }
483
484 static Rcv_fpage io(unsigned long base, int order, l4_addr_t snd_base = 0,
485 L4::Cap<void> rcv_task = L4::Cap<void>::Invalid) noexcept
486 {
487 return Rcv_fpage(l4_iofpage(base, order), snd_base, rcv_task.cap());
488 }
489
490 l4_cap_idx_t rcv_task() const { return _rcv_task; }
491
492protected:
493 l4_cap_idx_t _rcv_task;
494};
495
496
497namespace Msg {
498
499// Snd_fpage are out items
500template<> struct Class<L4::Ipc::Snd_fpage> : Cls_item {};
501
502// Rcv_fpage are buffer items
503template<> struct Class<L4::Ipc::Rcv_fpage> : Cls_buffer {};
504
505template<>
506struct Clnt_val_ops<L4::Ipc::Rcv_fpage, Dir_in, Cls_buffer>
507 : Clnt_noops<L4::Ipc::Rcv_fpage>
508{
509 using Clnt_noops<L4::Ipc::Rcv_fpage>::to_msg;
510
511 static int to_msg(char *msg, unsigned offs, unsigned limit,
512 L4::Ipc::Rcv_fpage arg, Dir_in, Cls_buffer) noexcept
513 {
514 offs = align_to<l4_umword_t>(offs);
515 unsigned words = arg.is_compound() ? 3 : 2;
516 if (L4_UNLIKELY(!check_size<l4_umword_t>(offs, limit, words)))
517 return -L4_EMSGTOOLONG;
518 auto *buf = reinterpret_cast<l4_umword_t*>(msg + offs);
519 *buf++ = arg.base_x();
520 *buf++ = arg.data();
521 if (arg.is_compound())
522 *buf++ = arg.rcv_task();
523 return offs + sizeof(l4_umword_t) * words;
524 }
525};
526
527
528// Remove receive buffers from server-side arguments
529template<> struct Elem<L4::Ipc::Rcv_fpage>
530{
531 typedef L4::Ipc::Rcv_fpage arg_type;
532 typedef void svr_type;
533 typedef void svr_arg_type;
534 enum { Is_optional = false };
535};
536
537// Small_buf are buffer items
538template<> struct Class<L4::Ipc::Small_buf> : Cls_buffer {};
539
540// Remove receive buffers from server-side arguments
541template<> struct Elem<L4::Ipc::Small_buf>
542{
543 typedef L4::Ipc::Small_buf arg_type;
544 typedef void svr_type;
545 typedef void svr_arg_type;
546 enum { Is_optional = false };
547};
548} // namespace Msg
549
550// L4::Cap<> handling
551
562template<typename T> class Cap
563{
564 template<typename O> friend class Cap;
565 l4_umword_t _cap_n_rights;
566
567public:
568 enum
569 {
576
582 };
583
585 template<typename O>
586 Cap(Cap<O> const &o) noexcept : _cap_n_rights(o._cap_n_rights)
587 {
588 L4::Cap<T>::template check_convertible_from<O>();
589 }
590
593 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
594 {}
595
597 template<typename O>
599 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
600 {
601 L4::Cap<T>::template check_convertible_from<O>();
602 }
603
605 Cap() noexcept : _cap_n_rights(L4_INVALID_CAP) {}
606
614 Cap(L4::Cap<T> cap, unsigned char rights) noexcept
615 : _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)) {}
616
622 static Cap from_ci(l4_cap_idx_t c) noexcept
623 { return Cap(L4::Cap<T>(c & Cap_mask), c & Rights_mask); }
624
626 L4::Cap<T> cap() const noexcept
627 { return L4::Cap<T>(_cap_n_rights & Cap_mask); }
628
630 unsigned rights() const noexcept
631 { return _cap_n_rights & Rights_mask; }
632
634 L4::Ipc::Snd_fpage fpage() const noexcept
635 { return L4::Ipc::Snd_fpage(cap(), rights()); }
636
638 bool is_valid() const noexcept
639 { return !(_cap_n_rights & L4_INVALID_CAP_BIT); }
640};
641
648template<typename T>
649Cap<T> make_cap(L4::Cap<T> cap, unsigned rights) noexcept
650{ return Cap<T>(cap, rights); }
651
658template<typename T>
660{ return Cap<T>(cap, L4_CAP_FPAGE_RW); }
661
668template<typename T>
670{ return Cap<T>(cap, L4_CAP_FPAGE_RWS); }
671
686template<typename T>
689
690// caps are special the have an invalid representation
691template<typename T> struct L4_EXPORT Opt< Cap<T> >
692{
693 Cap<T> _value;
694 Opt() noexcept {}
695 Opt(Cap<T> value) noexcept : _value(value) {}
696 Opt(L4::Cap<T> value) noexcept : _value(value) {}
697 Opt &operator = (Cap<T> value) noexcept
698 { this->_value = value; }
699 Opt &operator = (L4::Cap<T> value) noexcept
700 { this->_value = value; }
701
702 Cap<T> value() const noexcept { return this->_value; }
703 bool is_valid() const noexcept { return this->_value.is_valid(); }
704};
705
706
707namespace Msg {
708// prohibit L4::Cap as argument
709template<typename A>
710struct Is_valid_rpc_type< L4::Cap<A> > : L4::Types::False {};
711
712template<typename A> struct Class< Cap<A> > : Cls_item {};
713template<typename A> struct Elem< Cap<A> >
714{
715 enum { Is_optional = false };
716 typedef Cap<A> arg_type;
717 typedef L4::Ipc::Snd_fpage svr_type;
718 typedef L4::Ipc::Snd_fpage svr_arg_type;
719};
720
721
722template<typename A, typename CLASS>
723struct Svr_val_ops<Cap<A>, Dir_in, CLASS> :
724 Svr_val_ops<L4::Ipc::Snd_fpage, Dir_in, CLASS>
725{};
726
727template<typename A, typename CLASS>
728struct Clnt_val_ops<Cap<A>, Dir_in, CLASS> :
729 Clnt_noops< Cap<A> >
730{
731 using Clnt_noops< Cap<A> >::to_msg;
732
733 static int to_msg(char *msg, unsigned offset, unsigned limit,
734 Cap<A> arg, Dir_in, Cls_item) noexcept
735 {
736 // passing an invalid cap as mandatory argument is an error
737 // XXX: This checks for a client calling error, we could
738 // also just ignore this for performance reasons and
739 // let the client fail badly (Alex: I'd prefer this)
740 if (L4_UNLIKELY(!arg.is_valid()))
741 return -L4_EMSGMISSARG;
742
743 return msg_add(msg, offset, limit, arg.fpage());
744 }
745};
746
747template<typename A>
748struct Elem<Out<L4::Cap<A> > >
749{
750 enum { Is_optional = false };
751 typedef L4::Cap<A> arg_type;
752 typedef Ipc::Cap<A> svr_type;
753 typedef svr_type &svr_arg_type;
754};
755
756template<typename A> struct Direction< Out< L4::Cap<A> > > : Dir_out {};
757template<typename A> struct Class< Out< L4::Cap<A> > > : Cls_item {};
758
759template<typename A>
760struct Clnt_val_ops< L4::Cap<A>, Dir_out, Cls_item > :
761 Clnt_noops< L4::Cap<A> >
762{
763 using Clnt_noops< L4::Cap<A> >::to_msg;
764 static int to_msg(char *msg, unsigned offset, unsigned limit,
765 L4::Cap<A> arg, Dir_in, Cls_buffer) noexcept
766 {
767 if (L4_UNLIKELY(!arg.is_valid()))
768 return -L4_EMSGMISSARG; // no buffer inserted
769 return msg_add(msg, offset, limit, Small_buf(arg));
770 }
771};
772
773template<typename A>
774struct Svr_val_ops< L4::Ipc::Cap<A>, Dir_out, Cls_item > :
775 Svr_noops<Cap<A> &>
776{
777 using Svr_noops<Cap<A> &>::from_svr;
778 static int from_svr(char *msg, unsigned offset, unsigned limit, long,
779 Cap<A> arg, Dir_out, Cls_item) noexcept
780 {
781 if (L4_UNLIKELY(!arg.is_valid()))
782 // do not map anything
783 return msg_add(msg, offset, limit, L4::Ipc::Snd_fpage(arg.cap(), 0));
784
785 return msg_add(msg, offset, limit, arg.fpage());
786 }
787};
788
789// prohibit a UTCB pointer as normal RPC argument
790template<> struct Is_valid_rpc_type<l4_utcb_t *> : L4::Types::False {};
791
792} // namespace Msg
793} // namespace Ipc
794} // namespace L4
l4_fpage_t fpage(unsigned rights=L4_CAP_FPAGE_RWS) const noexcept
Return flex-page for the capability.
Definition capability.h:69
bool is_valid() const noexcept
Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
Definition capability.h:57
C++ interface for capabilities.
Definition capability.h:219
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:563
@ Rights_mask
Mask for rights bits stored internally.
Definition ipc_types:575
@ Cap_mask
Mask for significant capability bits.
Definition ipc_types:581
Cap(L4::Cap< T > cap) noexcept
Make a Cap from L4::Cap<T>, with minimal rights.
Definition ipc_types:592
Cap(L4::Cap< T > cap, unsigned char rights) noexcept
Make a Cap from L4::Cap<T> with the given rights.
Definition ipc_types:614
static Cap from_ci(l4_cap_idx_t c) noexcept
Create an IPC capability from a C capability index plus rights.
Definition ipc_types:622
L4::Ipc::Snd_fpage fpage() const noexcept
Return the send flexpage for this Cap (see l4_fpage_t)
Definition ipc_types:634
Cap(L4::Cap< O > cap) noexcept
Make IPC Cap from L4::Cap with conversion (and minimal rights).
Definition ipc_types:598
Cap() noexcept
Make an invalid cap.
Definition ipc_types:605
L4::Cap< T > cap() const noexcept
Return the L4::Cap<T> of this Cap.
Definition ipc_types:626
unsigned rights() const noexcept
Return the rights bits stored in this IPC cap.
Definition ipc_types:630
bool is_valid() const noexcept
Return true if this Cap is valid.
Definition ipc_types:638
Cap(Cap< O > const &o) noexcept
Make copy with conversion.
Definition ipc_types:586
Generic RPC base for L4 flex-pages.
Definition ipc_types:297
bool is_valid() const noexcept
Check if the capability is valid.
Definition ipc_types:354
bool id_received() const noexcept
Check if a label was received instead of a mapping.
Definition ipc_types:377
l4_umword_t base_x() const noexcept
Return the raw base descriptor.
Definition ipc_types:399
Cacheopt
Caching options, see l4_fpage_cacheability_opt_t.
Definition ipc_types:317
bool is_compound() const noexcept
Check if the received item has the compound bit set.
Definition ipc_types:395
Type
Type of mapping object, see L4_fpage_type.
Definition ipc_types:301
Map_type
Kind of mapping.
Definition ipc_types:310
bool cap_received() const noexcept
Check if at least one capability has been mapped.
Definition ipc_types:365
bool local_id_received() const noexcept
Check if a local capability id has been received.
Definition ipc_types:387
l4_umword_t data() const noexcept
Return the raw flex page descriptor.
Definition ipc_types:397
Rcv flex-page.
Definition ipc_types:460
A receive item for receiving a single object capability.
Definition ipc_types:269
Small_buf(l4_cap_idx_t cap, unsigned long flags=0) noexcept
Create a receive item from a C cap.
Definition ipc_types:285
Small_buf(L4::Cap< void > cap, unsigned long flags=0) noexcept
Create a receive item from a C++ cap.
Definition ipc_types:278
Send flex-page.
Definition ipc_types:408
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned long l4_addr_t
Address type.
Definition l4int.h:45
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:359
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
Definition types.h:416
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:166
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:168
@ L4_EMSGMISSARG
Message has invalid capability.
Definition err.h:69
@ L4_EMSGTOOLONG
Message too long.
Definition err.h:68
l4_fpage_t l4_obj_fpage(l4_cap_idx_t obj, unsigned int order, unsigned char rights) L4_NOTHROW
Create a kernel-object flex page.
Definition __l4_fpage.h:680
l4_fpage_t l4_fpage(l4_addr_t address, unsigned int size, unsigned char rights) L4_NOTHROW
Create a memory flex page.
Definition __l4_fpage.h:668
l4_fpage_t l4_fpage_set_rights(l4_fpage_t src, unsigned char new_rights) L4_NOTHROW
Set new right in a flex page.
Definition __l4_fpage.h:659
l4_fpage_t l4_iofpage(unsigned long port, unsigned int size) L4_NOTHROW
Create an IO-port flex page.
Definition __l4_fpage.h:674
@ L4_FPAGE_CACHEABLE
Cacheability option to enable caches for the mapping.
Definition __l4_fpage.h:291
@ L4_FPAGE_UNCACHEABLE
Cacheability option to disable caching for the mapping.
Definition __l4_fpage.h:297
@ L4_FPAGE_BUFFERABLE
Cacheability option to enable buffered writes for the mapping.
Definition __l4_fpage.h:294
@ L4_FPAGE_MEMORY
Memory flex page.
Definition __l4_fpage.h:236
@ L4_FPAGE_IO
IO-port flex page.
Definition __l4_fpage.h:237
@ L4_FPAGE_OBJ
Object flex page (capabilities).
Definition __l4_fpage.h:238
@ L4_FPAGE_SPECIAL
Special flex page, either invalid or all spaces.
Definition __l4_fpage.h:235
@ L4_FPAGE_C_OBJ_RIGHTS
All Object-type specific right bits.
Definition __l4_fpage.h:271
@ L4_CAP_FPAGE_R
Read right for capability flex-pages.
Definition __l4_fpage.h:178
@ L4_CAP_FPAGE_RW
Read and interface specific 'W' right for capability flex-pages.
Definition __l4_fpage.h:195
@ L4_CAP_FPAGE_RWSD
Full rights for capability flex-pages.
Definition __l4_fpage.h:215
@ L4_CAP_FPAGE_RWS
Read, interface specific 'W', and 'S' rights for capability flex-pages.
Definition __l4_fpage.h:209
@ L4_MAP_ITEM_GRANT
Flag as grant instead of map operation.
Definition consts.h:257
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:226
@ L4_ITEM_CONT
Denote that the following item shall be put into the same receive item as this one.
Definition consts.h:232
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition consts.h:259
@ L4_RCV_ITEM_SINGLE_CAP
Mark the receive buffer to be a small receive item that describes a buffer for a single object capabi...
Definition consts.h:266
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:67
#define L4_UNLIKELY(x)
Expression is unlikely to execute.
Definition compiler.h:296
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:231
int msg_add(char *msg, unsigned offs, unsigned limit, T v) noexcept
Add some data to a message at offs.
Definition ipc_basics:125
Cap< T > make_cap(L4::Cap< T > cap, unsigned rights) noexcept
Make an L4::Ipc::Cap<T> for the given capability and rights.
Definition ipc_types:649
Cap< T > make_cap_full(L4::Cap< T > cap) noexcept
Make an L4::IPC::Cap<T> for the given capability with full fpage and object-specific rights.
Definition ipc_types:687
Cap< T > make_cap_rw(L4::Cap< T > cap) noexcept
Make an L4::Ipc::Cap<T> for the given capability with L4_CAP_FPAGE_RW rights.
Definition ipc_types:659
Cap< T > make_cap_rws(L4::Cap< T > cap) noexcept
Make an L4::Ipc::Cap<T> for the given capability with L4_CAP_FPAGE_RWS rights.
Definition ipc_types:669
L4 low-level kernel interface.
Definition io_regblock.h:19
int Opcode
Data type for RPC opcodes.
Definition __typeinfo.h:47
Pass the argument as plain data value.
Definition ipc_types:128
Mark an argument as in-out argument.
Definition ipc_types:53
Attribute for defining an optional RPC argument.
Definition ipc_types:148
void set_valid(bool valid=true) noexcept
Set the argument to present or absent.
Definition ipc_types:167
Opt(T value) noexcept
Make a present optional argument with the given value.
Definition ipc_types:156
bool is_valid() const noexcept
Get true if present, false if not.
Definition ipc_types:178
T value() const noexcept
Get the value.
Definition ipc_types:174
T _value
The value.
Definition ipc_types:149
Opt() noexcept
Make an absent optional argument.
Definition ipc_types:153
T & value() noexcept
Get the value.
Definition ipc_types:176
bool _valid
True if the optional argument is present, false else.
Definition ipc_types:150
Mark an argument as a output value in an RPC signature.
Definition ipc_types:42
False meta value.
Definition types:307
L4 flexpage type.
Definition __l4_fpage.h:85
l4_umword_t raw
Raw value.
Definition __l4_fpage.h:87