L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 * License: see LICENSE.spdx (in this directory or the directories above)
6 */
7#pragma once
8
9#include "capability.h"
10#include "types"
11#include "ipc_basics"
16namespace L4 {
17
19typedef int Opcode;
20
21namespace Ipc {
22
31template<typename T> struct L4_EXPORT Out;
32
33
41template<typename T> struct L4_EXPORT In_out
42{
43 T v;
44 In_out() {}
45 In_out(T v) : v(v) {}
46 operator T () const { return v; }
47 operator T & () { return v; }
48};
49
50namespace Msg {
51template<typename A> struct Elem< In_out<A *> > : Elem<A *> {};
52
53template<typename A>
54struct Svr_xmit< In_out<A *> > : Svr_xmit<A *>, Svr_xmit<A const *>
55{
56 using Svr_xmit<A *>::from_svr;
57 using Svr_xmit<A const *>::to_svr;
58};
59
60template<typename A>
61struct Clnt_xmit< In_out<A *> > : Clnt_xmit<A *>, Clnt_xmit<A const *>
62{
63 using Clnt_xmit<A *>::from_msg;
64 using Clnt_xmit<A const *>::to_msg;
65};
66
67template<typename A>
68struct Is_valid_rpc_type< In_out<A *> > : Is_valid_rpc_type<A *> {};
69template<typename A>
70struct Is_valid_rpc_type< In_out<A const *> > : L4::Types::False {};
71
72#ifdef CONFIG_ALLOW_REFS
73template<typename A> struct Elem< In_out<A &> > : Elem<A &> {};
74
75template<typename A>
76struct Svr_xmit< In_out<A &> > : Svr_xmit<A &>, Svr_xmit<A const &>
77{
78 using Svr_xmit<A &>::from_svr;
79 using Svr_xmit<A const &>::to_svr;
80};
81
82template<typename A>
83struct Clnt_xmit< In_out<A &> > : Clnt_xmit<A &>, Clnt_xmit<A const &>
84{
85 using Clnt_xmit<A &>::from_msg;
86 using Clnt_xmit<A const &>::to_msg;
87};
88
89template<typename A>
90struct Is_valid_rpc_type< In_out<A &> > : Is_valid_rpc_type<A &> {};
91template<typename A>
92struct Is_valid_rpc_type< In_out<A const &> > : L4::Types::False {};
93
94#else
95
96template<typename A>
97struct Is_valid_rpc_type< In_out<A &> > : L4::Types::False {};
98
99#endif
100
101// Value types don't make sense for output.
102template<typename A>
103struct Is_valid_rpc_type< In_out<A> > : L4::Types::False {};
104
105}
106
107
116template<typename T> struct L4_EXPORT As_value
117{
118 typedef T value_type;
119 T v;
120 As_value() noexcept {}
121 As_value(T v) noexcept : v(v) {}
122 operator T () const noexcept { return v; }
123 operator T & () noexcept { return v; }
124};
125
126namespace Msg {
127template<typename T> struct Class< As_value<T> > : Cls_data {};
128template<typename T> struct Elem< As_value<T> > : Elem<T> {};
129template<typename T> struct Elem< As_value<T> *> : Elem<T *> {};
130}
131
132
136template<typename T> struct L4_EXPORT Opt
137{
139 bool _valid;
140
142 Opt() noexcept : _valid(false) {}
143
145 Opt(T value) noexcept : _value(value), _valid(true) {}
146
148 Opt &operator = (T value) noexcept
149 {
150 this->_value = value;
151 this->_valid = true;
152 return *this;
153 }
154
156 void set_valid(bool valid = true) noexcept { _valid = valid; }
157
159 T *operator -> () noexcept { return &this->_value; }
161 T const *operator -> () const noexcept { return &this->_value; }
163 T value() const noexcept { return this->_value; }
165 T &value() noexcept { return this->_value; }
167 bool is_valid() const noexcept { return this->_valid; }
168};
169
170namespace Msg {
171template<typename T> struct Elem< Opt<T &> > : Elem<T &>
172{
173 enum { Is_optional = true };
174 typedef Opt<typename Elem<T &>::svr_type> &svr_arg_type;
175 typedef Opt<typename Elem<T &>::svr_type> svr_type;
176};
177
178template<typename T> struct Elem< Opt<T *> > : Elem<T *>
179{
180 enum { Is_optional = true };
181 typedef Opt<typename Elem<T *>::svr_type> &svr_arg_type;
182 typedef Opt<typename Elem<T *>::svr_type> svr_type;
183};
184
185
186
187template<typename T, typename CLASS>
188struct Svr_val_ops<Opt<T>, Dir_out, CLASS> : Svr_noops< Opt<T> >
189{
190 typedef Opt<T> svr_type;
191 typedef Svr_val_ops<T, Dir_out, CLASS> Native;
192
193 using Svr_noops< Opt<T> >::to_svr;
194 static int to_svr(char *msg, unsigned offset, unsigned limit,
195 Opt<T> &arg, Dir_out, CLASS) noexcept
196 {
197 return Native::to_svr(msg, offset, limit, arg.value(), Dir_out(), CLASS());
198 }
199
200 using Svr_noops< Opt<T> >::from_svr;
201 static int from_svr(char *msg, unsigned offset, unsigned limit, long ret,
202 svr_type &arg, Dir_out, CLASS) noexcept
203 {
204 if (arg.is_valid())
205 return Native::from_svr(msg, offset, limit, ret, arg.value(),
206 Dir_out(), CLASS());
207 return offset;
208 }
209};
210
211template<typename T> struct Elem< Opt<T> > : Elem<T>
212{
213 enum { Is_optional = true };
214 typedef Opt<T> arg_type;
215};
216
217template<typename T> struct Elem< Opt<T const *> > : Elem<T const *>
218{
219 enum { Is_optional = true };
220 typedef Opt<T const *> arg_type;
221};
222
223template<typename T>
224struct Is_valid_rpc_type< Opt<T const &> > : L4::Types::False {};
225
226template<typename T, typename CLASS>
227struct Clnt_val_ops<Opt<T>, Dir_in, CLASS> : Clnt_noops< Opt<T> >
228{
229 typedef Opt<T> arg_type;
230 typedef Detail::_Clnt_val_ops<typename Elem<T>::arg_type, Dir_in, CLASS> Native;
231
232 using Clnt_noops< Opt<T> >::to_msg;
233 static int to_msg(char *msg, unsigned offset, unsigned limit,
234 arg_type arg, Dir_in, CLASS) noexcept
235 {
236 if (arg.is_valid())
237 return Native::to_msg(msg, offset, limit,
238 Detail::_Plain<T>::deref(arg.value()),
239 Dir_in(), CLASS());
240 return offset;
241 }
242};
243
244template<typename T> struct Class< Opt<T> > :
245 Class< typename Detail::_Plain<T>::type > {};
246template<typename T> struct Direction< Opt<T> > : Direction<T> {};
247}
248
258{
259public:
267 explicit Small_buf(L4::Cap<void> cap, unsigned long flags = 0) noexcept
268 : _data(cap.cap() | L4_RCV_ITEM_SINGLE_CAP | flags) {}
269
274 explicit Small_buf(l4_cap_idx_t cap, unsigned long flags = 0) noexcept
275 : _data(cap | L4_RCV_ITEM_SINGLE_CAP | flags) {}
276
278 l4_umword_t raw() const noexcept { return _data; }
279private:
280 l4_umword_t _data;
281};
282
287{
288public:
290 enum Type
291 {
292 Special = L4_FPAGE_SPECIAL << 4,
293 Memory = L4_FPAGE_MEMORY << 4,
294 Io = L4_FPAGE_IO << 4,
295 Obj = L4_FPAGE_OBJ << 4
296 };
297
299 Gen_fpage(l4_umword_t base, l4_umword_t data) noexcept
300 : _base(base), _data(data)
301 {}
302
304 l4_umword_t data() const noexcept { return _data; }
306 l4_umword_t base_x() const noexcept { return _base; }
307
308protected:
309 l4_umword_t _base;
310 l4_umword_t _data;
311};
312
323class Snd_fpage : public Gen_fpage
324{
325public:
333
343
353
357 {}
358
371 Map_type map_type = Map,
372 Cacheopt cache = None, Continue cont = Last) noexcept
373 : Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12)) | l4_umword_t(map_type)
374 | l4_umword_t(cache) | l4_umword_t(cont),
375 fp.raw)
376 {}
377
386 Snd_fpage(L4::Cap<void> cap, unsigned rights, Map_type map_type = Map) noexcept
387 : Gen_fpage(L4_ITEM_MAP | l4_umword_t(map_type) | (rights & 0xf0),
388 cap.fpage(rights).raw)
389 {}
390
403 unsigned char rights,
405 Map_type map_type = Map,
406 Continue cont = Last) noexcept
407 {
408 return Snd_fpage(l4_obj_fpage(base, order, rights), snd_base,
409 map_type, None, cont);
410 }
411
425 unsigned char rights,
427 Map_type map_type = Map,
428 Cacheopt cache = None, Continue cont = Last) noexcept
429 {
430 return Snd_fpage(l4_fpage(base, order, rights), snd_base, map_type, cache,
431 cont);
432 }
433
445 static Snd_fpage io(unsigned long base, int order,
446 unsigned char rights,
448 Map_type map_type = Map,
449 Continue cont = Last) noexcept
450 {
452 snd_base, map_type, None, cont);
453 }
454
457 unsigned order() const noexcept { return (_data >> 6) & 0x3f; }
458
461 unsigned snd_order() const noexcept { return (_data >> 6) & 0x3f; }
462
465 unsigned rcv_order() const noexcept { return (_base >> 6) & 0x3f; }
466
469 l4_addr_t base() const noexcept { return _data & (~0UL << 12); }
470
473 l4_addr_t snd_base() const noexcept { return _base & (~0UL << 12); }
474
477 void snd_base(l4_addr_t b) noexcept { _base = (_base & ~(~0UL << 12)) | (b & (~0UL << 12)); }
478
480 bool is_valid() const noexcept { return _base & L4_ITEM_MAP; }
481
496 bool cap_received() const noexcept { return (_base & 0x3e) == 0x38; }
512 bool id_received() const noexcept { return (_base & 0x3e) == 0x3c; }
528 bool local_id_received() const noexcept { return (_base & 0x3e) == 0x3e; }
535 bool is_compound() const noexcept { return _base & 1; }
536};
537
544class Rcv_fpage : public Gen_fpage
545{
546public:
550 Rcv_fpage() noexcept : Gen_fpage(0, 0), _rcv_task(L4_INVALID_CAP) {}
551
561 Rcv_fpage(l4_fpage_t const &fp, l4_addr_t snd_base = 0,
563 : Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12))
565 fp.raw),
566 _rcv_task(rcv_task)
567 {}
568
578 static Rcv_fpage obj(l4_cap_idx_t base, int order, l4_addr_t snd_base = 0,
580 {
581 return Rcv_fpage(l4_obj_fpage(base, order, 0), snd_base,
582 rcv_task.cap());
583 }
584
594 static Rcv_fpage mem(l4_addr_t base, int order, l4_addr_t snd_base = 0,
596 {
597 return Rcv_fpage(l4_fpage(base, order, 0), snd_base, rcv_task.cap());
598 }
599
609 static Rcv_fpage io(unsigned long base, int order, l4_addr_t snd_base = 0,
611 {
612 return Rcv_fpage(l4_iofpage(base, order), snd_base, rcv_task.cap());
613 }
614
620 l4_cap_idx_t rcv_task() const { return _rcv_task; }
621
625 bool forward_mappings() const noexcept
626 { return _base & L4_RCV_ITEM_FORWARD_MAPPINGS; }
627
628protected:
629 l4_cap_idx_t _rcv_task;
630};
631
632
633namespace Msg {
634
635// Snd_fpage are out items
636template<> struct Class<L4::Ipc::Snd_fpage> : Cls_item {};
637
638// Rcv_fpage are buffer items
639template<> struct Class<L4::Ipc::Rcv_fpage> : Cls_buffer {};
640
641template<>
642struct Clnt_val_ops<L4::Ipc::Rcv_fpage, Dir_in, Cls_buffer>
643 : Clnt_noops<L4::Ipc::Rcv_fpage>
644{
645 using Clnt_noops<L4::Ipc::Rcv_fpage>::to_msg;
646
647 static int to_msg(char *msg, unsigned offs, unsigned limit,
648 L4::Ipc::Rcv_fpage arg, Dir_in, Cls_buffer) noexcept
649 {
650 offs = align_to<l4_umword_t>(offs);
651 unsigned words = arg.forward_mappings() ? 3 : 2;
652 if (L4_UNLIKELY(!check_size<l4_umword_t>(offs, limit, words)))
653 return -L4_EMSGTOOLONG;
654 auto *buf = reinterpret_cast<l4_umword_t*>(msg + offs);
655 *buf++ = arg.base_x();
656 *buf++ = arg.data();
657 if (arg.forward_mappings())
658 *buf++ = arg.rcv_task();
659 return offs + sizeof(l4_umword_t) * words;
660 }
661};
662
663
664// Remove receive buffers from server-side arguments
665template<> struct Elem<L4::Ipc::Rcv_fpage>
666{
667 typedef L4::Ipc::Rcv_fpage arg_type;
668 typedef void svr_type;
669 typedef void svr_arg_type;
670 enum { Is_optional = false };
671};
672
673// Small_buf are buffer items
674template<> struct Class<L4::Ipc::Small_buf> : Cls_buffer {};
675
676// Remove receive buffers from server-side arguments
677template<> struct Elem<L4::Ipc::Small_buf>
678{
679 typedef L4::Ipc::Small_buf arg_type;
680 typedef void svr_type;
681 typedef void svr_arg_type;
682 enum { Is_optional = false };
683};
684} // namespace Msg
685
686// L4::Cap<> handling
687
698template<typename T> class Cap
699{
700 template<typename O> friend class Cap;
701 l4_umword_t _cap_n_rights;
702
703public:
704 enum
705 {
712
718 };
719
721 template<typename O>
722 Cap(Cap<O> const &o) noexcept : _cap_n_rights(o._cap_n_rights)
723 {
724 L4::Cap<T>::template check_convertible_from<O>();
725 }
726
729 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
730 {}
731
733 template<typename O>
735 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
736 {
737 L4::Cap<T>::template check_convertible_from<O>();
738 }
739
741 Cap() noexcept : _cap_n_rights(L4_INVALID_CAP) {}
742
750 Cap(L4::Cap<T> cap, unsigned char rights) noexcept
751 : _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)) {}
752
758 static Cap from_ci(l4_cap_idx_t c) noexcept
759 { return Cap(L4::Cap<T>(c & Cap_mask), c & Rights_mask); }
760
762 L4::Cap<T> cap() const noexcept
763 { return L4::Cap<T>(_cap_n_rights & Cap_mask); }
764
766 unsigned rights() const noexcept
767 { return _cap_n_rights & Rights_mask; }
768
770 L4::Ipc::Snd_fpage fpage() const noexcept
771 { return L4::Ipc::Snd_fpage(cap(), rights()); }
772
774 bool is_valid() const noexcept
775 { return !(_cap_n_rights & L4_INVALID_CAP_BIT); }
776};
777
784template<typename T>
785Cap<T> make_cap(L4::Cap<T> cap, unsigned rights) noexcept
786{ return Cap<T>(cap, rights); }
787
794template<typename T>
796{ return Cap<T>(cap, L4_CAP_FPAGE_RW); }
797
804template<typename T>
806{ return Cap<T>(cap, L4_CAP_FPAGE_RWS); }
807
822template<typename T>
825
826// caps are special the have an invalid representation
827template<typename T> struct L4_EXPORT Opt< Cap<T> >
828{
829 Cap<T> _value;
830 Opt() noexcept {}
831 Opt(Cap<T> value) noexcept : _value(value) {}
832 Opt(L4::Cap<T> value) noexcept : _value(value) {}
833 Opt &operator = (Cap<T> value) noexcept
834 { this->_value = value; return *this; }
835 Opt &operator = (L4::Cap<T> value) noexcept
836 { this->_value = value; return *this; }
837
838 Cap<T> value() const noexcept { return this->_value; }
839 bool is_valid() const noexcept { return this->_value.is_valid(); }
840};
841
842
843namespace Msg {
844// prohibit L4::Cap as argument
845template<typename A>
846struct Is_valid_rpc_type< L4::Cap<A> > : L4::Types::False {};
847
848template<typename A> struct Class< Cap<A> > : Cls_item {};
849template<typename A> struct Elem< Cap<A> >
850{
851 enum { Is_optional = false };
852 typedef Cap<A> arg_type;
853 typedef L4::Ipc::Snd_fpage svr_type;
854 typedef L4::Ipc::Snd_fpage svr_arg_type;
855};
856
857
858template<typename A, typename CLASS>
859struct Svr_val_ops<Cap<A>, Dir_in, CLASS> :
860 Svr_val_ops<L4::Ipc::Snd_fpage, Dir_in, CLASS>
861{};
862
863template<typename A, typename CLASS>
864struct Clnt_val_ops<Cap<A>, Dir_in, CLASS> :
865 Clnt_noops< Cap<A> >
866{
867 using Clnt_noops< Cap<A> >::to_msg;
868
869 static int to_msg(char *msg, unsigned offset, unsigned limit,
870 Cap<A> arg, Dir_in, Cls_item) noexcept
871 {
872 // passing an invalid cap as mandatory argument is an error
873 // XXX: This checks for a client calling error, we could
874 // also just ignore this for performance reasons and
875 // let the client fail badly (Alex: I'd prefer this)
876 if (L4_UNLIKELY(!arg.is_valid()))
877 return -L4_EMSGMISSARG;
878
879 return msg_add(msg, offset, limit, arg.fpage());
880 }
881};
882
883template<typename A>
884struct Elem<Out<L4::Cap<A> > >
885{
886 enum { Is_optional = false };
887 typedef L4::Cap<A> arg_type;
888 typedef Ipc::Cap<A> svr_type;
889 typedef svr_type &svr_arg_type;
890};
891
892template<typename A> struct Direction< Out< L4::Cap<A> > > : Dir_out {};
893template<typename A> struct Class< Out< L4::Cap<A> > > : Cls_item {};
894
895template<typename A>
896struct Clnt_val_ops< L4::Cap<A>, Dir_out, Cls_item > :
897 Clnt_noops< L4::Cap<A> >
898{
899 using Clnt_noops< L4::Cap<A> >::to_msg;
900 static int to_msg(char *msg, unsigned offset, unsigned limit,
901 L4::Cap<A> arg, Dir_in, Cls_buffer) noexcept
902 {
903 if (L4_UNLIKELY(!arg.is_valid()))
904 return -L4_EMSGMISSARG; // no buffer inserted
905 return msg_add(msg, offset, limit, Small_buf(arg));
906 }
907};
908
909template<typename A>
910struct Svr_val_ops< L4::Ipc::Cap<A>, Dir_out, Cls_item > :
911 Svr_noops<Cap<A> &>
912{
913 using Svr_noops<Cap<A> &>::from_svr;
914 static int from_svr(char *msg, unsigned offset, unsigned limit, long,
915 Cap<A> arg, Dir_out, Cls_item) noexcept
916 {
917 if (L4_UNLIKELY(!arg.is_valid()))
918 // do not map anything
919 return msg_add(msg, offset, limit, L4::Ipc::Snd_fpage(arg.cap(), 0));
920
921 return msg_add(msg, offset, limit, arg.fpage());
922 }
923};
924
925// prohibit a UTCB pointer as normal RPC argument
926template<> struct Is_valid_rpc_type<l4_utcb_t *> : L4::Types::False {};
927
928} // namespace Msg
929} // namespace Ipc
930} // namespace L4
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:699
Cap(L4::Cap< T > cap) noexcept
Make a Cap from L4::Cap<T>, with minimal rights.
Definition ipc_types:728
Cap(L4::Cap< T > cap, unsigned char rights) noexcept
Make a Cap from L4::Cap<T> with the given rights.
Definition ipc_types:750
static Cap from_ci(l4_cap_idx_t c) noexcept
Create an IPC capability from a C capability index plus rights.
Definition ipc_types:758
L4::Ipc::Snd_fpage fpage() const noexcept
Return the send flexpage for this Cap (see l4_fpage_t)
Definition ipc_types:770
@ Rights_mask
Mask for rights bits stored internally.
Definition ipc_types:711
@ Cap_mask
Mask for significant capability bits.
Definition ipc_types:717
Cap(L4::Cap< O > cap) noexcept
Make IPC Cap from L4::Cap with conversion (and minimal rights).
Definition ipc_types:734
Cap() noexcept
Make an invalid cap.
Definition ipc_types:741
L4::Cap< T > cap() const noexcept
Return the L4::Cap<T> of this Cap.
Definition ipc_types:762
unsigned rights() const noexcept
Return the rights bits stored in this IPC cap.
Definition ipc_types:766
bool is_valid() const noexcept
Return true if this Cap is valid.
Definition ipc_types:774
Cap(Cap< O > const &o) noexcept
Make copy with conversion.
Definition ipc_types:722
Generic RPC base for typed message items.
Definition ipc_types:287
l4_umword_t base_x() const noexcept
Return the raw base descriptor.
Definition ipc_types:306
Type
Type of mapping object, see L4_fpage_type.
Definition ipc_types:291
Gen_fpage(l4_umword_t base, l4_umword_t data) noexcept
Construct from raw values.
Definition ipc_types:299
l4_umword_t data() const noexcept
Return the raw flexpage descriptor.
Definition ipc_types:304
Non-small receive item.
Definition ipc_types:545
static Rcv_fpage obj(l4_cap_idx_t base, int order, l4_addr_t snd_base=0, L4::Cap< void > rcv_task=L4::Cap< void >::Invalid) noexcept
Construct a non-small receive item for the object space.
Definition ipc_types:578
static Rcv_fpage mem(l4_addr_t base, int order, l4_addr_t snd_base=0, L4::Cap< void > rcv_task=L4::Cap< void >::Invalid) noexcept
Construct a receive item for the memory space.
Definition ipc_types:594
static Rcv_fpage io(unsigned long base, int order, l4_addr_t snd_base=0, L4::Cap< void > rcv_task=L4::Cap< void >::Invalid) noexcept
Construct a receive item for the I/O port space.
Definition ipc_types:609
Rcv_fpage(l4_fpage_t const &fp, l4_addr_t snd_base=0, l4_cap_idx_t rcv_task=L4_INVALID_CAP) noexcept
Construct a non-small receive item.
Definition ipc_types:561
bool forward_mappings() const noexcept
Check if rcv_task() shall be used as destination for received capabilities.
Definition ipc_types:625
l4_cap_idx_t rcv_task() const
Get the capability index of the destination task for received capabilities.
Definition ipc_types:620
Rcv_fpage() noexcept
Construct a void receive item.
Definition ipc_types:550
A receive item for receiving a single object capability.
Definition ipc_types:258
Small_buf(l4_cap_idx_t cap, unsigned long flags=0) noexcept
Create a receive item from a C cap.
Definition ipc_types:274
l4_umword_t raw() const noexcept
Return the raw data.
Definition ipc_types:278
Small_buf(L4::Cap< void > cap, unsigned long flags=0) noexcept
Create a receive item from a C++ cap.
Definition ipc_types:267
Send item or return item.
Definition ipc_types:324
bool id_received() const noexcept
*(Defined for return items only.)* Check if an IPC gate label has been received instead of a mapping.
Definition ipc_types:512
unsigned snd_order() const noexcept
*(Defined only if send item or if local_id_received() is true.)* Get log₂ size.
Definition ipc_types:461
Snd_fpage(L4::Cap< void > cap, unsigned rights, Map_type map_type=Map) noexcept
Construct a send item for the object space.
Definition ipc_types:386
Snd_fpage(l4_fpage_t const &fp, l4_addr_t snd_base=0, Map_type map_type=Map, Cacheopt cache=None, Continue cont=Last) noexcept
Construct a send item for the memory space.
Definition ipc_types:370
bool local_id_received() const noexcept
*(Defined for return items only.)* Check if a raw object flexpage has been received instead of a mapp...
Definition ipc_types:528
Map_type
*(Defined for send items only.)* Kind of mapping.
Definition ipc_types:329
@ Map
Flag as usual map operation.
Definition ipc_types:330
@ Grant
Flag as grant instead of map operation.
Definition ipc_types:331
bool is_compound() const noexcept
Check if the item has the compound bit set, see Continue.
Definition ipc_types:535
unsigned rcv_order() const noexcept
*(Defined for return items only.)* Get log₂ size.
Definition ipc_types:465
bool is_valid() const noexcept
Check if the capability is valid.
Definition ipc_types:480
l4_addr_t base() const noexcept
*(Defined only if send item or if local_id_received() is true.)* Get the start of the item (i....
Definition ipc_types:469
Cacheopt
*(Defined for memory send items only.)* Caching options, see l4_fpage_cacheability_opt_t.
Definition ipc_types:337
@ Buffered
Cacheability option to enable buffered writes for the mapping.
Definition ipc_types:340
@ Cached
Cacheability option to enable caches for the mapping.
Definition ipc_types:339
@ None
Copy options from sender.
Definition ipc_types:338
@ Uncached
Cacheability option to disable caching for the mapping.
Definition ipc_types:341
Snd_fpage(l4_umword_t base=0, l4_umword_t data=0) noexcept
Construct from raw values.
Definition ipc_types:355
l4_addr_t snd_base() const noexcept
Get the position in receive window for the case that this item has a different size than the correspo...
Definition ipc_types:473
static Snd_fpage obj(l4_cap_idx_t base, int order, unsigned char rights, l4_addr_t snd_base=0, Map_type map_type=Map, Continue cont=Last) noexcept
Construct a send item for the object space.
Definition ipc_types:402
unsigned order() const noexcept
*(Defined only if send item or if local_id_received() is true.)* Get log₂ size.
Definition ipc_types:457
static Snd_fpage io(unsigned long base, int order, unsigned char rights, l4_addr_t snd_base=0, Map_type map_type=Map, Continue cont=Last) noexcept
Construct a send item for the I/O port space.
Definition ipc_types:445
void snd_base(l4_addr_t b) noexcept
Set the position in receive window for the case that this item has a different size than the correspo...
Definition ipc_types:477
Continue
Specify if the following item is associated with the same receive item as this one,...
Definition ipc_types:347
@ More
Alias for Compound.
Definition ipc_types:350
@ Single
Inverse of Compound.
Definition ipc_types:348
@ Last
Inverse of More.
Definition ipc_types:349
@ Compound
Denote that the following item shall be put into the same receive item as this one.
Definition ipc_types:351
static Snd_fpage mem(l4_addr_t base, int order, unsigned char rights, l4_addr_t snd_base=0, Map_type map_type=Map, Cacheopt cache=None, Continue cont=Last) noexcept
Construct a send item for the memory space.
Definition ipc_types:424
bool cap_received() const noexcept
*(Defined for return items only.)* Check if at least one object capability has been mapped for this i...
Definition ipc_types:496
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:335
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
Definition types.h:392
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:155
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:157
@ L4_EMSGMISSARG
Message has invalid capability.
Definition err.h:58
@ L4_EMSGTOOLONG
Message too long.
Definition err.h:57
l4_fpage_t l4_obj_fpage(l4_cap_idx_t obj, unsigned int order, unsigned char rights) L4_NOTHROW
Create a kernel-object flexpage.
Definition __l4_fpage.h:696
l4_fpage_t l4_fpage_set_rights(l4_fpage_t src, unsigned char new_rights) L4_NOTHROW
Set new right in a flexpage.
Definition __l4_fpage.h:675
l4_fpage_t l4_fpage(l4_addr_t address, unsigned int order, unsigned char rights) L4_NOTHROW
Create a memory flexpage.
Definition __l4_fpage.h:684
l4_fpage_t l4_iofpage(unsigned long port, unsigned int order) L4_NOTHROW
Create an IO-port flexpage.
Definition __l4_fpage.h:690
@ L4_FPAGE_MEMORY
Flexpage for memory spaces.
Definition __l4_fpage.h:235
@ L4_FPAGE_IO
Flexpage for I/O port spaces.
Definition __l4_fpage.h:236
@ L4_FPAGE_OBJ
Flexpage for object spaces.
Definition __l4_fpage.h:237
@ L4_FPAGE_SPECIAL
Special flexpage, either l4_fpage_invalid() or l4_fpage_all(); only supported by selected interfaces.
Definition __l4_fpage.h:232
@ L4_CAP_FPAGE_R
Read right for capability flexpages.
Definition __l4_fpage.h:175
@ L4_CAP_FPAGE_RW
Read and interface specific 'W' right for capability flexpages.
Definition __l4_fpage.h:192
@ L4_CAP_FPAGE_RWSD
Full rights for capability flexpages.
Definition __l4_fpage.h:212
@ L4_CAP_FPAGE_RWS
Read, interface specific 'W', and 'S' rights for capability flexpages.
Definition __l4_fpage.h:206
@ L4_FPAGE_CACHEABLE
Cacheability option to enable caches for the mapping.
Definition __l4_fpage.h:292
@ L4_FPAGE_UNCACHEABLE
Cacheability option to disable caching for the mapping.
Definition __l4_fpage.h:300
@ L4_FPAGE_BUFFERABLE
Cacheability option to enable buffered writes for the mapping.
Definition __l4_fpage.h:296
@ L4_MAP_ITEM_GRANT
Flag as grant instead of map operation.
Definition consts.h:249
@ L4_RCV_ITEM_FORWARD_MAPPINGS
This flag specifies if received capabilities shall be mapped to a particular task instead of the invo...
Definition consts.h:264
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:218
@ L4_ITEM_CONT
Denote that the following item shall be put into the same receive item as this one.
Definition consts.h:224
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition consts.h:251
@ 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:279
@ L4_FPAGE_C_OBJ_RIGHTS
All Object-type specific right bits.
Definition __l4_fpage.h:270
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
#define L4_UNLIKELY(x)
Expression is unlikely to execute.
Definition compiler.h:275
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:210
int msg_add(char *msg, unsigned offs, unsigned limit, T v) noexcept
Add some data to a message at offs.
Definition ipc_basics:114
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:785
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:823
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:795
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:805
L4 low-level kernel interface.
int Opcode
Data type for RPC opcodes.
Definition __typeinfo.h:36
Pass the argument as plain data value.
Definition ipc_types:117
Mark an argument as in-out argument.
Definition ipc_types:42
Attribute for defining an optional RPC argument.
Definition ipc_types:137
void set_valid(bool valid=true) noexcept
Set the argument to present or absent.
Definition ipc_types:156
Opt(T value) noexcept
Make a present optional argument with the given value.
Definition ipc_types:145
bool is_valid() const noexcept
Get true if present, false if not.
Definition ipc_types:167
T value() const noexcept
Get the value.
Definition ipc_types:163
T _value
The value.
Definition ipc_types:138
Opt() noexcept
Make an absent optional argument.
Definition ipc_types:142
T & value() noexcept
Get the value.
Definition ipc_types:165
bool _valid
True if the optional argument is present, false else.
Definition ipc_types:139
Mark an argument as a output value in an RPC signature.
Definition ipc_types:31
False meta value.
Definition types:296
L4 flexpage type.
Definition __l4_fpage.h:76