diff options
author | Dmitry Chagin <dchagin@FreeBSD.org> | 2023-05-28 14:06:05 +0000 |
---|---|---|
committer | Dmitry Chagin <dchagin@FreeBSD.org> | 2023-05-28 14:06:05 +0000 |
commit | a463dd810851fdae5efcb8f8205d742ebf221bc8 (patch) | |
tree | 71491dfd993a0655f78f395546cbfbcadb096b72 | |
parent | a99b890ecd26131e0c91e5693b55f5700c40a847 (diff) | |
download | src-a463dd810851fdae5efcb8f8205d742ebf221bc8.tar.gz src-a463dd810851fdae5efcb8f8205d742ebf221bc8.zip |
linux(4): Add a comment explaining registers at syscall entry point on amd64
Differential Revision: https://reviews.freebsd.org/D40153
MFC after: 1 month
-rw-r--r-- | sys/amd64/linux/linux_sysvec.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 916ab9b687bf..89d388dc6cf8 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) { |