diff options
| author | Camille Mougey <commial@gmail.com> | 2018-06-19 17:53:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-19 17:53:45 +0200 |
| commit | 0adddb12a7410c4bbdd6ee79252e9bf05ca22818 (patch) | |
| tree | 92facadca71fc07d7760c60d2ca877774c73579b /example/ida/utils.py | |
| parent | 8f5ca332780cf9e08761060e9903bc085dbc8430 (diff) | |
| parent | f1b32ba2b8db22a5f92a2734af55e9a5dba2271e (diff) | |
| download | miasm-0adddb12a7410c4bbdd6ee79252e9bf05ca22818.tar.gz miasm-0adddb12a7410c4bbdd6ee79252e9bf05ca22818.zip | |
Merge pull request #770 from serpilliere/ida_guess_machine_addr
Example/ida: use addr to guess arch
Diffstat (limited to 'example/ida/utils.py')
| -rw-r--r-- | example/ida/utils.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/example/ida/utils.py b/example/ida/utils.py index 481220a9..5620a881 100644 --- a/example/ida/utils.py +++ b/example/ida/utils.py @@ -5,7 +5,7 @@ from miasm2.analysis.machine import Machine from miasm2.ir.translators import Translator import miasm2.expression.expression as m2_expr -def guess_machine(): +def guess_machine(addr=None): "Return an instance of Machine corresponding to the IDA guessed processor" processor_name = GetLongPrm(INF_PROCNAME) @@ -39,7 +39,14 @@ def guess_machine(): (False, 64, True): "aarch64b", (False, 64, False): "aarch64l", } - is_armt = globals().get('armt', False) + + # Get T reg to detect arm/thumb function + # Default is arm + is_armt = False + if addr is not None: + t_reg = GetReg(addr, "T") + is_armt = t_reg == 1 + is_bigendian = info.is_be() infos = (is_armt, size, is_bigendian) if not infos in info2machine: |