fix edx arg-reg corruption in fromasm
authornotaz <notasas@gmail.com>
Sun, 1 Dec 2013 16:18:12 +0000 (18:18 +0200)
committernotaz <notasas@gmail.com>
Sun, 1 Dec 2013 16:18:12 +0000 (18:18 +0200)
tools/mkbridge.c
tools/protoparse.h

index ac25d38..f0727d4 100644 (file)
@@ -124,6 +124,11 @@ static void out_fromasm_x86(FILE *f, char *sym, struct parsed_proto *pp)
                        stack_args--;
                }
                else {
+                       if (IS(pp->arg[i].reg, "edx"))
+                               // must reload original edx
+                               fprintf(f, "\tmovl %d(%%esp), %%edx\n",
+                                       (sarg_ofs - 2) * 4);
+
                        fprintf(f, "\tpushl %%%s\n", pp->arg[i].reg);
                }
                sarg_ofs++;
index 7d2d711..c102c49 100644 (file)
@@ -64,6 +64,7 @@ static const char *known_types[] = {
        "void *",
        "char *",
        "FILE *",
+       "int *",
        "unsigned __int8",
        "unsigned __int16",
        "unsigned int",