History

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.

Shinichiro Hamaji committed 17 years ago

Commit 06fa15f1 parent ebb874e1 file · +2 −2Browse files

Unified · Split

x86_64-gen.c+2−2
@@ -582,6 +582,8 @@ void gfunc_call(int nb_args) · 581 unmodified lines
582582 vtop--;
583583 }
584584
585+ save_regs(0); /* save used temporary registers */
586+
585587 /* Copy R10 and R11 into RDX and RCX, respectively */
586588 if (nb_reg_args > 2) {
587589 o(0xd2894c); /* mov %r10, %rdx */
@@ -590,8 +592,6 @@ void gfunc_call(int nb_args) · 2 unmodified lines
590592 }
591593 }
592594
593− save_regs(0); /* save used temporary registers */
594−
595595 func_sym = vtop->type.ref;
596596 func_call = FUNC_CALL(func_sym->r);
597597 oad(0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t