blob: 00d9a030ea3aaec7f9864e55c879b2b9d0cdcc76 (
plain) (
blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#pragma once
#include <setjmp.h>
#include <functional>
#include "WAVM/Inline/BasicTypes.h"
#include "WAVM/Inline/Errors.h"
#include "WAVM/Platform/Signal.h"
#ifdef __WAVIX__
// libunwind dynamic frame registration
inline void __register_frame(const void* fde)
{
WAVM::Errors::unimplemented("Wavix __register_frame");
}
inline void __deregister_frame(const void* fde)
{
WAVM::Errors::unimplemented("Wavix __deregister_frame");
}
#else
// libunwind dynamic frame registration
extern "C" void __register_frame(const void* fde);
extern "C" void __deregister_frame(const void* fde);
#endif
namespace WAVM { namespace Platform {
struct CallStack;
struct SignalContext
{
SignalContext* outerContext;
jmp_buf catchJump;
bool (*filter)(void*, Signal, CallStack&&);
void* filterArgument;
};
struct SigAltStack
{
~SigAltStack() { deinit(); }
void init();
void deinit();
void getNonSignalStack(U8*& outMinGuardAddr, U8*& outMinAddr, U8*& outMaxAddr);
private:
U8* base = nullptr;
U8* stackMinAddr;
U8* stackMaxAddr;
U8* stackMinGuardAddr;
};
extern thread_local SigAltStack sigAltStack;
extern thread_local SignalContext* innermostSignalContext;
extern bool initThreadAndGlobalSignalsOnce();
extern bool initGlobalSignalsOnce();
inline void initGlobalSignals()
{
static bool initedGlobalSignals = initGlobalSignalsOnce();
WAVM_ASSERT(initedGlobalSignals);
}
inline void initThreadAndGlobalSignals()
{
static thread_local bool initedThread = initThreadAndGlobalSignalsOnce();
WAVM_ASSERT(initedThread);
}
void dumpErrorCallStack(Uptr numOmittedFramesFromTop);
void getCurrentThreadStack(U8*& outMinGuardAddr, U8*& outMinAddr, U8*& outMaxAddr);
}}
|