summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py20
-rw-r--r--python/examples/nes.py1
2 files changed, 21 insertions, 0 deletions
diff --git a/python/__init__.py b/python/__init__.py
index f2be8758..fb5bfa3c 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -3261,6 +3261,8 @@ class Architecture(object):
endianness = core.LittleEndian
address_size = 8
default_int_size = 4
+ max_instr_length = 16
+ opcode_display_length = 8
regs = {}
stack_pointer = None
link_reg = None
@@ -3278,6 +3280,8 @@ class Architecture(object):
self.__dict__["endianness"] = core.BNEndianness_names[core.BNGetArchitectureEndianness(self.handle)]
self.__dict__["address_size"] = core.BNGetArchitectureAddressSize(self.handle)
self.__dict__["default_int_size"] = core.BNGetArchitectureDefaultIntegerSize(self.handle)
+ self.__dict__["max_instr_length"] = core.BNGetArchitectureMaxInstructionLength(self.handle)
+ self.__dict__["opcode_display_length"] = core.BNGetArchitectureOpcodeDisplayLength(self.handle)
self.__dict__["stack_pointer"] = core.BNGetArchitectureRegisterName(self.handle,
core.BNGetArchitectureStackPointerRegister(self.handle))
self.__dict__["link_reg"] = core.BNGetArchitectureRegisterName(self.handle,
@@ -3361,6 +3365,8 @@ class Architecture(object):
self._cb.getEndianness = self._cb.getEndianness.__class__(self._get_endianness)
self._cb.getAddressSize = self._cb.getAddressSize.__class__(self._get_address_size)
self._cb.getDefaultIntegerSize = self._cb.getDefaultIntegerSize.__class__(self._get_default_integer_size)
+ self._cb.getMaxInstructionLength = self._cb.getMaxInstructionLength.__class__(self._get_max_instruction_length)
+ self._cb.getOpcodeDisplayLength = self._cb.getOpcodeDisplayLength.__class__(self._get_opcode_display_length)
self._cb.getInstructionInfo = self._cb.getInstructionInfo.__class__(self._get_instruction_info)
self._cb.getInstructionText = self._cb.getInstructionText.__class__(self._get_instruction_text)
self._cb.freeInstructionText = self._cb.freeInstructionText.__class__(self._free_instruction_text)
@@ -3536,6 +3542,20 @@ class Architecture(object):
log_error(traceback.format_exc())
return 4
+ def _get_max_instruction_length(self, ctxt):
+ try:
+ return self.__class__.max_instr_length
+ except:
+ log_error(traceback.format_exc())
+ return 16
+
+ def _get_opcode_display_length(self, ctxt):
+ try:
+ return self.__class__.opcode_display_length
+ except:
+ log_error(traceback.format_exc())
+ return 8
+
def _get_instruction_info(self, ctxt, data, addr, max_len, result):
try:
buf = ctypes.create_string_buffer(max_len)
diff --git a/python/examples/nes.py b/python/examples/nes.py
index 21b02dfa..5cb6bc0d 100644
--- a/python/examples/nes.py
+++ b/python/examples/nes.py
@@ -349,6 +349,7 @@ class M6502(Architecture):
name = "6502"
address_size = 2
default_int_size = 1
+ max_instr_length = 3
regs = {
"a": RegisterInfo("a", 1),
"x": RegisterInfo("x", 1),