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.
This commit is contained in:
parent
ebb874e216
commit
06fa15fb99
1 changed files with 2 additions and 2 deletions
|
|
@ -582,6 +582,8 @@ void gfunc_call(int nb_args)
|
||||||
vtop--;
|
vtop--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
save_regs(0); /* save used temporary registers */
|
||||||
|
|
||||||
/* Copy R10 and R11 into RDX and RCX, respectively */
|
/* Copy R10 and R11 into RDX and RCX, respectively */
|
||||||
if (nb_reg_args > 2) {
|
if (nb_reg_args > 2) {
|
||||||
o(0xd2894c); /* mov %r10, %rdx */
|
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_sym = vtop->type.ref;
|
||||||
func_call = FUNC_CALL(func_sym->r);
|
func_call = FUNC_CALL(func_sym->r);
|
||||||
oad(0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */
|
oad(0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue