summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/wavm/Include/WAVM/Platform/Signal.h
blob: cd42b04b7ae5be32a0e60492cf1e54d2caae611e (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
#pragma once

#include "WAVM/Inline/BasicTypes.h"
#include "WAVM/Platform/Defines.h"
#include "WAVM/Platform/Diagnostics.h"

namespace WAVM { namespace Platform {
	struct Signal
	{
		enum class Type
		{
			invalid = 0,
			accessViolation,
			stackOverflow,
			intDivideByZeroOrOverflow
		};

		Type type = Type::invalid;

		union
		{
			struct
			{
				Uptr address;
			} accessViolation;
		};
	};

	WAVM_API bool catchSignals(void (*thunk)(void*),
							   bool (*filter)(void*, Signal, CallStack&&),
							   void* argument);

	WAVM_API void registerEHFrames(const U8* imageBase, const U8* ehFrames, Uptr numBytes);
	WAVM_API void deregisterEHFrames(const U8* imageBase, const U8* ehFrames, Uptr numBytes);
}}