-
-
Notifications
You must be signed in to change notification settings - Fork 297
Expand file tree
/
Copy pathArmV7InstructionSet.cs
More file actions
55 lines (44 loc) · 1.68 KB
/
ArmV7InstructionSet.cs
File metadata and controls
55 lines (44 loc) · 1.68 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
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cpp2IL.Core.Api;
using Cpp2IL.Core.Graphs;
using Cpp2IL.Core.Il2CppApiFunctions;
using Cpp2IL.Core.ISIL;
using Cpp2IL.Core.Model.Contexts;
using Cpp2IL.Core.Utils;
namespace Cpp2IL.Core.InstructionSets;
public class ArmV7InstructionSet : Cpp2IlInstructionSet
{
public override ReadOnlyMemory<byte> GetRawBytesForMethod(MethodAnalysisContext context, bool isAttributeGenerator)
{
if (ArmV7Utils.TryGetMethodBodyBytesFast(context.UnderlyingPointer, context is AttributeGeneratorMethodAnalysisContext) is { } ret)
return ret;
var instructions = ArmV7Utils.GetArmV7MethodBodyAtVirtualAddress(context.UnderlyingPointer);
return instructions.SelectMany(i => i.Bytes).ToArray();
}
public override List<InstructionSetIndependentInstruction> GetIsilFromMethod(MethodAnalysisContext context)
{
return [];
}
public override BaseKeyFunctionAddresses CreateKeyFunctionAddressesInstance()
{
//TODO Fix
return new Arm64KeyFunctionAddresses();
}
public override string PrintAssembly(MethodAnalysisContext context)
{
var sb = new StringBuilder();
var instructions = ArmV7Utils.GetArmV7MethodBodyAtVirtualAddress(context.UnderlyingPointer);
var first = true;
foreach (var instruction in instructions)
{
if (!first)
sb.AppendLine();
first = false;
sb.Append("0x").Append(instruction.Address.ToString("X")).Append(" ").Append(instruction.Mnemonic).Append(" ").Append(instruction.Operand);
}
return sb.ToString();
}
}