diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2015-02-20 22:52:16 +0100 |
|---|---|---|
| committer | serpilliere <serpilliere@users.noreply.github.com> | 2015-02-20 22:52:16 +0100 |
| commit | 1db45ff969a41d0576cf00f00f7b59e1bb332de2 (patch) | |
| tree | a062d34aacc6e6f3692cb6b92567a29081500d93 | |
| parent | f1966ac767894b4fe954613d2134f87cdc3697ca (diff) | |
| parent | c37fd6a238c617d1ca9a29871a229a64ba14b41e (diff) | |
| download | miasm-1db45ff969a41d0576cf00f00f7b59e1bb332de2.tar.gz miasm-1db45ff969a41d0576cf00f00f7b59e1bb332de2.zip | |
Merge pull request #81 from ggqb/master
x86 fix for PUSHFW / POPFW instructions
| -rw-r--r-- | miasm2/arch/x86/arch.py | 4 | ||||
| -rw-r--r-- | miasm2/arch/x86/sem.py | 4 | ||||
| -rw-r--r-- | miasm2/os_dep/win_api_x86_32.py | 4 | ||||
| -rw-r--r-- | test/arch/x86/arch.py | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py index c5535153..c059e1be 100644 --- a/miasm2/arch/x86/arch.py +++ b/miasm2/arch/x86/arch.py @@ -3745,7 +3745,7 @@ addop("popad", [bs8(0x61), bs_opmode32]) # popf_name = {16:'POPF', 32:'POPFD', 64:'POPFQ'} # bs_popf_name = bs_modname_size(l=0, name=popf_name) # addop("popf", [bs8(0x9d), bs_popf_name]) -addop("popf", [bs8(0x9d), bs_opmode16]) +addop("popfw", [bs8(0x9d), bs_opmode16]) addop("popfd", [bs8(0x9d), bs_opmode32]) addop("popfq", [bs8(0x9d), bs_opmode64]) @@ -3775,7 +3775,7 @@ addop("pushad", [bs8(0x60), bs_opmode32_no64]) # pushf_name = {16:'PUSHF', 32:'PUSHFD', 64:'PUSHFQ'} # bs_pushf_name = bs_modname_size(l=0, name=pushf_name) # addop("pushf", [bs8(0x9c), bs_pushf_name]) -addop("pushf", [bs8(0x9c), bs_opmode16]) +addop("pushfw", [bs8(0x9c), bs_opmode16]) addop("pushfd", [bs8(0x9c), bs_opmode32]) addop("pushfq", [bs8(0x9c), bs_opmode64]) diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 928554cb..52cec344 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -970,7 +970,7 @@ def popfd(ir, instr): def popfw(ir, instr): - tmp = m2_expr.ExprMem(esp) + tmp = m2_expr.ExprMem(mRSP[instr.mode]) e = [] e.append(m2_expr.ExprAff(cf, m2_expr.ExprSlice(tmp, 0, 1))) e.append(m2_expr.ExprAff(pf, m2_expr.ExprSlice(tmp, 2, 3))) @@ -983,7 +983,7 @@ def popfw(ir, instr): e.append(m2_expr.ExprAff(of, m2_expr.ExprSlice(tmp, 11, 12))) e.append(m2_expr.ExprAff(iopl, m2_expr.ExprSlice(tmp, 12, 14))) e.append(m2_expr.ExprAff(nt, m2_expr.ExprSlice(tmp, 14, 15))) - e.append(m2_expr.ExprAff(esp, esp + m2_expr.ExprInt32(2))) + e.append(m2_expr.ExprAff(mRSP[instr.mode], mRSP[instr.mode] + m2_expr.ExprInt_fromsize(mRSP[instr.mode].size, 2))) return e, [] diff --git a/miasm2/os_dep/win_api_x86_32.py b/miasm2/os_dep/win_api_x86_32.py index cac03905..cb107419 100644 --- a/miasm2/os_dep/win_api_x86_32.py +++ b/miasm2/os_dep/win_api_x86_32.py @@ -782,8 +782,8 @@ def kernel32_GetModuleFileName(jitter, funcname, set_str): for x in winobjs.runtime_dll.name2off.items()]) p = name_inv[args.hmodule] else: - log.warning('Unknown module 0x%x.' + \ - 'Set winobjs.hcurmodule and retry' % args.hmodule) + log.warning(('Unknown module 0x%x.' + \ + 'Set winobjs.hcurmodule and retry') % args.hmodule) p = None if p is None: diff --git a/test/arch/x86/arch.py b/test/arch/x86/arch.py index 5a87012f..16a0794a 100644 --- a/test/arch/x86/arch.py +++ b/test/arch/x86/arch.py @@ -1111,7 +1111,7 @@ reg_tests = [ (m32, "00000000 POPAD", "61"), - (m16, "00000000 POPF", + (m16, "00000000 POPFW", "9d"), (m32, "00000000 POPFD", "9d"), @@ -1179,7 +1179,7 @@ reg_tests = [ (m32, "00000000 PUSHAD", "60"), - (m16, "00000000 PUSHF", + (m16, "00000000 PUSHFW", "9c"), (m32, "00000000 PUSHFD", "9c"), |