summaryrefslogtreecommitdiff
path: root/firmware/lib/libc/cxa.cpp
blob: 746a507b179895770cdbc77623c6fc5abcf2aaf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <cstdlib>
#include <cstdint>
#include <cxxabi.h>

namespace __cxxabiv1
{
// 3.2.6 Pure Virtual Function API
extern "C" void __cxa_pure_virtual ()
{
    while(true);
}

// 3.2.7 Deleted Virtual Function API
extern "C" void __cxa_deleted_virtual ()
{
    while(true);
}

// 3.3.2 One-time Construction API
// NOTE: Implementation does not support threads; no locking involved

extern "C" int
__cxa_guard_acquire(__guard *_guard)
{
    uint8_t *guard = reinterpret_cast<uint8_t*>(_guard);
    return guard[0] ? 0 : 1;
}

extern "C" void
__cxa_guard_release(__guard *_guard)
{
    uint8_t *guard = reinterpret_cast<uint8_t*>(_guard);
    guard[0] = 1;
}

extern "C" void
__cxa_guard_abort(__guard *_guard)
{
    uint8_t *guard = reinterpret_cast<uint8_t*>(_guard);
    guard[0] = 0;
}

} // namespace __cxxabiv1