-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOpcode.cs
executable file
·98 lines (78 loc) · 1.89 KB
/
Opcode.cs
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// This file is part of bugreport.
// Copyright (c) 2006-2009 The bugreport Developers.
// See AUTHORS.txt for details.
// Licensed under the GNU General Public License, Version 3 (GPLv3).
// See LICENSE.txt for details.
using System;
namespace bugreport
{
public enum StackEffect
{
None,
Push,
Pop
}
public enum OperatorEffect
{
Unknown,
Assignment,
Add,
Sub,
None,
And,
Shr,
Shl,
Xor,
Return,
Leave,
Cmp,
Jnz,
Call,
}
public enum OpcodeEncoding
{
None,
EvGv,
EvIb,
EbGb,
EvIz,
EbIb,
GvEv,
GvEb,
Iz,
GvM,
rAxIv,
rAxIz,
rAxOv,
ObAL,
rAX,
rBX,
rCX,
rDX,
rSI,
rSP,
rBP,
Jz,
Jb,
Int3
}
public interface Opcode
{
OpcodeEncoding GetEncodingFor(Byte[] code);
OperatorEffect GetOperatorEffectFor(Byte[] code);
StackEffect GetStackEffectFor(Byte[] code);
Boolean HasModRM(Byte[] code);
Boolean HasOffset(Byte[] code);
Boolean HasImmediate(Byte[] code);
UInt32 GetImmediateFor(Byte[] code);
Byte GetInstructionLengthFor(Byte[] code);
Byte GetInstructionLengthFor(Byte[] code, UInt32 index);
Byte GetOpcodeLengthFor(Byte[] code);
RegisterName GetSourceRegisterFor(Byte[] code);
RegisterName GetDestinationRegisterFor(Byte[] code);
Boolean HasSourceRegister(Byte[] code);
Boolean HasDestinationRegister(Byte[] code);
Boolean TerminatesFunction(Byte[] code);
UInt32 GetEffectiveAddress(Byte[] code, UInt32 instructionPointer);
}
}