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 {
51
52template<typename A> struct Elem< In_out<A *> > : Elem<A *>
53{
54 static constexpr bool Is_input = true;
55 static constexpr bool Is_output = true;
56};
57
58template<typename A>
59struct Is_valid_rpc_type< In_out<A *> > : Is_valid_rpc_type<A *> {};
60template<typename A>
61struct Is_valid_rpc_type< In_out<A const *> > : L4::Types::False {};
62
63template<typename A>
64struct Is_valid_rpc_type< In_out<A &> > : L4::Types::False {};
65
66// Value types don't make sense for output.
67template<typename A>
68struct Is_valid_rpc_type< In_out<A> > : L4::Types::False {};
69
70}
71
72
80template<typename T> struct L4_EXPORT Opt
81{
82 T _value{};
83 bool _valid = false;
84
86 Opt() noexcept = default;
87
89 Opt(T value) noexcept : _value(value), _valid(true) {}
90
92 Opt &operator = (T value) noexcept
93 {
94 this->_value = value;
95 this->_valid = true;
96 return *this;
97 }
98
100 void set_valid(bool valid = true) noexcept { _valid = valid; }
101
103 T *operator -> () noexcept { return &this->_value; }
105 T const *operator -> () const noexcept { return &this->_value; }
107 T const &value() const noexcept { return this->_value; }
109 T &value() noexcept { return this->_value; }
111 bool is_valid() const noexcept { return this->_valid; }
112};
113
114namespace Msg {
115
116template<typename T> struct Elem< Opt<T &> > : Elem<T &>
117{
118 static constexpr bool Is_optional = true;
119 using svr_arg_type = Opt<typename Elem<T &>::svr_type> &;
120 using svr_type = Opt<typename Elem<T &>::svr_type>;
121};
122
123template<typename T> struct Elem< Opt<T *> > : Elem<T *>
124{
125 static constexpr bool Is_optional = true;
126 using svr_arg_type = Opt<typename Elem<T *>::svr_type> &;
127 using svr_type = Opt<typename Elem<T *>::svr_type>;
128};
129
130template<typename T> struct Elem< Opt<T> > : Elem<T>
131{
132 static constexpr bool Is_optional = true;
133 using arg_type = Opt<T>;
134};
135
136template<typename T> struct Elem< Opt<T const *> > : Elem<T const *>
137{
138 static constexpr bool Is_optional = true;
139 using arg_type = Opt<T const *>;
140};
141
142template<typename T>
143struct Is_valid_rpc_type< Opt<T const &> > : L4::Types::False {};
144
145// This specialization is only used for optional input arguments. Optional
146// output arguments use a plain `T &` or `T *` on the client side. If the
147// argument is not present, it stays default constructed.
148template<typename T>
149struct Clnt_val_ops<Opt<T>>
150{
151 using Native = Detail::_Clnt_val_ops<T>;
152 using Plain = Detail::_Plain<T>;
153
154 static int to_msg_data(char *msg, unsigned offset, unsigned limit,
155 Opt<T> const &arg) noexcept
156 {
157 if (arg.is_valid())
158 return Native::to_msg_data(msg, offset, limit, Plain::deref(arg.value()));
159 return offset;
160 }
161
162 static int to_msg_items(char *msg, unsigned offset, unsigned limit,
163 Opt<T> const &arg) noexcept
164 {
165 if (arg.is_valid())
166 return Native::to_msg_items(msg, offset, limit,
167 Plain::deref(arg.value()));
168 return offset;
169 }
170
171 // No to_msg_* methods. They are never called because optional output
172 // arguments don't use the Opt<> type on the client side (see Elem<Opt<...>>
173 // above). Likewise, intentionally left without to_msg_buffers(). Buffer
174 // items are not supported because they are client side output arguments.
175};
176
177// This specialization is only used for optional output arguments. Optional
178// input arguments use a plain `T` on the server side. If the argument is not
179// present, it stays default constructed.
180template<typename T>
181struct Svr_val_ops<Opt<T>>
182{
183 using Native = Svr_val_ops<T>;
184
185 // Intentinally without to_svr_data() and to_svr_items(). They are never
186 // called. Optional input arguments don't use the Opt<> type on the server
187 // side. See Elem<Opt<...>> above.
188
189 static int reserve_data(char *msg, unsigned offset, unsigned limit,
190 Opt<T> &arg) noexcept
191 {
192 return Native::reserve_data(msg, offset, limit, arg.value());
193 }
194
195 static int from_svr_data(char *msg, unsigned offset, unsigned limit,
196 Opt<T> const &arg) noexcept
197 {
198 if (arg.is_valid())
199 return Native::from_svr_data(msg, offset, limit, arg.value());
200 return offset;
201 }
202
203 static int from_svr_items(char *msg, unsigned offset, unsigned limit,
204 Opt<T> const &arg) noexcept
205 {
206 if (arg.is_valid())
207 return Native::from_svr_items(msg, offset, limit, arg.value());
208 return offset;
209 }
210};
211
212}
213
234{
235public:
243 explicit Small_buf(L4::Cap<void> cap, unsigned long flags = 0) noexcept
244 : _data(cap.cap() | L4_RCV_ITEM_SINGLE_CAP | flags) {}
245
250 explicit Small_buf(l4_cap_idx_t cap, unsigned long flags = 0) noexcept
251 : _data(cap | L4_RCV_ITEM_SINGLE_CAP | flags) {}
252
254 l4_umword_t raw() const noexcept { return _data; }
255private:
256 l4_umword_t _data;
257};
258
263{
264public:
273
276 : _base(base), _data(data)
277 {}
278
280 l4_umword_t data() const noexcept { return _data; }
282 l4_umword_t base_x() const noexcept { return _base; }
283
284protected:
285 l4_umword_t _base;
286 l4_umword_t _data;
287};
288
299class Snd_fpage : public Gen_fpage
300{
301public:
309
319
329
333 {}
334
347 Map_type map_type = Map,
348 Cacheopt cache = None, Continue cont = Last) noexcept
349 : Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12)) | l4_umword_t(map_type)
350 | l4_umword_t(cache) | l4_umword_t(cont),
351 fp.raw)
352 {}
353
362 Snd_fpage(L4::Cap<void> cap, unsigned rights, Map_type map_type = Map) noexcept
363 : Gen_fpage(L4_ITEM_MAP | l4_umword_t(map_type) | (rights & 0xf0),
364 cap.fpage(rights).raw)
365 {}
366
379 unsigned char rights,
381 Map_type map_type = Map,
382 Continue cont = Last) noexcept
383 {
384 return Snd_fpage(l4_obj_fpage(base, order, rights), snd_base,
385 map_type, None, cont);
386 }
387
401 unsigned char rights,
403 Map_type map_type = Map,
404 Cacheopt cache = None, Continue cont = Last) noexcept
405 {
406 return Snd_fpage(l4_fpage(base, order, rights), snd_base, map_type, cache,
407 cont);
408 }
409
421 static Snd_fpage io(unsigned long base, int order,
422 unsigned char rights,
424 Map_type map_type = Map,
425 Continue cont = Last) noexcept
426 {
428 snd_base, map_type, None, cont);
429 }
430
433 unsigned order() const noexcept { return (_data >> 6) & 0x3f; }
434
437 unsigned snd_order() const noexcept { return (_data >> 6) & 0x3f; }
438
441 unsigned rcv_order() const noexcept { return (_base >> 6) & 0x3f; }
442
445 l4_addr_t base() const noexcept { return _data & (~0UL << 12); }
446
449 l4_addr_t snd_base() const noexcept { return _base & (~0UL << 12); }
450
453 void snd_base(l4_addr_t b) noexcept { _base = (_base & ~(~0UL << 12)) | (b & (~0UL << 12)); }
454
456 bool is_valid() const noexcept { return _base & L4_ITEM_MAP; }
457
472 bool cap_received() const noexcept { return (_base & 0x3e) == 0x38; }
488 bool id_received() const noexcept { return (_base & 0x3e) == 0x3c; }
504 bool local_id_received() const noexcept { return (_base & 0x3e) == 0x3e; }
511 bool is_compound() const noexcept { return _base & 1; }
512};
513
531class Rcv_fpage : public Gen_fpage
532{
533public:
537 Rcv_fpage() noexcept : Gen_fpage(0, 0), _rcv_task(L4_INVALID_CAP) {}
538
548 Rcv_fpage(l4_fpage_t const &fp, l4_addr_t snd_base = 0,
550 : Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12))
552 fp.raw),
553 _rcv_task(rcv_task)
554 {}
555
565 static Rcv_fpage obj(l4_cap_idx_t base, int order, l4_addr_t snd_base = 0,
567 {
568 return Rcv_fpage(l4_obj_fpage(base, order, 0), snd_base,
569 rcv_task.cap());
570 }
571
581 static Rcv_fpage mem(l4_addr_t base, int order, l4_addr_t snd_base = 0,
583 {
584 return Rcv_fpage(l4_fpage(base, order, 0), snd_base, rcv_task.cap());
585 }
586
596 static Rcv_fpage io(unsigned long base, int order, l4_addr_t snd_base = 0,
598 {
599 return Rcv_fpage(l4_iofpage(base, order), snd_base, rcv_task.cap());
600 }
601
607 l4_cap_idx_t rcv_task() const { return _rcv_task; }
608
612 bool forward_mappings() const noexcept
613 { return _base & L4_RCV_ITEM_FORWARD_MAPPINGS; }
614
615protected:
616 l4_cap_idx_t _rcv_task;
617};
618
619
620namespace Msg {
621
622template<>
623struct Clnt_val_ops<L4::Ipc::Snd_fpage>
624 : Clnt_noops<L4::Ipc::Snd_fpage>
625{
626 static int to_msg_items(char *msg, unsigned offset, unsigned limit,
627 L4::Ipc::Snd_fpage const &arg) noexcept
628 { return msg_add<L4::Ipc::Snd_fpage>(msg, offset, limit, arg); }
629
630 static int from_msg_items(char *msg, unsigned offset, unsigned limit,
631 L4::Ipc::Snd_fpage &arg) noexcept
632 { return msg_get<L4::Ipc::Snd_fpage>(msg, offset, limit, arg); }
633};
634
635template<>
636struct Svr_val_ops<L4::Ipc::Snd_fpage>
637 : Svr_noops<L4::Ipc::Snd_fpage>
638{
639 static int to_svr_items(char *msg, unsigned offset, unsigned limit,
640 L4::Ipc::Snd_fpage &arg) noexcept
641 { return msg_get<L4::Ipc::Snd_fpage>(msg, offset, limit, arg); }
642
643 static int from_svr_items(char *msg, unsigned offset, unsigned limit,
644 L4::Ipc::Snd_fpage const &arg) noexcept
645 { return msg_add(msg, offset, limit, arg); }
646};
647
648// Rcv_fpage are special buffer items. They are invisible on the server side
649// and must be passed literally to setup the client receive buffers.
650template<> struct Is_valid_rpc_type<L4::Ipc::Rcv_fpage *> : L4::Types::False {};
651template<> struct Is_valid_rpc_type<L4::Ipc::Rcv_fpage &> : L4::Types::False {};
652
653template<>
654struct Clnt_val_ops<L4::Ipc::Rcv_fpage>
655 : Clnt_noops<L4::Ipc::Rcv_fpage>
656{
657 static int to_msg_buffers(char *brs, unsigned offs, unsigned limit,
658 L4::Ipc::Rcv_fpage const &arg) noexcept
659 {
660 offs = align_to<l4_umword_t>(offs);
661 unsigned words = arg.forward_mappings() ? 3 : 2;
662 if (L4_UNLIKELY(!check_size<l4_umword_t>(offs, limit, words)))
663 return -L4_EMSGTOOLONG;
664 auto *buf = reinterpret_cast<l4_umword_t*>(brs + offs);
665 *buf++ = arg.base_x();
666 *buf++ = arg.data();
667 if (arg.forward_mappings())
668 *buf++ = arg.rcv_task();
669 return offs + sizeof(l4_umword_t) * words;
670 }
671};
672
673
674// Remove receive buffers from server-side arguments
675template<> struct Elem<L4::Ipc::Rcv_fpage>
676{
677 using arg_type = L4::Ipc::Rcv_fpage;
678 using svr_type = void;
679 using svr_arg_type = void;
680 static constexpr bool Is_optional = false;
681 static constexpr bool Is_input = false;
682 static constexpr bool Is_output = true;
683};
684
685// Small_buf are special buffer items. They are invisible on the server side
686// and must be passed literally to setup the client receive buffers.
687template<> struct Is_valid_rpc_type<L4::Ipc::Small_buf *> : L4::Types::False {};
688template<> struct Is_valid_rpc_type<L4::Ipc::Small_buf &> : L4::Types::False {};
689
690template<>
691struct Clnt_val_ops<L4::Ipc::Small_buf>
692 : Clnt_noops<L4::Ipc::Small_buf>
693{
694 static int to_msg_buffers(char *brs, unsigned offs, unsigned limit,
695 L4::Ipc::Small_buf const &arg) noexcept
696 { return msg_add<L4::Ipc::Small_buf>(brs, offs, limit, arg); }
697};
698
699// Remove receive buffers from server-side arguments
700template<> struct Elem<L4::Ipc::Small_buf>
701{
702 using arg_type = L4::Ipc::Small_buf;
703 using svr_type = void;
704 using svr_arg_type = void;
705 static constexpr bool Is_optional = false;
706 static constexpr bool Is_input = false;
707 static constexpr bool Is_output = true;
708};
709
710} // namespace Msg
711
712// L4::Cap<> handling
713
724template<typename T> class Cap
725{
726 template<typename O> friend class Cap;
727 l4_umword_t _cap_n_rights;
728
729public:
730 enum
731 {
738
743
749 };
750
753 {
755 Map = 0,
757 Grant = 0x100,
758 };
759
761 template<typename O>
762 Cap(Cap<O> const &o) noexcept : _cap_n_rights(o._cap_n_rights)
763 {
764 L4::Cap<T>::template check_convertible_from<O>();
765 }
766
769 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
770 {}
771
773 template<typename O>
775 : _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
776 {
777 L4::Cap<T>::template check_convertible_from<O>();
778 }
779
781 Cap() noexcept : _cap_n_rights(L4_INVALID_CAP) {}
782
790 Cap(L4::Cap<T> cap, unsigned char rights) noexcept
791 : _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)) {}
792
801 Cap(L4::Cap<T> cap, unsigned char rights, Map_type map_type) noexcept
802 : _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)
803 | (static_cast<l4_umword_t>(map_type) & Map_type_mask))
804 {}
805
811 static Cap from_ci(l4_cap_idx_t c) noexcept
812 { return Cap(L4::Cap<T>(c & Cap_mask), c & Rights_mask); }
813
815 L4::Cap<T> cap() const noexcept
816 { return L4::Cap<T>(_cap_n_rights & Cap_mask); }
817
819 unsigned rights() const noexcept
820 { return _cap_n_rights & Rights_mask; }
821
822 Map_type map_type() const noexcept
823 { return static_cast<Map_type>(_cap_n_rights & Map_type_mask); }
824
826 L4::Ipc::Snd_fpage fpage() const noexcept
827 {
828 return L4::Ipc::Snd_fpage(cap(), rights(), map_type() == Map
831 }
832
834 bool is_valid() const noexcept
835 { return !(_cap_n_rights & L4_INVALID_CAP_BIT); }
836};
837
844template<typename T>
845Cap<T> make_cap(L4::Cap<T> cap, unsigned rights) noexcept
846{ return Cap<T>(cap, rights); }
847
854template<typename T>
856{ return Cap<T>(cap, L4_CAP_FPAGE_RW); }
857
864template<typename T>
866{ return Cap<T>(cap, L4_CAP_FPAGE_RWS); }
867
883template<typename T>
886
896template<typename T>
901
902// caps are special, they have an invalid representation
903template<typename T> struct L4_EXPORT Opt< Cap<T> >
904{
905 Cap<T> _value;
906 Opt() noexcept {}
907 Opt(Cap<T> value) noexcept : _value(value) {}
908 Opt(L4::Cap<T> value) noexcept : _value(value) {}
909 Opt &operator = (Cap<T> value) noexcept
910 { this->_value = value; return *this; }
911 Opt &operator = (L4::Cap<T> value) noexcept
912 { this->_value = value; return *this; }
913
914 Cap<T> value() const noexcept { return this->_value; }
915 bool is_valid() const noexcept { return this->_value.is_valid(); }
916};
917
918
919namespace Msg {
920// prohibit L4::Cap as argument
921template<typename A>
922struct Is_valid_rpc_type< L4::Cap<A> > : L4::Types::False {};
923
924template<typename A> struct Elem< Cap<A> >
925{
926 using arg_type = Cap<A>;
927 using svr_type = L4::Ipc::Snd_fpage;
928 using svr_arg_type = L4::Ipc::Snd_fpage;
929 static constexpr bool Is_optional = false;
930 static constexpr bool Is_input = true;
931 static constexpr bool Is_output = false;
932};
933
934
935template<typename A>
936struct Svr_val_ops<Cap<A>>
937 : Svr_noops<Cap<A>>
938{
939 static int from_svr_items(char *msg, unsigned offset, unsigned limit,
940 Cap<A> const &arg) noexcept
941 {
942 if (L4_UNLIKELY(!arg.is_valid()))
943 // do not map anything
944 return msg_add(msg, offset, limit, L4::Ipc::Snd_fpage(arg.cap(), 0));
945
946 return msg_add(msg, offset, limit, arg.fpage());
947 }
948};
949
950template<typename A>
951struct Clnt_val_ops<Cap<A>> :
952 Clnt_noops< Cap<A> >
953{
954 static int to_msg_items(char *msg, unsigned offset, unsigned limit,
955 Cap<A> const &arg) noexcept
956 {
957 // passing an invalid cap as mandatory argument is an error
958 if (L4_UNLIKELY(!arg.is_valid()))
959 return -L4_EMSGMISSARG;
960
961 return msg_add(msg, offset, limit, arg.fpage());
962 }
963};
964
965template<typename A>
966struct Elem<Out<L4::Cap<A> > >
967{
968 using arg_type = L4::Cap<A>;
969 using svr_type = Ipc::Cap<A>;
970 using svr_arg_type = svr_type &;
971 static constexpr bool Is_optional = false;
972 static constexpr bool Is_input = false;
973 static constexpr bool Is_output = true;
974};
975
976template<typename A>
977struct Clnt_val_ops< L4::Cap<A> > :
978 Clnt_noops< L4::Cap<A> >
979{
980 static int to_msg_buffers(char *brs, unsigned offset, unsigned limit,
981 L4::Cap<A> const &arg) noexcept
982 {
983 if (L4_UNLIKELY(!arg.is_valid()))
984 return -L4_EMSGMISSARG; // no buffer inserted
985 return msg_add(brs, offset, limit, Small_buf(arg));
986 }
987};
988
989// prohibit a UTCB pointer as normal RPC argument
990template<> struct Is_valid_rpc_type<l4_utcb_t *> : L4::Types::False {};
991
992} // namespace Msg
993} // namespace Ipc
994} // 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:249
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:725
Cap(L4::Cap< T > cap) noexcept
Make a Cap from L4::Cap<T>, with minimal rights.
Definition ipc_types:768
Cap(L4::Cap< T > cap, unsigned char rights) noexcept
Make a Cap from L4::Cap<T> with the given rights.
Definition ipc_types:790
static Cap from_ci(l4_cap_idx_t c) noexcept
Create an IPC capability from a C capability index plus rights.
Definition ipc_types:811
L4::Ipc::Snd_fpage fpage() const noexcept
Return the send flexpage for this Cap (see l4_fpage_t).
Definition ipc_types:826
Cap(L4::Cap< O > cap) noexcept
Make IPC Cap from L4::Cap with conversion (and minimal rights).
Definition ipc_types:774
Cap() noexcept
Make an invalid cap.
Definition ipc_types:781
Map_type
Kind of mapping.
Definition ipc_types:753
L4::Cap< A > cap() const noexcept
Definition ipc_types:815
unsigned rights() const noexcept
Definition ipc_types:819
bool is_valid() const noexcept
Return true if this Cap is valid.
Definition ipc_types:834
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:801
Cap(Cap< O > const &o) noexcept
Make copy with conversion.
Definition ipc_types:762
l4_umword_t base_x() const noexcept
Return the raw base descriptor.
Definition ipc_types:282
Type
Type of mapping object, see L4_fpage_type.
Definition ipc_types:267
@ Io
Flexpage for I/O port spaces.
Definition ipc_types:270
@ Special
Special flexpage, either l4_fpage_invalid() or l4_fpage_all(); only supported by selected interfaces.
Definition ipc_types:268
@ Memory
Flexpage for memory spaces.
Definition ipc_types:269
@ Obj
Flexpage for object spaces.
Definition ipc_types:271
Gen_fpage(l4_umword_t base, l4_umword_t data) noexcept
Construct from raw values.
Definition ipc_types:275
l4_umword_t data() const noexcept
Return the raw flexpage descriptor.
Definition ipc_types:280
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:565
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:581
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:596
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:548
bool forward_mappings() const noexcept
Check if rcv_task() shall be used as destination for received capabilities.
Definition ipc_types:612
l4_cap_idx_t rcv_task() const
Get the capability index of the destination task for received capabilities.
Definition ipc_types:607
Rcv_fpage() noexcept
Construct a void receive item.
Definition ipc_types:537
Small_buf(l4_cap_idx_t cap, unsigned long flags=0) noexcept
Create a receive item from a C cap.
Definition ipc_types:250
l4_umword_t raw() const noexcept
Return the raw data.
Definition ipc_types:254
Small_buf(L4::Cap< void > cap, unsigned long flags=0) noexcept
Create a receive item from a C++ cap.
Definition ipc_types:243
Send item or return item.
Definition ipc_types:300
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:488
unsigned snd_order() const noexcept
(Defined only if send item or if local_id_received() is true.) Get log₂ size.
Definition ipc_types:437
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:362
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:346
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:504
Map_type
(Defined for send items only.) Kind of mapping.
Definition ipc_types:305
@ Map
Flag as usual map operation.
Definition ipc_types:306
@ Grant
Flag as grant instead of map operation.
Definition ipc_types:307
bool is_compound() const noexcept
Check if the item has the compound bit set, see Continue.
Definition ipc_types:511
unsigned rcv_order() const noexcept
(Defined for return items only.) Get log₂ size.
Definition ipc_types:441
bool is_valid() const noexcept
Check if the capability is valid.
Definition ipc_types:456
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:445
Cacheopt
(Defined for memory send items only.) Caching options, see l4_fpage_cacheability_opt_t.
Definition ipc_types:313
@ Buffered
Cacheability option to enable buffered writes for the mapping.
Definition ipc_types:316
@ Cached
Cacheability option to enable caches for the mapping.
Definition ipc_types:315
@ None
Copy options from sender.
Definition ipc_types:314
@ Uncached
Cacheability option to disable caching for the mapping.
Definition ipc_types:317
Snd_fpage(l4_umword_t base=0, l4_umword_t data=0) noexcept
Construct from raw values.
Definition ipc_types:331
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:449
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:378
unsigned order() const noexcept
(Defined only if send item or if local_id_received() is true.) Get log₂ size.
Definition ipc_types:433
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:421
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:453
Continue
Specify if the following item is associated with the same receive item as this one,...
Definition ipc_types:323
@ More
Alias for Compound.
Definition ipc_types:326
@ Single
Inverse of Compound.
Definition ipc_types:324
@ Last
Inverse of More.
Definition ipc_types:325
@ Compound
Denote that the following item shall be put into the same receive item as this one.
Definition ipc_types:327
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:400
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:472
#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:372
#define L4_INVALID_CAP
Invalid capability selector; see l4_cap_idx_t.
Definition consts.h:165
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
Definition types.h:429
#define L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:160
@ L4_EMSGMISSARG
Message has invalid capability.
Definition err.h:60
@ L4_EMSGTOOLONG
Message too long.
Definition err.h:59
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:256
@ 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:271
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:225
@ L4_ITEM_CONT
Denote that the following item shall be put into the same receive item as this one.
Definition consts.h:231
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition consts.h:258
@ 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:286
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
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:50
constexpr unsigned long align_to(unsigned long bytes, unsigned long align) noexcept
Pad bytes to the given alignment align (in bytes).
Definition ipc_basics:27
int msg_add(char *msg, unsigned offs, unsigned limit, T v) noexcept
Add some data to a message at offs.
Definition ipc_basics:111
int msg_get(char *msg, unsigned offs, unsigned limit, T &v) noexcept
Get some data from a message at offs.
Definition ipc_basics:132
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:845
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:884
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:897
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:855
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:865
L4 low-level kernel interface.
int Opcode
Data type for RPC opcodes.
Definition __typeinfo.h:36
Mark an argument as in-out argument.
Definition ipc_types:42
Empty client side marshalling code.
Definition ipc_basics:194
static constexpr int from_msg_items(char *msg, unsigned offset, unsigned limit, MTYPE &arg) noexcept
Definition ipc_basics:282
static constexpr int to_msg_buffers(char *brs, unsigned offset, unsigned limit, MTYPE const &arg) noexcept
Definition ipc_basics:244
static constexpr int to_msg_items(char *msg, unsigned offset, unsigned limit, MTYPE const &arg) noexcept
Definition ipc_basics:226
Defines client-side handling of 'MTYPE' as RPC argument.
Definition ipc_basics:409
static int to_msg_data(char *msg, unsigned offset, unsigned limit, MTYPE const &arg) noexcept
Copy a T into the message (arg must be either MTYPE or MTYPE const &).
Definition ipc_basics:414
Helper struct to describe various aspects of an IPC argument.
Definition ipc_basics:472
T svr_type
The data type used to store the T on the server-side.
Definition ipc_basics:476
static constexpr bool Is_output
Is the argument transferred from server to client?
Definition ipc_basics:484
T arg_type
The type used in client argument list.
Definition ipc_basics:474
static constexpr bool Is_optional
Is it an optional argument?
Definition ipc_basics:480
static constexpr bool Is_input
Is the argument transferred from client to server?
Definition ipc_basics:482
T svr_arg_type
The argument type for the server-side function.
Definition ipc_basics:478
Type trait defining a valid RPC parameter type.
Definition ipc_basics:521
Empty server side marshalling code.
Definition ipc_basics:295
static constexpr int to_svr_items(char *msg, unsigned offset, unsigned limit, MTYPE &arg) noexcept
Definition ipc_basics:386
static constexpr int from_svr_items(char *msg, unsigned offset, unsigned limit, MTYPE const &arg) noexcept
Definition ipc_basics:328
Defines server-side handling of 'MTYPE' as RPC argument.
Definition ipc_basics:439
static int from_svr_data(char *msg, unsigned offset, unsigned limit, MTYPE const &arg) noexcept
Copy a T into the message (arg must be either MTYPE or MTYPE const &).
Definition ipc_basics:459
static int reserve_data(char *, unsigned offs, unsigned limit, MTYPE &) noexcept
Prepare a T output operand (arg must be MTYPE &).
Definition ipc_basics:449
void set_valid(bool valid=true) noexcept
Set the argument to present or absent.
Definition ipc_types:100
bool is_valid() const noexcept
Get true if present, false if not.
Definition ipc_types:111
Opt() noexcept=default
Make an absent optional argument.
T & value() noexcept
Get the value.
Definition ipc_types:109
Mark an argument as a output value in an RPC signature.
Definition ipc_types:31
False meta value.
Definition types:322
L4 flexpage type.
Definition __l4_fpage.h:76