Loading...
Searching...
No Matches
dataspace
Go to the documentation of this file.
// -*- Mode: C++ -*-
// vim:ft=cpp
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@os.inf.tu-dresden.de>,
* Björn Döbel <doebel@os.inf.tu-dresden.de>,
* Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
* economic rights: Technische Universität Dresden (Germany)
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include <l4/bid_config.h>
#include <l4/sys/types.h>
#include <l4/sys/l4int.h>
#include <l4/sys/capability>
#include <l4/re/protocols.h>
#include <l4/sys/cxx/ipc_types>
#include <l4/sys/cxx/ipc_iface>
#include <l4/sys/cxx/types>
namespace L4Re
{
// MISSING:
// * size support in map, mapped size in reply
class L4_EXPORT Dataspace :
public L4::Kobject_t<Dataspace, L4::Kobject, L4RE_PROTO_DATASPACE,
L4::Type_info::Demand_t<1> >
{
public:
struct F
{
enum
{
Caching_shift = 4,
};
enum Flags
{
R = L4_FPAGE_RO,
Ro = L4_FPAGE_RO,
RW = L4_FPAGE_RW,
W = L4_FPAGE_W,
X = L4_FPAGE_X,
RX = L4_FPAGE_RX,
RWX = L4_FPAGE_RWX,
Rights_mask = 0x0f,
Normal = 0x00,
Cacheable = Normal,
Bufferable = 0x10,
Uncacheable = 0x20,
Caching_mask = 0x30,
};
L4_TYPES_FLAGS_OPS_DEF(Flags);
};
struct Flags : L4::Types::Flags_ops_t<Flags>
{
unsigned long raw;
Flags() = default;
explicit constexpr Flags(unsigned long f) : raw(f) {}
constexpr Flags(F::Flags f) : raw(f) {}
constexpr bool r() const { return raw & L4_FPAGE_RO; }
constexpr bool w() const { return raw & L4_FPAGE_W; }
constexpr bool x() const { return raw & L4_FPAGE_X; }
constexpr unsigned long fpage_rights() const
{ return raw & 0xf; }
};
typedef l4_uint64_t Size;
typedef l4_uint64_t Offset;
typedef l4_uint64_t Map_addr;
struct Stats
{
Size size;
Flags flags;
};
long map(Offset offset, Flags flags, Map_addr local_addr,
Map_addr min_addr, Map_addr max_addr,
L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
long map_region(Offset offset, Flags flags,
Map_addr min_addr, Map_addr max_addr,
L4::Cap<L4::Task> dst = L4::Cap<L4::Task>::Invalid) const noexcept;
L4_RPC(long, clear, (Offset offset, Size size));
L4_RPC(long, allocate, (Offset offset, Size size));
L4_RPC(long, copy_in, (Offset dst_offs, L4::Ipc::Cap<Dataspace> src,
Offset src_offs, Size size));
Size size() const noexcept;
Flags flags() const noexcept;
L4_RPC(long, info, (Stats *stats));
L4_RPC_NF(long, map, (Offset offset, Map_addr spot,
Flags flags, L4::Ipc::Rcv_fpage r,
L4::Ipc::Snd_fpage &fp));
#ifdef CONFIG_MMU
L4_RPC_NF(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
inline long map_info([[maybe_unused]] l4_addr_t *start_addr,
[[maybe_unused]] l4_addr_t *end_addr)
{ return 0; }
#else
L4_RPC(long, map_info, (l4_addr_t *start_addr, l4_addr_t *end_addr));
#endif
private:
long __map(Offset offset, unsigned char *order, Flags flags,
Map_addr local_addr, L4::Cap<L4::Task> dst) const noexcept;
public:
typedef L4::Typeid::Rpcs<map_t, clear_t, info_t, copy_in_t,
allocate_t, map_info_t> Rpcs;
};
}
capability
L4::Cap related definitions.
L4Re::Dataspace
Interface for memory-like objects.
Definition dataspace:53
L4Re::Dataspace::map
long map(Offset offset, Flags flags, Map_addr local_addr, Map_addr min_addr, Map_addr max_addr, L4::Cap< L4::Task > dst=L4::Cap< L4::Task >::Invalid) const noexcept
Request a flexpage mapping from the dataspace.
Definition dataspace_impl.h:85
L4Re::Dataspace::copy_in
long copy_in(Offset dst_offs, L4::Ipc::Cap< Dataspace > src, Offset src_offs, Size size)
Copy contents from another dataspace.
L4Re::Dataspace::map_region
long map_region(Offset offset, Flags flags, Map_addr min_addr, Map_addr max_addr, L4::Cap< L4::Task > dst=L4::Cap< L4::Task >::Invalid) const noexcept
Map a part of a dataspace into a local memory area.
Definition dataspace_impl.h:45
L4Re::Dataspace::info
long info(Stats *stats)
Get information on the dataspace.
L4Re::Dataspace::map_info
long map_info(l4_addr_t *start_addr, l4_addr_t *end_addr)
Get mapping range of dataspace.
Definition dataspace:305
L4Re::Dataspace::size
Size size() const noexcept
Get size of a dataspace.
Definition dataspace_impl.h:101
L4Re::Dataspace::clear
long clear(Offset offset, Size size)
Clear parts of a dataspace.
L4Re::Dataspace::allocate
long allocate(Offset offset, Size size)
Allocate a range in the dataspace.
L4Re::Dataspace::flags
Flags flags() const noexcept
Get flags of the dataspace.
Definition dataspace_impl.h:111
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::Kobject_t
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:750
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
l4_uint64_t
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition l4int.h:31
L4_FPAGE_X
@ L4_FPAGE_X
Executable flexpage.
Definition __l4_fpage.h:120
L4_FPAGE_RWX
@ L4_FPAGE_RWX
Read-write-execute flexpage.
Definition __l4_fpage.h:125
L4_FPAGE_RX
@ L4_FPAGE_RX
Read-execute flexpage.
Definition __l4_fpage.h:124
L4_FPAGE_RO
@ L4_FPAGE_RO
Read-only flexpage.
Definition __l4_fpage.h:122
L4_FPAGE_RW
@ L4_FPAGE_RW
Read-write flexpage.
Definition __l4_fpage.h:123
L4_FPAGE_W
@ L4_FPAGE_W
Writable flexpage.
Definition __l4_fpage.h:121
L4_EXPORT
#define L4_EXPORT
Attribute to mark functions, variables, and data types as being exported from a library.
Definition compiler.h:214
ipc_iface
Interface Definition Language.
L4_RPC
#define L4_RPC(res, name, args, attr...)
Define an RPC call (type and callable).
Definition ipc_iface:541
L4_RPC_NF
#define L4_RPC_NF(res, name, args...)
Define an RPC call type (the type only, no callable).
Definition ipc_iface:510
ipc_types
l4int.h
Fixed sized integer types, generic version.
types.h
Common L4 ABI Data Types.
L4Re
L4Re C++ Interfaces.
Definition cmd_control:14
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50
protocols.h
L4Re Protocol Constants (C version).
L4Re::Dataspace::F
Dataspace flags definitions.
Definition dataspace:58
L4Re::Dataspace::F::Caching_shift
@ Caching_shift
shift value for caching flags
Definition dataspace:61
L4Re::Dataspace::F::Flags
Flags
Flags for map operations.
Definition dataspace:71
L4Re::Dataspace::F::Ro
@ Ro
Request read-only mapping.
Definition dataspace:75
L4Re::Dataspace::F::Uncacheable
@ Uncacheable
Request uncacheable memory mappings.
Definition dataspace:97
L4Re::Dataspace::F::RW
@ RW
Request read-write mapping.
Definition dataspace:77
L4Re::Dataspace::F::Normal
@ Normal
Request normal (cached) memory mapping.
Definition dataspace:91
L4Re::Dataspace::F::Caching_mask
@ Caching_mask
Mask for caching flags.
Definition dataspace:99
L4Re::Dataspace::F::X
@ X
Request execute-only mapping.
Definition dataspace:81
L4Re::Dataspace::F::Cacheable
@ Cacheable
Request normal memory mapping.
Definition dataspace:93
L4Re::Dataspace::F::R
@ R
Request read-only mapping.
Definition dataspace:73
L4Re::Dataspace::F::RWX
@ RWX
Request read-write-execute mapping.
Definition dataspace:85
L4Re::Dataspace::F::W
@ W
Request write-only mapping.
Definition dataspace:79
L4Re::Dataspace::F::Bufferable
@ Bufferable
Request bufferable (write buffered) mappings.
Definition dataspace:95
L4Re::Dataspace::F::Rights_mask
@ Rights_mask
All rights bits available for mappings.
Definition dataspace:87
L4Re::Dataspace::F::RX
@ RX
Request read-execute mapping.
Definition dataspace:83
L4Re::Dataspace::Stats
Information about the dataspace.
Definition dataspace:127
L4Re::Dataspace::Stats::size
Size size
size
Definition dataspace:128
L4Re::Dataspace::Stats::flags
Flags flags
flags
Definition dataspace:129
L4::Typeid::Rpcs
Standard list of RPCs of an interface.
Definition __typeinfo.h:428
L4::Types::Flags_ops_t
Mixin class to define a set of friend bitwise operators on DT.
Definition types:221
types
L4_TYPES_FLAGS_OPS_DEF
#define L4_TYPES_FLAGS_OPS_DEF(T)
Helper macro to define a set of bitwise operators on an enum type.
Definition types:195