Loading...
Searching...
No Matches
ipc_types
Go to the documentation of this file.
// vi:set ft=cpp: -*- Mode: C++ -*-
/*
* (c) 2014 Alexander Warg <alexander.warg@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include "capability.h"
#include "types"
#include "ipc_basics"
namespace L4 {
typedef int Opcode;
namespace Ipc {
template<typename T> struct L4_EXPORT Out;
template<typename T> struct L4_EXPORT In_out
{
T v;
In_out() {}
In_out(T v) : v(v) {}
operator T () const { return v; }
operator T & () { return v; }
};
namespace Msg {
template<typename A> struct Elem< In_out<A *> > : Elem<A *> {};
template<typename A>
struct Svr_xmit< In_out<A *> > : Svr_xmit<A *>, Svr_xmit<A const *>
{
using Svr_xmit<A *>::from_svr;
using Svr_xmit<A const *>::to_svr;
};
template<typename A>
struct Clnt_xmit< In_out<A *> > : Clnt_xmit<A *>, Clnt_xmit<A const *>
{
using Clnt_xmit<A *>::from_msg;
using Clnt_xmit<A const *>::to_msg;
};
template<typename A>
struct Is_valid_rpc_type< In_out<A *> > : Is_valid_rpc_type<A *> {};
template<typename A>
struct Is_valid_rpc_type< In_out<A const *> > : L4::Types::False {};
#ifdef CONFIG_ALLOW_REFS
template<typename A> struct Elem< In_out<A &> > : Elem<A &> {};
template<typename A>
struct Svr_xmit< In_out<A &> > : Svr_xmit<A &>, Svr_xmit<A const &>
{
using Svr_xmit<A &>::from_svr;
using Svr_xmit<A const &>::to_svr;
};
template<typename A>
struct Clnt_xmit< In_out<A &> > : Clnt_xmit<A &>, Clnt_xmit<A const &>
{
using Clnt_xmit<A &>::from_msg;
using Clnt_xmit<A const &>::to_msg;
};
template<typename A>
struct Is_valid_rpc_type< In_out<A &> > : Is_valid_rpc_type<A &> {};
template<typename A>
struct Is_valid_rpc_type< In_out<A const &> > : L4::Types::False {};
#else
template<typename A>
struct Is_valid_rpc_type< In_out<A &> > : L4::Types::False {};
#endif
// Value types don't make sense for output.
template<typename A>
struct Is_valid_rpc_type< In_out<A> > : L4::Types::False {};
}
template<typename T> struct L4_EXPORT As_value
{
typedef T value_type;
T v;
As_value() noexcept {}
As_value(T v) noexcept : v(v) {}
operator T () const noexcept { return v; }
operator T & () noexcept { return v; }
};
namespace Msg {
template<typename T> struct Class< As_value<T> > : Cls_data {};
template<typename T> struct Elem< As_value<T> > : Elem<T> {};
template<typename T> struct Elem< As_value<T> *> : Elem<T *> {};
}
template<typename T> struct L4_EXPORT Opt
{
T _value;
bool _valid;
Opt() noexcept : _valid(false) {}
Opt(T value) noexcept : _value(value), _valid(true) {}
Opt &operator = (T value) noexcept
{
this->_value = value;
this->_valid = true;
return *this;
}
void set_valid(bool valid = true) noexcept { _valid = valid; }
T *operator -> () noexcept { return &this->_value; }
T const *operator -> () const noexcept { return &this->_value; }
T value() const noexcept { return this->_value; }
T &value() noexcept { return this->_value; }
bool is_valid() const noexcept { return this->_valid; }
};
namespace Msg {
template<typename T> struct Elem< Opt<T &> > : Elem<T &>
{
enum { Is_optional = true };
typedef Opt<typename Elem<T &>::svr_type> &svr_arg_type;
typedef Opt<typename Elem<T &>::svr_type> svr_type;
};
template<typename T> struct Elem< Opt<T *> > : Elem<T *>
{
enum { Is_optional = true };
typedef Opt<typename Elem<T *>::svr_type> &svr_arg_type;
typedef Opt<typename Elem<T *>::svr_type> svr_type;
};
template<typename T, typename CLASS>
struct Svr_val_ops<Opt<T>, Dir_out, CLASS> : Svr_noops< Opt<T> >
{
typedef Opt<T> svr_type;
typedef Svr_val_ops<T, Dir_out, CLASS> Native;
using Svr_noops< Opt<T> >::to_svr;
static int to_svr(char *msg, unsigned offset, unsigned limit,
Opt<T> &arg, Dir_out, CLASS) noexcept
{
return Native::to_svr(msg, offset, limit, arg.value(), Dir_out(), CLASS());
}
using Svr_noops< Opt<T> >::from_svr;
static int from_svr(char *msg, unsigned offset, unsigned limit, long ret,
svr_type &arg, Dir_out, CLASS) noexcept
{
if (arg.is_valid())
return Native::from_svr(msg, offset, limit, ret, arg.value(),
Dir_out(), CLASS());
return offset;
}
};
template<typename T> struct Elem< Opt<T> > : Elem<T>
{
enum { Is_optional = true };
typedef Opt<T> arg_type;
};
template<typename T> struct Elem< Opt<T const *> > : Elem<T const *>
{
enum { Is_optional = true };
typedef Opt<T const *> arg_type;
};
template<typename T>
struct Is_valid_rpc_type< Opt<T const &> > : L4::Types::False {};
template<typename T, typename CLASS>
struct Clnt_val_ops<Opt<T>, Dir_in, CLASS> : Clnt_noops< Opt<T> >
{
typedef Opt<T> arg_type;
typedef Detail::_Clnt_val_ops<typename Elem<T>::arg_type, Dir_in, CLASS> Native;
using Clnt_noops< Opt<T> >::to_msg;
static int to_msg(char *msg, unsigned offset, unsigned limit,
arg_type arg, Dir_in, CLASS) noexcept
{
if (arg.is_valid())
return Native::to_msg(msg, offset, limit,
Detail::_Plain<T>::deref(arg.value()),
Dir_in(), CLASS());
return offset;
}
};
template<typename T> struct Class< Opt<T> > :
Class< typename Detail::_Plain<T>::type > {};
template<typename T> struct Direction< Opt<T> > : Direction<T> {};
}
class L4_EXPORT Small_buf
{
public:
explicit Small_buf(L4::Cap<void> cap, unsigned long flags = 0) noexcept
: _data(cap.cap() | L4_RCV_ITEM_SINGLE_CAP | flags) {}
explicit Small_buf(l4_cap_idx_t cap, unsigned long flags = 0) noexcept
: _data(cap | L4_RCV_ITEM_SINGLE_CAP | flags) {}
l4_umword_t raw() const noexcept { return _data; }
private:
l4_umword_t _data;
};
class L4_EXPORT Gen_fpage
{
public:
enum Type
{
Special = L4_FPAGE_SPECIAL << 4,
Memory = L4_FPAGE_MEMORY << 4,
Io = L4_FPAGE_IO << 4,
Obj = L4_FPAGE_OBJ << 4
};
Gen_fpage(l4_umword_t base, l4_umword_t data) noexcept
: _base(base), _data(data)
{}
l4_umword_t data() const noexcept { return _data; }
l4_umword_t base_x() const noexcept { return _base; }
protected:
l4_umword_t _base;
l4_umword_t _data;
};
class Snd_fpage : public Gen_fpage
{
public:
enum Map_type
{
Map = L4_MAP_ITEM_MAP,
Grant = L4_MAP_ITEM_GRANT,
};
enum Cacheopt
{
None = 0,
Cached = L4_FPAGE_CACHEABLE << 4,
Buffered = L4_FPAGE_BUFFERABLE << 4,
Uncached = L4_FPAGE_UNCACHEABLE << 4
};
enum Continue
{
Single = 0,
Last = 0,
More = L4_ITEM_CONT,
Compound = L4_ITEM_CONT,
};
Snd_fpage(l4_umword_t base = 0, l4_umword_t data = 0) noexcept
: Gen_fpage(base, data)
{}
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
: Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12)) | l4_umword_t(map_type)
| l4_umword_t(cache) | l4_umword_t(cont),
fp.raw)
{}
Snd_fpage(L4::Cap<void> cap, unsigned rights, Map_type map_type = Map) noexcept
: Gen_fpage(L4_ITEM_MAP | l4_umword_t(map_type) | (rights & 0xf0),
cap.fpage(rights).raw)
{}
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
{
return Snd_fpage(l4_obj_fpage(base, order, rights), snd_base,
map_type, None, cont);
}
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
{
return Snd_fpage(l4_fpage(base, order, rights), snd_base, map_type, cache,
cont);
}
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
{
return Snd_fpage(l4_fpage_set_rights(l4_iofpage(base, order), rights),
snd_base, map_type, None, cont);
}
unsigned order() const noexcept { return (_data >> 6) & 0x3f; }
unsigned snd_order() const noexcept { return (_data >> 6) & 0x3f; }
unsigned rcv_order() const noexcept { return (_base >> 6) & 0x3f; }
l4_addr_t base() const noexcept { return _data & (~0UL << 12); }
l4_addr_t snd_base() const noexcept { return _base & (~0UL << 12); }
void snd_base(l4_addr_t b) noexcept { _base = (_base & ~(~0UL << 12)) | (b & (~0UL << 12)); }
bool is_valid() const noexcept { return _base & L4_ITEM_MAP; }
bool cap_received() const noexcept { return (_base & 0x3e) == 0x38; }
bool id_received() const noexcept { return (_base & 0x3e) == 0x3c; }
bool local_id_received() const noexcept { return (_base & 0x3e) == 0x3e; }
bool is_compound() const noexcept { return _base & 1; }
};
class Rcv_fpage : public Gen_fpage
{
public:
Rcv_fpage() noexcept : Gen_fpage(0, 0), _rcv_task(L4_INVALID_CAP) {}
Rcv_fpage(l4_fpage_t const &fp, l4_addr_t snd_base = 0,
l4_cap_idx_t rcv_task = L4_INVALID_CAP) noexcept
: Gen_fpage(L4_ITEM_MAP | (snd_base & (~0UL << 12))
| (l4_is_valid_cap(rcv_task) ? L4_RCV_ITEM_FORWARD_MAPPINGS : 0),
fp.raw),
_rcv_task(rcv_task)
{}
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
{
return Rcv_fpage(l4_obj_fpage(base, order, 0), snd_base,
rcv_task.cap());
}
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
{
return Rcv_fpage(l4_fpage(base, order, 0), snd_base, rcv_task.cap());
}
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
{
return Rcv_fpage(l4_iofpage(base, order), snd_base, rcv_task.cap());
}
l4_cap_idx_t rcv_task() const { return _rcv_task; }
bool forward_mappings() const noexcept
{ return _base & L4_RCV_ITEM_FORWARD_MAPPINGS; }
protected:
l4_cap_idx_t _rcv_task;
};
namespace Msg {
// Snd_fpage are out items
template<> struct Class<L4::Ipc::Snd_fpage> : Cls_item {};
// Rcv_fpage are buffer items
template<> struct Class<L4::Ipc::Rcv_fpage> : Cls_buffer {};
template<>
struct Clnt_val_ops<L4::Ipc::Rcv_fpage, Dir_in, Cls_buffer>
: Clnt_noops<L4::Ipc::Rcv_fpage>
{
using Clnt_noops<L4::Ipc::Rcv_fpage>::to_msg;
static int to_msg(char *msg, unsigned offs, unsigned limit,
L4::Ipc::Rcv_fpage arg, Dir_in, Cls_buffer) noexcept
{
offs = align_to<l4_umword_t>(offs);
unsigned words = arg.forward_mappings() ? 3 : 2;
if (L4_UNLIKELY(!check_size<l4_umword_t>(offs, limit, words)))
return -L4_EMSGTOOLONG;
auto *buf = reinterpret_cast< l4_umword_t*>(msg + offs);
*buf++ = arg.base_x();
*buf++ = arg.data();
if (arg.forward_mappings())
*buf++ = arg.rcv_task();
return offs + sizeof(l4_umword_t) * words;
}
};
// Remove receive buffers from server-side arguments
template<> struct Elem<L4::Ipc::Rcv_fpage>
{
typedef L4::Ipc::Rcv_fpage arg_type;
typedef void svr_type;
typedef void svr_arg_type;
enum { Is_optional = false };
};
// Small_buf are buffer items
template<> struct Class<L4::Ipc::Small_buf> : Cls_buffer {};
// Remove receive buffers from server-side arguments
template<> struct Elem<L4::Ipc::Small_buf>
{
typedef L4::Ipc::Small_buf arg_type;
typedef void svr_type;
typedef void svr_arg_type;
enum { Is_optional = false };
};
} // namespace Msg
// L4::Cap<> handling
template<typename T> class Cap
{
template<typename O> friend class Cap;
l4_umword_t _cap_n_rights;
public:
enum
{
Rights_mask = 0xff,
Cap_mask = L4_CAP_MASK
};
template<typename O>
Cap(Cap<O> const &o) noexcept : _cap_n_rights(o._cap_n_rights)
{
L4::Cap<T>::template check_convertible_from<O>();
}
Cap(L4::Cap<T> cap) noexcept
: _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
{}
template<typename O>
Cap(L4::Cap<O> cap) noexcept
: _cap_n_rights((cap.cap() & Cap_mask) | (cap ? L4_CAP_FPAGE_R : 0))
{
L4::Cap<T>::template check_convertible_from<O>();
}
Cap() noexcept : _cap_n_rights(L4_INVALID_CAP) {}
Cap(L4::Cap<T> cap, unsigned char rights) noexcept
: _cap_n_rights((cap.cap() & Cap_mask) | (rights & Rights_mask)) {}
static Cap from_ci(l4_cap_idx_t c) noexcept
{ return Cap(L4::Cap<T>(c & Cap_mask), c & Rights_mask); }
L4::Cap<T> cap() const noexcept
{ return L4::Cap<T>(_cap_n_rights & Cap_mask); }
unsigned rights() const noexcept
{ return _cap_n_rights & Rights_mask; }
L4::Ipc::Snd_fpage fpage() const noexcept
{ return L4::Ipc::Snd_fpage(cap(), rights()); }
bool is_valid() const noexcept
{ return !(_cap_n_rights & L4_INVALID_CAP_BIT); }
};
template<typename T>
Cap<T> make_cap(L4::Cap<T> cap, unsigned rights) noexcept
{ return Cap<T>(cap, rights); }
template<typename T>
Cap<T> make_cap_rw(L4::Cap<T> cap) noexcept
{ return Cap<T>(cap, L4_CAP_FPAGE_RW); }
template<typename T>
Cap<T> make_cap_rws(L4::Cap<T> cap) noexcept
{ return Cap<T>(cap, L4_CAP_FPAGE_RWS); }
template<typename T>
Cap<T> make_cap_full(L4::Cap<T> cap) noexcept
{ return Cap<T>(cap, L4_CAP_FPAGE_RWSD | L4_FPAGE_C_OBJ_RIGHTS); }
// caps are special the have an invalid representation
template<typename T> struct L4_EXPORT Opt< Cap<T> >
{
Cap<T> _value;
Opt() noexcept {}
Opt(Cap<T> value) noexcept : _value(value) {}
Opt(L4::Cap<T> value) noexcept : _value(value) {}
Opt &operator = (Cap<T> value) noexcept
{ this->_value = value; return *this; }
Opt &operator = (L4::Cap<T> value) noexcept
{ this->_value = value; return *this; }
Cap<T> value() const noexcept { return this->_value; }
bool is_valid() const noexcept { return this->_value.is_valid(); }
};
namespace Msg {
// prohibit L4::Cap as argument
template<typename A>
struct Is_valid_rpc_type< L4::Cap<A> > : L4::Types::False {};
template<typename A> struct Class< Cap<A> > : Cls_item {};
template<typename A> struct Elem< Cap<A> >
{
enum { Is_optional = false };
typedef Cap<A> arg_type;
typedef L4::Ipc::Snd_fpage svr_type;
typedef L4::Ipc::Snd_fpage svr_arg_type;
};
template<typename A, typename CLASS>
struct Svr_val_ops<Cap<A>, Dir_in, CLASS> :
Svr_val_ops<L4::Ipc::Snd_fpage, Dir_in, CLASS>
{};
template<typename A, typename CLASS>
struct Clnt_val_ops<Cap<A>, Dir_in, CLASS> :
Clnt_noops< Cap<A> >
{
using Clnt_noops< Cap<A> >::to_msg;
static int to_msg(char *msg, unsigned offset, unsigned limit,
Cap<A> arg, Dir_in, Cls_item) noexcept
{
// passing an invalid cap as mandatory argument is an error
// XXX: This checks for a client calling error, we could
// also just ignore this for performance reasons and
// let the client fail badly (Alex: I'd prefer this)
if (L4_UNLIKELY(!arg.is_valid()))
return -L4_EMSGMISSARG;
return msg_add(msg, offset, limit, arg.fpage());
}
};
template<typename A>
struct Elem<Out<L4::Cap<A> > >
{
enum { Is_optional = false };
typedef L4::Cap<A> arg_type;
typedef Ipc::Cap<A> svr_type;
typedef svr_type &svr_arg_type;
};
template<typename A> struct Direction< Out< L4::Cap<A> > > : Dir_out {};
template<typename A> struct Class< Out< L4::Cap<A> > > : Cls_item {};
template<typename A>
struct Clnt_val_ops< L4::Cap<A>, Dir_out, Cls_item > :
Clnt_noops< L4::Cap<A> >
{
using Clnt_noops< L4::Cap<A> >::to_msg;
static int to_msg(char *msg, unsigned offset, unsigned limit,
L4::Cap<A> arg, Dir_in, Cls_buffer) noexcept
{
if (L4_UNLIKELY(!arg.is_valid()))
return -L4_EMSGMISSARG; // no buffer inserted
return msg_add(msg, offset, limit, Small_buf(arg));
}
};
template<typename A>
struct Svr_val_ops< L4::Ipc::Cap<A>, Dir_out, Cls_item > :
Svr_noops<Cap<A> &>
{
using Svr_noops<Cap<A> &>::from_svr;
static int from_svr(char *msg, unsigned offset, unsigned limit, long,
Cap<A> arg, Dir_out, Cls_item) noexcept
{
if (L4_UNLIKELY(!arg.is_valid()))
// do not map anything
return msg_add(msg, offset, limit, L4::Ipc::Snd_fpage(arg.cap(), 0));
return msg_add(msg, offset, limit, arg.fpage());
}
};
// prohibit a UTCB pointer as normal RPC argument
template<> struct Is_valid_rpc_type<l4_utcb_t *> : L4::Types::False {};
} // namespace Msg
} // namespace Ipc
} // namespace L4
L4::Cap_base::is_valid
bool is_valid() const noexcept
Test whether the capability is a valid capability index (i.e., not L4_INVALID_CAP).
Definition capability.h:57
L4::Cap_base::Invalid
@ Invalid
Invalid capability selector.
Definition capability.h:42
L4::Cap
C++ interface for capabilities.
Definition capability.h:224
L4::Ipc::Cap
Capability type for RPC interfaces (see L4::Cap<T>).
Definition ipc_types:699
L4::Ipc::Cap::Cap
Cap(L4::Cap< T > cap) noexcept
Make a Cap from L4::Cap<T>, with minimal rights.
Definition ipc_types:728
L4::Ipc::Cap::Cap
Cap(L4::Cap< T > cap, unsigned char rights) noexcept
Make a Cap from L4::Cap<T> with the given rights.
Definition ipc_types:750
L4::Ipc::Cap::from_ci
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::Cap::fpage
L4::Ipc::Snd_fpage fpage() const noexcept
Return the send flexpage for this Cap (see l4_fpage_t).
Definition ipc_types:770
L4::Ipc::Cap::Cap
Cap(L4::Cap< O > cap) noexcept
Make IPC Cap from L4::Cap with conversion (and minimal rights).
Definition ipc_types:734
L4::Ipc::Cap::Cap
Cap() noexcept
Make an invalid cap.
Definition ipc_types:741
L4::Ipc::Cap< A >::cap
L4::Cap< A > cap() const noexcept
Definition ipc_types:762
L4::Ipc::Cap< A >::rights
unsigned rights() const noexcept
Definition ipc_types:766
L4::Ipc::Cap::is_valid
bool is_valid() const noexcept
Return true if this Cap is valid.
Definition ipc_types:774
L4::Ipc::Cap::Cap
Cap(Cap< O > const &o) noexcept
Make copy with conversion.
Definition ipc_types:722
L4::Ipc::Cap< A >::Rights_mask
@ Rights_mask
Definition ipc_types:711
L4::Ipc::Cap< A >::Cap_mask
@ Cap_mask
Definition ipc_types:717
L4::Ipc::Gen_fpage::base_x
l4_umword_t base_x() const noexcept
Return the raw base descriptor.
Definition ipc_types:306
L4::Ipc::Gen_fpage::Type
Type
Type of mapping object, see L4_fpage_type.
Definition ipc_types:291
L4::Ipc::Gen_fpage::Io
@ Io
Flexpage for I/O port spaces.
Definition ipc_types:294
L4::Ipc::Gen_fpage::Special
@ Special
Special flexpage, either l4_fpage_invalid() or l4_fpage_all(); only supported by selected interfaces.
Definition ipc_types:292
L4::Ipc::Gen_fpage::Memory
@ Memory
Flexpage for memory spaces.
Definition ipc_types:293
L4::Ipc::Gen_fpage::Obj
@ Obj
Flexpage for object spaces.
Definition ipc_types:295
L4::Ipc::Gen_fpage::Gen_fpage
Gen_fpage(l4_umword_t base, l4_umword_t data) noexcept
Construct from raw values.
Definition ipc_types:299
L4::Ipc::Gen_fpage::data
l4_umword_t data() const noexcept
Return the raw flexpage descriptor.
Definition ipc_types:304
L4::Ipc::Rcv_fpage::obj
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
L4::Ipc::Rcv_fpage::mem
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
L4::Ipc::Rcv_fpage::io
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
L4::Ipc::Rcv_fpage::Rcv_fpage
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
L4::Ipc::Rcv_fpage::forward_mappings
bool forward_mappings() const noexcept
Check if rcv_task() shall be used as destination for received capabilities.
Definition ipc_types:625
L4::Ipc::Rcv_fpage::rcv_task
l4_cap_idx_t rcv_task() const
Get the capability index of the destination task for received capabilities.
Definition ipc_types:620
L4::Ipc::Rcv_fpage::Rcv_fpage
Rcv_fpage() noexcept
Construct a void receive item.
Definition ipc_types:550
L4::Ipc::Small_buf::Small_buf
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::Ipc::Small_buf::raw
l4_umword_t raw() const noexcept
Return the raw data.
Definition ipc_types:278
L4::Ipc::Small_buf::Small_buf
Small_buf(L4::Cap< void > cap, unsigned long flags=0) noexcept
Create a receive item from a C++ cap.
Definition ipc_types:267
L4::Ipc::Snd_fpage
Send item or return item.
Definition ipc_types:324
L4::Ipc::Snd_fpage::id_received
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
L4::Ipc::Snd_fpage::snd_order
unsigned snd_order() const noexcept
(Defined only if send item or if local_id_received() is true.) Get log₂ size.
Definition ipc_types:461
L4::Ipc::Snd_fpage::Snd_fpage
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
L4::Ipc::Snd_fpage::Snd_fpage
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
L4::Ipc::Snd_fpage::local_id_received
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
L4::Ipc::Snd_fpage::Map_type
Map_type
(Defined for send items only.) Kind of mapping.
Definition ipc_types:329
L4::Ipc::Snd_fpage::Map
@ Map
Flag as usual map operation.
Definition ipc_types:330
L4::Ipc::Snd_fpage::Grant
@ Grant
Flag as grant instead of map operation.
Definition ipc_types:331
L4::Ipc::Snd_fpage::is_compound
bool is_compound() const noexcept
Check if the item has the compound bit set, see Continue.
Definition ipc_types:535
L4::Ipc::Snd_fpage::rcv_order
unsigned rcv_order() const noexcept
(Defined for return items only.) Get log₂ size.
Definition ipc_types:465
L4::Ipc::Snd_fpage::is_valid
bool is_valid() const noexcept
Check if the capability is valid.
Definition ipc_types:480
L4::Ipc::Snd_fpage::base
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
L4::Ipc::Snd_fpage::Cacheopt
Cacheopt
(Defined for memory send items only.) Caching options, see l4_fpage_cacheability_opt_t.
Definition ipc_types:337
L4::Ipc::Snd_fpage::Buffered
@ Buffered
Cacheability option to enable buffered writes for the mapping.
Definition ipc_types:340
L4::Ipc::Snd_fpage::Cached
@ Cached
Cacheability option to enable caches for the mapping.
Definition ipc_types:339
L4::Ipc::Snd_fpage::None
@ None
Copy options from sender.
Definition ipc_types:338
L4::Ipc::Snd_fpage::Uncached
@ Uncached
Cacheability option to disable caching for the mapping.
Definition ipc_types:341
L4::Ipc::Snd_fpage::Snd_fpage
Snd_fpage(l4_umword_t base=0, l4_umword_t data=0) noexcept
Construct from raw values.
Definition ipc_types:355
L4::Ipc::Snd_fpage::snd_base
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
L4::Ipc::Snd_fpage::obj
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
L4::Ipc::Snd_fpage::order
unsigned order() const noexcept
(Defined only if send item or if local_id_received() is true.) Get log₂ size.
Definition ipc_types:457
L4::Ipc::Snd_fpage::io
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
L4::Ipc::Snd_fpage::snd_base
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
L4::Ipc::Snd_fpage::Continue
Continue
Specify if the following item is associated with the same receive item as this one,...
Definition ipc_types:347
L4::Ipc::Snd_fpage::More
@ More
Alias for Compound.
Definition ipc_types:350
L4::Ipc::Snd_fpage::Single
@ Single
Inverse of Compound.
Definition ipc_types:348
L4::Ipc::Snd_fpage::Last
@ Last
Inverse of More.
Definition ipc_types:349
L4::Ipc::Snd_fpage::Compound
@ Compound
Denote that the following item shall be put into the same receive item as this one.
Definition ipc_types:351
L4::Ipc::Snd_fpage::mem
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
L4::Ipc::Snd_fpage::cap_received
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
l4_umword_t
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_cap_idx_t
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:336
l4_is_valid_cap
unsigned l4_is_valid_cap(l4_cap_idx_t c) L4_NOTHROW
Test if a capability selector is a valid selector.
Definition types.h:393
L4_CAP_MASK
@ L4_CAP_MASK
Mask to get only the relevant bits of an l4_cap_idx_t.
Definition consts.h:151
L4_INVALID_CAP
@ L4_INVALID_CAP
Invalid capability selector.
Definition consts.h:153
L4_EMSGMISSARG
@ L4_EMSGMISSARG
Message has invalid capability.
Definition err.h:58
L4_EMSGTOOLONG
@ L4_EMSGTOOLONG
Message too long.
Definition err.h:57
l4_obj_fpage
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:715
l4_fpage_set_rights
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:694
l4_fpage
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:703
l4_iofpage
l4_fpage_t l4_iofpage(unsigned long port, unsigned int order) L4_NOTHROW
Create an IO-port flexpage.
Definition __l4_fpage.h:709
L4_FPAGE_MEMORY
@ L4_FPAGE_MEMORY
Flexpage for memory spaces.
Definition __l4_fpage.h:235
L4_FPAGE_IO
@ L4_FPAGE_IO
Flexpage for I/O port spaces.
Definition __l4_fpage.h:236
L4_FPAGE_OBJ
@ L4_FPAGE_OBJ
Flexpage for object spaces.
Definition __l4_fpage.h:237
L4_FPAGE_SPECIAL
@ 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
@ L4_CAP_FPAGE_R
Read right for capability flexpages.
Definition __l4_fpage.h:175
L4_CAP_FPAGE_RW
@ L4_CAP_FPAGE_RW
Read and interface specific 'W' right for capability flexpages.
Definition __l4_fpage.h:192
L4_CAP_FPAGE_RWSD
@ L4_CAP_FPAGE_RWSD
Full rights for capability flexpages.
Definition __l4_fpage.h:212
L4_CAP_FPAGE_RWS
@ L4_CAP_FPAGE_RWS
Read, interface specific 'W', and 'S' rights for capability flexpages.
Definition __l4_fpage.h:206
L4_FPAGE_CACHEABLE
@ L4_FPAGE_CACHEABLE
Cacheability option to enable caches for the mapping.
Definition __l4_fpage.h:299
L4_FPAGE_UNCACHEABLE
@ L4_FPAGE_UNCACHEABLE
Cacheability option to disable caching for the mapping.
Definition __l4_fpage.h:307
L4_FPAGE_BUFFERABLE
@ L4_FPAGE_BUFFERABLE
Cacheability option to enable buffered writes for the mapping.
Definition __l4_fpage.h:303
L4_MAP_ITEM_GRANT
@ L4_MAP_ITEM_GRANT
Flag as grant instead of map operation.
Definition consts.h:245
L4_RCV_ITEM_FORWARD_MAPPINGS
@ 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:260
L4_ITEM_MAP
@ L4_ITEM_MAP
Identify a message item as map item.
Definition consts.h:214
L4_ITEM_CONT
@ L4_ITEM_CONT
Denote that the following item shall be put into the same receive item as this one.
Definition consts.h:220
L4_MAP_ITEM_MAP
@ L4_MAP_ITEM_MAP
Flag as usual map operation.
Definition consts.h:247
L4_RCV_ITEM_SINGLE_CAP
@ 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:275
L4_FPAGE_C_OBJ_RIGHTS
@ L4_FPAGE_C_OBJ_RIGHTS
All Object-type specific right bits.
Definition __l4_fpage.h:270
l4_utcb_t
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
L4_UNLIKELY
#define L4_UNLIKELY(x)
Expression is unlikely to execute.
Definition compiler.h:284
L4_EXPORT
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:214
L4::Ipc::Msg
IPC Message related functionality.
Definition ipc_array:154
L4::Ipc::Msg::msg_add
int msg_add(char *msg, unsigned offs, unsigned limit, T v) noexcept
Add some data to a message at offs.
Definition ipc_basics:114
L4::Ipc
IPC related functionality.
Definition ipc_array:13
L4::Ipc::make_cap
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
L4::Ipc::make_cap_full
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:824
L4::Ipc::make_cap_rw
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
L4::Ipc::make_cap_rws
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
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50
L4::Opcode
int Opcode
Data type for RPC opcodes.
Definition __typeinfo.h:36
L4::Ipc::As_value
Pass the argument as plain data value.
Definition ipc_types:117
L4::Ipc::In_out
Mark an argument as in-out argument.
Definition ipc_types:42
L4::Ipc::Msg::Cls_buffer
Marker type for receive buffer values.
Definition ipc_basics:154
L4::Ipc::Msg::Cls_item
Marker type for item values.
Definition ipc_basics:152
L4::Ipc::Msg::Dir_in
Marker type for input values.
Definition ipc_basics:145
L4::Ipc::Msg::Dir_out
Marker type for output values.
Definition ipc_basics:147
L4::Ipc::Msg::Is_valid_rpc_type
Type trait defining a valid RPC parameter type.
Definition ipc_basics:339
L4::Ipc::Msg::Svr_val_ops
Defines client-side handling of `MTYPE' as RPC argument.
Definition ipc_basics:264
L4::Ipc::Opt::set_valid
void set_valid(bool valid=true) noexcept
Set the argument to present or absent.
Definition ipc_types:156
L4::Ipc::Opt::Opt
Opt(T value) noexcept
Make a present optional argument with the given value.
Definition ipc_types:145
L4::Ipc::Opt::is_valid
bool is_valid() const noexcept
Get true if present, false if not.
Definition ipc_types:167
L4::Ipc::Opt< typename Elem< T & >::svr_type > &::value
T value() const noexcept
Definition ipc_types:163
L4::Ipc::Opt< typename Elem< T & >::svr_type > &::_value
T _value
Definition ipc_types:138
L4::Ipc::Opt::Opt
Opt() noexcept
Make an absent optional argument.
Definition ipc_types:142
L4::Ipc::Opt::value
T & value() noexcept
Get the value.
Definition ipc_types:165
L4::Ipc::Opt< typename Elem< T & >::svr_type > &::_valid
bool _valid
Definition ipc_types:139
L4::Ipc::Out
Mark an argument as a output value in an RPC signature.
Definition ipc_types:31
types
l4_fpage_t
L4 flexpage type.
Definition __l4_fpage.h:76