diff options
| author | Camille Mougey <commial@gmail.com> | 2017-09-01 14:49:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-09-01 14:49:21 +0200 |
| commit | d806661d8407f580578e51194dbf3c3520b399b2 (patch) | |
| tree | ab7edd4bdee5447a594fa47e4c464eaf038ceaf0 | |
| parent | 752357fedaf07e196977bb5e5d87f40c67efc8dc (diff) | |
| parent | b3ce3d7e6a6da420fbc20c3393c793a9055eaf2a (diff) | |
| download | miasm-d806661d8407f580578e51194dbf3c3520b399b2.tar.gz miasm-d806661d8407f580578e51194dbf3c3520b399b2.zip | |
Merge pull request #609 from serpilliere/fix_x86_sib
X86: fix sib generation
| -rw-r--r-- | miasm2/arch/x86/arch.py | 4 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index 300021c1..73c9fc0d 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -2002,7 +2002,7 @@ class x86_rm_arg(m_arg): sib = None # 16 bit cannot have sib - if (not sib is None) and admode == 16: + if sib is not None and admode == 16: continue rex = modrm >> 8 # 0# XXX HACK REM temporary REX modrm>>8 if rex and admode != 64: @@ -2021,7 +2021,7 @@ class x86_rm_arg(m_arg): if re != p.reg.value: continue - if sib: + if sib is not None: s_scale, s_index, s_base = getmodrm(sib) else: s_scale, s_index, s_base = None, None, None diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 72884f7e..0472e714 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -1595,6 +1595,14 @@ reg_tests = [ (m64, "00000000 LODSQ", "48ad"), + (m32, "XXXXXXXX LEA EAX, DWORD PTR [EAX+EBX]", + "8d0418"), + (m32, "XXXXXXXX LEA EAX, DWORD PTR [EAX+EBX+0x11223344]", + "8d841844332211"), + (m32, "XXXXXXXX LEA EAX, DWORD PTR [EDX+0x18]", + "8d4218"), + (m32, "XXXXXXXX LEA ECX, DWORD PTR [EAX*0x2]", + "8d0c00"), (m32, "00000000 NEG BYTE PTR [EAX]", |