forked from Mirrors/tinycc
x86-64: Save RDX and RCX before we use them as function parameters.
When the function call is indirect, these registers may be broken to load a function pointer.tcc-xref
parent
ebb874e216
commit
06fa15fb99
|
@ -582,6 +582,8 @@ void gfunc_call(int nb_args)
|
|||
vtop--;
|
||||
}
|
||||
|
||||
save_regs(0); /* save used temporary registers */
|
||||
|
||||
/* Copy R10 and R11 into RDX and RCX, respectively */
|
||||
if (nb_reg_args > 2) {
|
||||
o(0xd2894c); /* mov %r10, %rdx */
|
||||
|
@ -590,8 +592,6 @@ void gfunc_call(int nb_args)
|
|||
}
|
||||
}
|
||||
|
||||
save_regs(0); /* save used temporary registers */
|
||||
|
||||
func_sym = vtop->type.ref;
|
||||
func_call = FUNC_CALL(func_sym->r);
|
||||
oad(0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */
|
||||
|
|
Loading…
Reference in New Issue