> Patrik Stridvall wrote:
>
> > +print ' #stdcall_name ":\n"' . " \\\n";=0A=
> > +print ' "\tmovl (%esp), %eax\n"' . " \\\n";=0A=
> > +print ' "\tleal " #argsize "(%esp), %edx\n"' . " \\\n";=0A=
> > +print ' "." #stdcall_name ":\n"' . " \\\n";=0A=
> > +print ' "\tmovl (%edx), %ecx\n"' . " \\\n";=0A=
> > +print ' "\tmovl %eax, (%edx)\n"' . " \\\n";=0A=
> > +print ' "\tmovl %ecx, %eax\n"' . " \\\n";=0A=
> > +print ' "\tsubl $4, %edx\n"' . " \\\n";=0A=
> > +print ' "\tleal (%esp), %ecx\n"' . " \\\n";=0A=
> > +print ' "\tcmpl %ecx, %edx\n"' . " \\\n";=0A=
> > +print ' "\tjge ." #stdcall_name "\n"' . " \\\n";=0A=
> [snip]
> > +print ' "\tpopl %ecx\n"' . " \\\n";=0A=
> > +print ' "\tsubl $" #argsize ", %esp\n"' . " \\\n";=0A=
> > +print ' "\tjmp *%ecx\n"' . " \\\n";=0A=
>
> This appears to be broken; you need to *add* the argsize instead
> of subtracting it, and furthermore the return address lies now
> *above* the arguments after the stack permutation you did above ;-)
>
> What about this instead of the last three lines:
>
> print "\taddl $" #argsize ", %esp\n";
> print "\tret\n";
Yes, that is probably correct.
As a side note, this is what I did in one of the cases in
the my Solaris C patch. A typical example of Murphy's law.
I knew that there were two cases but I choose the wrong one...