Skip to content

Commit

Permalink
fixup: support ARM64 in '_reg_name'
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaretnikov committed Apr 30, 2019
1 parent f6db31c commit a01593f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manticore/native/cpu/abstractcpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from ...utils.fallback_emulator import UnicornEmulator
from ...utils.helpers import issymbolic

from capstone import CS_ARCH_ARM64, CS_ARCH_X86
from capstone.arm64 import ARM64_REG_ENDING
from capstone.x86 import X86_REG_ENDING

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -146,7 +148,9 @@ def _reg_name(self, reg_id):
:param int reg_id: Register ID
"""
if reg_id >= X86_REG_ENDING:
# XXX: Support other architectures.
if ((self.cpu.arch == CS_ARCH_ARM64 and reg_id >= ARM64_REG_ENDING) or
(self.cpu.arch == CS_ARCH_X86 and reg_id >= X86_REG_ENDING)):
logger.warning("Trying to get register name for a non-register")
return None
cs_reg_name = self.cpu.instruction.reg_name(reg_id)
Expand Down

0 comments on commit a01593f

Please sign in to comment.