L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
cap_alloc_impl.h
Go to the documentation of this file.
1// -*- Mode: C++ -*-
2// vim:ft=cpp
7/*
8 * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
9 * economic rights: Technische Universität Dresden (Germany)
10 *
11 * This file is part of TUD:OS and distributed under the terms of the
12 * GNU General Public License 2.
13 * Please see the COPYING-GPL-2 file for details.
14 *
15 * As a special exception, you may use this file as part of a free software
16 * library without restriction. Specifically, if other files instantiate
17 * templates or use macros or inline functions from this file, or you compile
18 * this file and link it with other files to produce an executable, this
19 * file does not by itself cause the resulting executable to be covered by
20 * the GNU General Public License. This exception does not however
21 * invalidate any other reasons why the executable file might be covered by
22 * the GNU General Public License.
23 */
24
25#pragma once
26
27#include <l4/bid_config.h>
28
29#if defined(CONFIG_L4RE_BITMAP_CAP_ALLOC)
30
32
33namespace L4Re { namespace Util {
34
35typedef Cap_alloc_base _Cap_alloc;
36
37}}
38
39#elif defined(CONFIG_L4RE_COUNTING_CAP_ALLOC)
40
42#include <l4/re/util/debug>
43
44namespace L4Re { namespace Util {
45
46// RISC-V does not natively support subword atomics, such as __atomic_load_1.
47// The RISC-V gcc developers have decided to emulate these via libatomic, which
48// is automatically linked against.
49#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) || defined(ARCH_arm) || defined(ARCH_riscv)
50typedef Counting_cap_alloc<L4Re::Util::Counter_atomic<unsigned char>,
51 L4Re::Util::Dbg > _Cap_alloc;
52#elif defined(ARCH_sparc)
53typedef Counting_cap_alloc<L4Re::Util::Counter<unsigned char>,
54 L4Re::Util::Dbg > _Cap_alloc;
55#warning "Thread-safe capability allocator not available!"
56#else
57#error "Unsupported platform"
58#endif
59
60}}
61
62#else
63#error "No supported capability allocator selected"
64#endif
Bitmap capability allocator.
Reference-counting capability allocator.
L4Re C++ Interfaces.
Definition l4re.dox:17