-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathts.py
More file actions
60 lines (40 loc) · 1.33 KB
/
ts.py
File metadata and controls
60 lines (40 loc) · 1.33 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
56
57
58
59
from binaryninja.architecture import Architecture
from binaryninja.function import RegisterInfo, InstructionInfo, InstructionTextToken
from binaryninja.enums import InstructionTextTokenType
from .instr import decode, tT, REGS
class TS(Architecture):
name = 'ts:ts'
address_size = 4
max_instr_length = 16
regs = { r:RegisterInfo(r, 4) for r in REGS }
stack_pointer = 'sp'
def get_instruction_info(self, data, addr):
r = decode(data, addr)
if r is None:
h = InstructionInfo()
h.length = 12
return h
return r[1]
def get_instruction_text(self, data, addr):
r = decode(data, addr)
if r is None:
return [tT('unk')], 12
return r[0], r[1].length
def get_instruction_low_level_il(self, data, addr, il):
r = decode(data, addr)
if r is None:
return 12
if len(r) >= 3:
fn = r[2]
if fn is not None:
if type(fn) is list:
for f in fn:
h = f(il)
if h is not None:
il.append(h)
else:
h = fn(il)
if h is not None:
il.append(h)
return r[1].length
return 12