Loading...
Searching...
No Matches
mem_alloc
Go to the documentation of this file.
// -*- Mode: C++ -*-
// vim:ft=cpp
/*
* Copyright (C) 2014-2016, 2019, 2021, 2024 Kernkonzept GmbH.
* Author(s): Alexander Warg <alexander.warg@kernkonzept.com>
*/
/*
* (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
* Alexander Warg <warg@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/re/protocols.h>
#include <l4/sys/capability>
#include <l4/sys/cxx/ipc_iface>
#include <l4/sys/factory>
namespace L4Re {
class Dataspace;
// MISSING:
// * alignment constraints
// * shall we support superpages in noncont memory?
class L4_EXPORT Mem_alloc :
public L4::Kobject_t<Mem_alloc, L4::Factory, L4RE_PROTO_MEM_ALLOC>
{
public:
enum Mem_alloc_flags
{
Continuous = 0x01,
Pinned = 0x02,
Super_pages = 0x04,
Fixed_paddr = 0x08,
};
struct Stats
{
l4_size_t quota;
l4_size_t quota_used;
l4_size_t mem_limit;
l4_size_t mem_used;
l4_size_t mem_free;
};
long alloc(long size, L4::Cap<Dataspace> mem,
unsigned long flags = 0, unsigned long align = 0,
l4_addr_t paddr = 0) const noexcept;
L4_INLINE_RPC(long, info, (Stats &stats));
typedef L4::Typeid::Rpcs<info_t> Rpcs;
};
};
capability
L4::Cap related definitions.
L4Re::Dataspace
Interface for memory-like objects.
Definition dataspace:53
L4Re::Mem_alloc
Memory allocation interface.
Definition mem_alloc:54
L4Re::Mem_alloc::alloc
long alloc(long size, L4::Cap< Dataspace > mem, unsigned long flags=0, unsigned long align=0, l4_addr_t paddr=0) const noexcept
Allocate anonymous memory.
Definition mem_alloc_impl.h:24
L4Re::Mem_alloc::Mem_alloc_flags
Mem_alloc_flags
Flags for the allocator.
Definition mem_alloc:63
L4Re::Mem_alloc::Super_pages
@ Super_pages
Allocate super pages.
Definition mem_alloc:66
L4Re::Mem_alloc::Fixed_paddr
@ Fixed_paddr
Allocate at fixed physical address.
Definition mem_alloc:67
L4Re::Mem_alloc::Continuous
@ Continuous
Allocate physically contiguous memory.
Definition mem_alloc:64
L4Re::Mem_alloc::Pinned
@ Pinned
Deprecated, use L4Re::Dma_space instead.
Definition mem_alloc:65
L4Re::Mem_alloc::info
long info(Stats &stats)
Get allocator information.
L4::Cap
C++ interface for capabilities.
Definition capability.h:224
L4::Kobject_t
Helper class to create an L4Re interface class that is derived from a single base class.
Definition __typeinfo.h:750
factory
Common factory related definitions.
l4_size_t
unsigned int l4_size_t
Unsigned size type.
Definition l4int.h:24
l4_addr_t
unsigned long l4_addr_t
Address type.
Definition l4int.h:34
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_INLINE_RPC
#define L4_INLINE_RPC(res, name, args, attr...)
Define an inline RPC call (type and callable).
Definition ipc_iface:482
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::Mem_alloc::Stats
Statistics about memory-allocator.
Definition mem_alloc:75
L4Re::Mem_alloc::Stats::quota
l4_size_t quota
Memory quota of this allocator.
Definition mem_alloc:83
L4Re::Mem_alloc::Stats::mem_limit
l4_size_t mem_limit
Maximum amount of memory that can be allocated by this allocator.
Definition mem_alloc:102
L4Re::Mem_alloc::Stats::quota_used
l4_size_t quota_used
Amount of currently used quota of this allocator.
Definition mem_alloc:94
L4Re::Mem_alloc::Stats::mem_used
l4_size_t mem_used
Amount of currently allocated memory.
Definition mem_alloc:116
L4Re::Mem_alloc::Stats::mem_free
l4_size_t mem_free
Amount of memory that is still available for allocation.
Definition mem_alloc:126