]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: update comments for amd64 do_syscall_WRK
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 23 Mar 2025 17:09:14 +0000 (18:09 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 23 Mar 2025 17:09:14 +0000 (18:09 +0100)
Get the comments about the last two stack arguments right.

coregrind/m_syscall.c

index 54c7bd8952044f60c796734f094bdc0ff278a5f3..c76f1df81bcd82e4e9cda2f08b5aa3320640b6f0 100644 (file)
@@ -755,8 +755,9 @@ asm(
 
 #elif defined(VGP_amd64_freebsd)
 /* Convert function calling convention --> SYSCALL_STD calling
-   convention
-   PJF - not sure why we don't use SYSCALL0 convention like x86
+   convention.
+   Last stack arguments need to be pushed first, hence
+   a8 is pushed before a7.
  */
 extern UWord do_syscall_WRK (
           UWord syscall_no,    /* %rdi */
@@ -782,10 +783,10 @@ asm(
 "      movq    %rcx, %rdx\n"    /* a3 */
 "      movq    %r8,  %r10\n"    /* a4 */
 "      movq    %r9,  %r8\n"     /* a5 */
-"      movq    16(%rbp), %r9\n" /* a6 last arg from stack, account for %rbp */
-"      movq    32(%rbp), %r11\n" /* a7 from stack */
+"      movq    16(%rbp), %r9\n" /* a6 last register arg from stack, account for %rbp */
+"      movq    32(%rbp), %r11\n" /* a8 from stack */
 "      pushq  %r11\n"
-"      movq    24(%rbp), %r11\n" /* a8 from stack */
+"      movq    24(%rbp), %r11\n" /* a7 from stack */
 "      pushq  %r11\n"
 "      subq    $8,%rsp\n"       /* fake return addr */
 "      syscall\n"