From d337969da4a5a2870414854fed0dd2f9ea969d4e Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sun, 23 Mar 2025 18:09:14 +0100 Subject: [PATCH] FreeBSD: update comments for amd64 do_syscall_WRK Get the comments about the last two stack arguments right. --- coregrind/m_syscall.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index 54c7bd895..c76f1df81 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -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" -- 2.47.2