52 lines
1.5 KiB
Python
52 lines
1.5 KiB
Python
from binaryninja import *
|
|
|
|
class Pasticciotto(Architecture):
|
|
name = 'pasticciotto'
|
|
address_size = 2
|
|
default_int_size = 2
|
|
|
|
regs = {
|
|
'r0': RegisterInfo('r0', 2),
|
|
'r1': RegisterInfo('r1', 2),
|
|
'r2': RegisterInfo('r2', 2),
|
|
'r3': RegisterInfo('r3', 2),
|
|
's0': RegisterInfo('s0', 2),
|
|
's1': RegisterInfo('s1', 2),
|
|
's2': RegisterInfo('s2', 2),
|
|
's3': RegisterInfo('s3', 2),
|
|
'rp': RegisterInfo('rp', 2),
|
|
'sp': RegisterInfo('sp', 2),
|
|
'ip': RegisterInfo('ip', 2)
|
|
}
|
|
stack_pointer = 'sp'
|
|
link_reg = 'rp'
|
|
|
|
def perform_get_instruction_info(self, data, addr):
|
|
print("DATA: {}".format(data))
|
|
print("ADDR: {}".format(addr))
|
|
|
|
result = InstructionInfo()
|
|
result.length = 0
|
|
# eventuali branch da aggiungere
|
|
return result
|
|
|
|
def perform_get_instruction_text(self, data, addr):
|
|
print("DATA: {}".format(data))
|
|
print("ADDR: {}".format(addr))
|
|
|
|
tokens = ""
|
|
length = 0
|
|
|
|
return tokens, length
|
|
|
|
class DefaultCallingConvention(CallingConvention):
|
|
name = 'default'
|
|
int_arg_regs = ['r0', 'r1', 'r2', 'r3']
|
|
int_return_reg = 'r0'
|
|
high_int_return_reg = 'r1'
|
|
|
|
Pasticciotto.register()
|
|
arch = Architecture['pasticciotto']
|
|
arch.register_calling_convention(DefaultCallingConvention(arch))
|
|
standalone = arch.standalone_platform
|
|
standalone.default_calling_convention = arch.calling_conventions['default'] |