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 * 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"
15
16namespace L4 {
17
19using Opcode = int;
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 using value_type = T;
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 using svr_arg_type = Opt<typename Elem<T &>::svr_type> &;
175 using svr_type = Opt<typename Elem<T &>::svr_type>;
176};
177
178template<typename T> struct Elem< Opt<T *> > : Elem<T *>
179{
180 enum { Is_optional = true };
181 using svr_arg_type = Opt<typename Elem<T *>::svr_type> &;
182 using svr_type = Opt<typename Elem<T *>::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 using svr_type = Opt<T>;
191 using Native = Svr_val_ops<T, Dir_out, CLASS>;
192
193 using Svr_noops< svr_type >::to_svr;
194 static int to_svr(char *msg, unsigned offset, unsigned limit,
195 svr_type &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< svr_type >::from_svr;
201 static int from_svr(char *msg, unsigned offset, unsigned limit, l4_ret_t ret,
202 svr_type const &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 using arg_type = Opt<T>;
215};
216
217template<typename T> struct Elem< Opt<T const *> > : Elem<T const *>
218{
219 enum { Is_optional = true };
220 using arg_type = Opt<T const *>;
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 using arg_type = Opt<T>;
230 using Native = Detail::_Clnt_val_ops<typename Elem<T>::arg_type, Dir_in, CLASS>;
231
232 using Clnt_noops< arg_type >::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:
297
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 using arg_type = L4::Ipc::Rcv_fpage;
668 using svr_type = void;
669 using svr_arg_type = void;
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 using arg_type = L4::Ipc::Small_buf;
680 using svr_type = void;
681 using svr_arg_type = void;
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
717
723 };
724
727 {
729 Map = 0,
731 Grant = 0x100,
732 };
733
735 template<typename O>
736 Cap(Cap<O> const &o) noexcept : _cap_n_rights(o._cap_n_rights)
737 {
738 L4::Cap<T>::template check_convertible_from<O>();
739 }
740
743 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
744 {}
745
747 template<typename O>
749 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
750 {
751 L4::Cap<T>::template check_convertible_from<O>();
752 }
753
755 Cap() noexcept : _cap_n_rights(L4_INVALID_CAP) {}
756
764 Cap(L4::Cap<T> cap, unsigned char rights) noexcept
765 : _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)) {}
766
775 Cap(L4::Cap<T> cap, unsigned char rights, Map_type map_type) noexcept
776 : _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)
777 | (static_cast<l4_umword_t>(map_type) & Map_type_mask))
778 {}
779
785 static Cap from_ci(l4_cap_idx_t c) noexcept
786 { return Cap(L4::Cap<T>(c & Cap_mask), c & Rights_mask); }
787
789 L4::Cap<T> cap() const noexcept
790 { return L4::Cap<T>(_cap_n_rights & Cap_mask); }
791
793 unsigned rights() const noexcept
794 { return _cap_n_rights & Rights_mask; }
795
796 Map_type map_type() const noexcept
797 { return static_cast<Map_type>(_cap_n_rights & Map_type_mask); }
798
800 L4::Ipc::Snd_fpage fpage() const noexcept
801 {
802 return L4::Ipc::Snd_fpage(cap(), rights(), map_type() == Map
805 }
806
808 bool is_valid() const noexcept
809 { return !(_cap_n_rights & L4_INVALID_CAP_BIT); }
810};
811
818template<typename T>
819Cap<T> make_cap(L4::Cap<T> cap, unsigned rights) noexcept
820{ return Cap<T>(cap, rights); }
821
828template<typename T>
830{ return Cap<T>(cap, L4_CAP_FPAGE_RW); }
831
838template<typename T>
840{ return Cap<T>(cap, L4_CAP_FPAGE_RWS); }
841
857template<typename T>
860
870template<typename T>
875
876// caps are special, they have an invalid representation
877template<typename T> struct L4_EXPORT Opt< Cap<T> >
878{
879 Cap<T> _value;
880 Opt() noexcept {}
881 Opt(Cap<T> value) noexcept : _value(value) {}
882 Opt(L4::Cap<T> value) noexcept : _value(value) {}
883 Opt &operator = (Cap<T> value) noexcept
884 { this->_value = value; return *this; }
885 Opt &operator = (L4::Cap<T> value) noexcept
886 { this->_value = value; return *this; }
887
888 Cap<T> value() const noexcept { return this->_value; }
889 bool is_valid() const noexcept { return this->_value.is_valid(); }
890};
891
892
893namespace Msg {
894// prohibit L4::Cap as argument
895template<typename A>
896struct Is_valid_rpc_type< L4::Cap<A> > : L4::Types::False {};
897
898template<typename A> struct Class< Cap<A> > : Cls_item {};
899template<typename A> struct Elem< Cap<A> >
900{
901 enum { Is_optional = false };
902 using arg_type = Cap<A>;
903 using svr_type = L4::Ipc::Snd_fpage;
904 using svr_arg_type = L4::Ipc::Snd_fpage;
905};
906
907
908template<typename A, typename CLASS>
909struct Svr_val_ops<Cap<A>, Dir_in, CLASS> :
910 // Uses default Svr_val_ops implementation with L4::Ipc::Snd_fpage.
911 Svr_val_ops<L4::Ipc::Snd_fpage, Dir_in, CLASS>
912{};
913
914template<typename A, typename CLASS>
915struct Clnt_val_ops<Cap<A>, Dir_in, CLASS> :
916 Clnt_noops< Cap<A> >
917{
918 using Clnt_noops< Cap<A> >::to_msg;
919
920 static int to_msg(char *msg, unsigned offset, unsigned limit,
921 Cap<A> arg, Dir_in, Cls_item) noexcept
922 {
923 // passing an invalid cap as mandatory argument is an error
924 // XXX: This checks for a client calling error, we could
925 // also just ignore this for performance reasons and
926 // let the client fail badly (Alex: I'd prefer this)
927 if (L4_UNLIKELY(!arg.is_valid()))
928 return -L4_EMSGMISSARG;
929
930 return msg_add(msg, offset, limit, arg.fpage());
931 }
932};
933
934template<typename A>
935struct Elem<Out<L4::Cap<A> > >
936{
937 enum { Is_optional = false };
938 using arg_type = L4::Cap<A>;
939 using svr_type = Ipc::Cap<A>;
940 using svr_arg_type = svr_type &;
941};
942
943template<typename A> struct Direction< Out< L4::Cap<A> > > : Dir_out {};
944template<typename A> struct Class< Out< L4::Cap<A> > > : Cls_item {};
945
946template<typename A>
947struct Clnt_val_ops< L4::Cap<A>, Dir_out, Cls_item > :
948 Clnt_noops< L4::Cap<A> >
949{
950 using Clnt_noops< L4::Cap<A> >::to_msg;
951 static int to_msg(char *msg, unsigned offset, unsigned limit,
952 L4::Cap<A> arg, Dir_in, Cls_buffer) noexcept
953 {
954 if (L4_UNLIKELY(!arg.is_valid()))
955 return -L4_EMSGMISSARG; // no buffer inserted
956 return msg_add(msg, offset, limit, Small_buf(arg));
957 }
958};
959
960template<typename A>
961struct Svr_val_ops< L4::Ipc::Cap<A>, Dir_out, Cls_item > :
962 Svr_noops<Cap<A>>
963{
964 using Svr_noops<Cap<A>>::from_svr;
965 static int from_svr(char *msg, unsigned offset, unsigned limit, long,
966 Cap<A> arg, Dir_out, Cls_item) noexcept
967 {
968 if (L4_UNLIKELY(!arg.is_valid()))
969 // do not map anything
970 return msg_add(msg, offset, limit, L4::Ipc::Snd_fpage(arg.cap(), 0));
971
972 return msg_add(msg, offset, limit, arg.fpage());
973 }
974};
975
976// prohibit a UTCB pointer as normal RPC argument
977template<> struct Is_valid_rpc_type<l4_utcb_t *> : L4::Types::False {};
978
979} // namespace Msg
980} // namespace Ipc
981} // 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
@ Invalid
Invalid capability selector.
Definition capability.h:42
C++ interface for capabilities.
Definition capability.h:224
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:742
Cap(L4::Cap< T > cap, unsigned char rights) noexcept
Make a Cap from L4::Cap<T> with the given rights.
Definition ipc_types:764
static Cap from_ci(l4_cap_idx_t c) noexcept
Create an IPC capability from a C capability index plus rights.
Definition ipc_types:785
L4::Ipc::Snd_fpage fpage() const noexcept
Return the send flexpage for this Cap (see l4_fpage_t).
Definition ipc_types:800
Cap(L4::Cap< O > cap) noexcept
Make IPC Cap from L4::Cap with conversion (and minimal rights).
Definition ipc_types:748
Cap() noexcept
Make an invalid cap.
Definition ipc_types:755
Map_type
Kind of mapping.
Definition ipc_types:727
L4::Cap< A > cap() const noexcept
Definition ipc_types:789
unsigned rights() const noexcept
Definition ipc_types:793
bool is_valid() const noexcept
Return true if this Cap is valid.
Definition ipc_types:808
Cap(L4::Cap< T > cap, unsigned char rights, Map_type map_type) noexcept
Make a Cap from L4::Cap<T> with the given rights and map type.
Definition ipc_types:775
Cap(Cap< O > const &o) noexcept
Make copy with conversion.
Definition ipc_types:736
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
@ Io
Flexpage for I/O port spaces.
Definition ipc_types:294
@ Special
Special flexpage, either l4_fpage_invalid() or l4_fpage_all(); only supported by selected interfaces.
Definition ipc_types:292
@ Memory
Flexpage for memory spaces.
Definition ipc_types:293
@ Obj
Flexpage for object spaces.
Definition ipc_types:295
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
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
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 mappin...
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 ite...
Definition ipc_types:496
#define L4_FPAGE_C_OBJ_RIGHTS
All Object-type specific right bits.
Definition __l4_fpage.h:281
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:357
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
Definition types.h:414
#define L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:150
@ L4_EMSGMISSARG
Message has invalid capability.
Definition err.h:59
@ L4_EMSGTOOLONG
Message too long.
Definition err.h:58
L4_CONSTEXPR l4_fpage_t l4_iofpage(unsigned long port, unsigned int order) L4_NOTHROW
Create an IO-port flexpage.
Definition __l4_fpage.h:725
L4_CONSTEXPR 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:719
L4_CONSTEXPR 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:731
L4_CONSTEXPR 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:708
@ 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:311
@ L4_FPAGE_UNCACHEABLE
Cacheability option to disable caching for the mapping.
Definition __l4_fpage.h:319
@ L4_FPAGE_BUFFERABLE
Cacheability option to enable buffered writes for the mapping.
Definition __l4_fpage.h:315
@ L4_MAP_ITEM_GRANT
Flag as grant instead of map operation.
Definition consts.h:264
@ 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:279
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:233
@ L4_ITEM_CONT
Denote that the following item shall be put into the same receive item as this one.
Definition consts.h:239
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition consts.h:266
@ 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:294
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:295
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:220
#define L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:152
l4_int16_t l4_ret_t
Return value of an IPC call as well as an RPC call.
Definition types.h:28
IPC Message related functionality.
Definition ipc_array:154
constexpr bool check_size(unsigned offset, unsigned limit) noexcept
Check if there is enough space for T from offset to limit.
Definition ipc_basics:53
constexpr unsigned long align_to(unsigned long bytes, unsigned long align) noexcept
Pad bytes to the given alignment align (in bytes).
Definition ipc_basics:30
int msg_add(char *msg, unsigned offs, unsigned limit, T v) noexcept
Add some data to a message at offs.
Definition ipc_basics:114
IPC related functionality.
Definition ipc_array:13
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:819
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:858
Cap< T > make_cap_grant(L4::Cap< T > cap) noexcept
Make an L4::IPC::Cap<T> for the given capability that shall be granted with full rights.
Definition ipc_types:871
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:829
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:839
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
Defines client-side handling of 'MTYPE' as RPC argument.
Definition ipc_basics:210
Marker type for receive buffer values.
Definition ipc_basics:154
Marker type for item values.
Definition ipc_basics:152
Marker type for input values.
Definition ipc_basics:145
Marker type for output values.
Definition ipc_basics:147
Type trait defining a valid RPC parameter type.
Definition ipc_basics:361
Defines server-side handling for MTYPE server arguments.
Definition ipc_basics:281
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
Opt() noexcept
Make an absent optional argument.
Definition ipc_types:142
T & value() noexcept
Get the value.
Definition ipc_types:165
Mark an argument as a output value in an RPC signature.
Definition ipc_types:31
L4 flexpage type.
Definition __l4_fpage.h:76