Date: Thu, 29 Jun 2023 08:20:44 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: d0117d06e9e3 - stable/13 - linux(4): Add a comment explaining registers at syscall entry point on amd64 Message-ID: <202306290820.35T8KiTM084667@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=d0117d06e9e3588a902119b7a011c3613ef4545c commit d0117d06e9e3588a902119b7a011c3613ef4545c Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-05-28 14:06:05 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-06-29 08:16:01 +0000 linux(4): Add a comment explaining registers at syscall entry point on amd64 Differential Revision: https://reviews.freebsd.org/D40153 MFC after: 1 month (cherry picked from commit a463dd810851fdae5efcb8f8205d742ebf221bc8) --- sys/amd64/linux/linux_sysvec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index f43e7d3a02bc..3681dc881485 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -124,6 +124,23 @@ LINUX_VDSO_SYM_INTPTR(kern_timekeep_base); LINUX_VDSO_SYM_INTPTR(kern_tsc_selector); LINUX_VDSO_SYM_INTPTR(kern_cpu_selector); +/* + * According to the Intel x86 ISA 64-bit syscall + * saves %rip to %rcx and rflags to %r11. Registers on syscall entry: + * %rax system call number + * %rcx return address + * %r11 saved rflags + * %rdi arg1 + * %rsi arg2 + * %rdx arg3 + * %r10 arg4 + * %r8 arg5 + * %r9 arg6 + * + * Then FreeBSD fast_syscall() move registers: + * %rcx -> trapframe.tf_rip + * %r10 -> trapframe.tf_rcx + */ static int linux_fetch_syscall_args(struct thread *td) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306290820.35T8KiTM084667>