notaz.gp2x.de
/
ia32rtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use unsigned types, cc+nested branch fix, var type cast
[ia32rtools.git]
/
tools
/
mkbridge.c
diff --git
a/tools/mkbridge.c
b/tools/mkbridge.c
index
1e2f458
..
5bcd84a
100644
(file)
--- a/
tools/mkbridge.c
+++ b/
tools/mkbridge.c
@@
-126,21
+126,22
@@
static void out_fromasm_x86(FILE *f, char *sym, struct parsed_proto *pp)
return;
}
return;
}
- fprintf(f, "\tpushl %%edx\n"); // just in case..
+ // scratch reg, must not be eax or edx (for ret edx:eax)
+ fprintf(f, "\tpushl %%ebx\n");
sarg_ofs++;
// construct arg stack
for (i = argc_repush - 1; i >= 0; i--) {
if (pp->arg[i].reg == NULL) {
sarg_ofs++;
// construct arg stack
for (i = argc_repush - 1; i >= 0; i--) {
if (pp->arg[i].reg == NULL) {
- fprintf(f, "\tmovl %d(%%esp), %%e
d
x\n",
+ fprintf(f, "\tmovl %d(%%esp), %%e
b
x\n",
(sarg_ofs + stack_args - 1) * 4);
(sarg_ofs + stack_args - 1) * 4);
- fprintf(f, "\tpushl %%e
d
x\n");
+ fprintf(f, "\tpushl %%e
b
x\n");
stack_args--;
}
else {
stack_args--;
}
else {
- if (IS(pp->arg[i].reg, "e
d
x"))
- // must reload original e
d
x
- fprintf(f, "\tmovl %d(%%esp), %%e
d
x\n",
+ if (IS(pp->arg[i].reg, "e
b
x"))
+ // must reload original e
b
x
+ fprintf(f, "\tmovl %d(%%esp), %%e
b
x\n",
(sarg_ofs - 2) * 4);
fprintf(f, "\tpushl %%%s\n", pp->arg[i].reg);
(sarg_ofs - 2) * 4);
fprintf(f, "\tpushl %%%s\n", pp->arg[i].reg);
@@
-154,7
+155,7
@@
static void out_fromasm_x86(FILE *f, char *sym, struct parsed_proto *pp)
if (sarg_ofs > 2)
fprintf(f, "\tadd $%d,%%esp\n", (sarg_ofs - 2) * 4);
if (sarg_ofs > 2)
fprintf(f, "\tadd $%d,%%esp\n", (sarg_ofs - 2) * 4);
- fprintf(f, "\tpopl %%e
d
x\n");
+ fprintf(f, "\tpopl %%e
b
x\n");
if (pp->is_stdcall && pp->argc_stack)
fprintf(f, "\tret $%d\n\n", pp->argc_stack * 4);
if (pp->is_stdcall && pp->argc_stack)
fprintf(f, "\tret $%d\n\n", pp->argc_stack * 4);