X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugin%2Fsaveasm.cpp;h=8e1bc953864afa5615a84fa3e4d757d62ec72590;hb=afdd4566574318873cf85edd41fb3c7d80f98b28;hp=0732e092c0148d2bccb134ce710caeee0cef3a33;hpb=fc1c61f5af4e34ed1a813cfdcbe4b9f1b585763c;p=ia32rtools.git diff --git a/plugin/saveasm.cpp b/plugin/saveasm.cpp index 0732e09..8e1bc95 100644 --- a/plugin/saveasm.cpp +++ b/plugin/saveasm.cpp @@ -248,7 +248,10 @@ static void idaapi run(int /*arg*/) if (cmd.Operands[o].type == o_mem) { tmp_ea = cmd.Operands[o].addr; flags_t tmp_ea_flags = get_flags_novalue(tmp_ea); - if (!isUnknown(tmp_ea_flags)) { + // ..but base float is ok.. + int is_flt = isDwrd(tmp_ea_flags) || isFloat(tmp_ea_flags); + if (!is_flt && !isUnknown(tmp_ea_flags)) + { buf[0] = 0; get_name(ea, tmp_ea, buf, sizeof(buf)); msg("%x: undefining %x '%s'\n", ea, tmp_ea, buf); @@ -439,7 +442,7 @@ static void idaapi run(int /*arg*/) for (;;) { int drop_large = 0, do_rva = 0, set_scale = 0, jmp_near = 0; - int word_imm = 0, dword_imm = 0, do_pushf = 0; + int word_imm = 0, dword_imm = 0, do_pushf = 0, do_nops = 0; if ((ea >> 14) != ui_ea_block) { ui_ea_block = ea >> 14; @@ -497,6 +500,12 @@ static void idaapi run(int /*arg*/) if (get_word(ea + opr.offb) == (ushort)opr.value) word_imm = 1; } + else if (opr.type == o_displ && opr.addr == 0 + && opr.offb != 0 && opr.hasSIB && opr.sib == 0x24) + { + // uses [esp+0] with 0 encoded into op + do_nops++; + } } } else { // not code @@ -539,7 +548,9 @@ pass: } } else if (jmp_near) { - p = strchr(fw, 'j'); + p = NULL; + if (fw != buf && fw[0] == 'j') + p = fw; while (p && *p != ' ') p++; while (p && *p == ' ') @@ -547,6 +558,7 @@ pass: if (p != NULL) { memmove(p + 9, p, strlen(p) + 1); memcpy(p, "near ptr ", 9); + jmp_near = 0; } } if (word_imm) { @@ -593,6 +605,9 @@ pass: qfprintf(fout, "%s\n", buf); } + while (do_nops-- > 0) + qfprintf(fout, " nop ; adj\n"); + // note: next_head skips some undefined stuff ea = next_not_tail(ea); // correct? if (ea == BADADDR)