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
582 vtop--;582 vtop--;
583 }583 }
584 584
585 save_regs(0); /* save used temporary registers */
586
585 /* Copy R10 and R11 into RDX and RCX, respectively */587 /* Copy R10 and R11 into RDX and RCX, respectively */
586 if (nb_reg_args > 2) {588 if (nb_reg_args > 2) {
587 o(0xd2894c); /* mov %r10, %rdx */589 o(0xd2894c); /* mov %r10, %rdx */
@@ -590,8 +592,6 @@ void gfunc_call(int nb_args) · 2 unmodified lines
590 }592 }
591 }593 }
592 594
593 save_regs(0); /* save used temporary registers */
594
595 func_sym = vtop->type.ref;595 func_sym = vtop->type.ref;
596 func_call = FUNC_CALL(func_sym->r);596 func_call = FUNC_CALL(func_sym->r);
597 oad(0xb8, nb_sse_args < 8 ? nb_sse_args : 8); /* mov nb_sse_args, %eax */597 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