about summary refs log tree commit diff stats
path: root/miasm2/jitter/loader/pe.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-03-19 10:17:09 +0100
committerAjax <commial@gmail.com>2015-03-19 10:17:09 +0100
commit621bd32bfc95cb34ee6b7dee6e64b9f23b480c22 (patch)
tree09cbb45cf9d3f130653308e6c957376c6ea0565b /miasm2/jitter/loader/pe.py
parent84832715898091f0da98e49502e45fdd77bc5748 (diff)
downloadmiasm-621bd32bfc95cb34ee6b7dee6e64b9f23b480c22.tar.gz
miasm-621bd32bfc95cb34ee6b7dee6e64b9f23b480c22.zip
LoaderPE: Add `guess_arch` and link it to ContainerPE.arch
Diffstat (limited to 'miasm2/jitter/loader/pe.py')
-rw-r--r--miasm2/jitter/loader/pe.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/miasm2/jitter/loader/pe.py b/miasm2/jitter/loader/pe.py
index a3834d03..7c11b9c5 100644
--- a/miasm2/jitter/loader/pe.py
+++ b/miasm2/jitter/loader/pe.py
@@ -406,3 +406,13 @@ class libimp_pe(libimp):
                 all_ads = all_ads[i + 1:]
 
         return new_lib
+
+# machine -> arch
+PE_machine = {0x14c: "x86_32",
+              0x8664: "x86_64",
+              }
+
+def guess_arch(pe):
+    """Return the architecture specified by the PE container @pe.
+    If unknown, return None"""
+    return PE_machine.get(pe.Coffhdr.machine, None)