-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathCilExecutionContext.cs
More file actions
51 lines (45 loc) · 1.54 KB
/
CilExecutionContext.cs
File metadata and controls
51 lines (45 loc) · 1.54 KB
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
using System.Threading;
using AsmResolver.DotNet;
using Echo.Platforms.AsmResolver.Emulation.Stack;
namespace Echo.Platforms.AsmResolver.Emulation.Dispatch
{
/// <summary>
/// Provides a context for evaluating CIL instructions.
/// </summary>
public class CilExecutionContext
{
/// <summary>
/// Creates a new execution context for CIL instructions.
/// </summary>
/// <param name="thread">The parent thread the instruction is executed on.</param>
/// <param name="cancellationToken">A token used for canceling the emulation.</param>
public CilExecutionContext(CilThread thread, CancellationToken cancellationToken)
{
Thread = thread;
CancellationToken = cancellationToken;
}
/// <summary>
/// Gets the parent thread the instruction is executed on.
/// </summary>
public CilThread Thread
{
get;
}
/// <summary>
/// Gets the parent machine the instruction is executed on.
/// </summary>
public CilVirtualMachine Machine => Thread.Machine;
/// <summary>
/// Gets the current active stack frame.
/// </summary>
public CallFrame CurrentFrame => Thread.CallStack.Peek();
/// <summary>
/// Gets a token used for canceling the emulation.
/// </summary>
public CancellationToken CancellationToken
{
get;
}
public RuntimeContext RuntimeContext => Machine.RuntimeContext;
}
}