diff options
author | Dmitry Chagin <dchagin@FreeBSD.org> | 2023-05-28 14:06:23 +0000 |
---|---|---|
committer | Dmitry Chagin <dchagin@FreeBSD.org> | 2023-06-29 08:16:01 +0000 |
commit | 053cbecd29f8f167628f5316d064557323af6ee8 (patch) | |
tree | ab23ad188d3d3b3f3556ef85beed2ed1fae69860 /sys/amd64/linux/linux_sysvec.c | |
parent | d0117d06e9e3588a902119b7a011c3613ef4545c (diff) | |
download | src-053cbecd29f8f167628f5316d064557323af6ee8.tar.gz src-053cbecd29f8f167628f5316d064557323af6ee8.zip |
linux(4): Simplify %r10 restoring on amd64
Restore %r10 at system call entry to avoid doing this multiply times.
Differential Revision: https://reviews.freebsd.org/D40154
MFC after: 1 month
(cherry picked from commit 185bd9fa3096595350ebe7bcd7e0ddcf17773030)
Diffstat (limited to 'sys/amd64/linux/linux_sysvec.c')
-rw-r--r-- | sys/amd64/linux/linux_sysvec.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 3681dc881485..fea1e274ac95 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -166,6 +166,9 @@ linux_fetch_syscall_args(struct thread *td) else sa->callp = &p->p_sysent->sv_table[sa->code]; + /* Restore r10 earlier to avoid doing this multiply times. */ + frame->tf_r10 = frame->tf_rcx; + td->td_retval[0] = 0; return (0); } @@ -180,7 +183,6 @@ linux_set_syscall_retval(struct thread *td, int error) switch (error) { case 0: frame->tf_rax = td->td_retval[0]; - frame->tf_r10 = frame->tf_rcx; break; case ERESTART: @@ -191,7 +193,6 @@ linux_set_syscall_retval(struct thread *td, int error) * */ frame->tf_rip -= frame->tf_err; - frame->tf_r10 = frame->tf_rcx; break; case EJUSTRETURN: @@ -199,7 +200,6 @@ linux_set_syscall_retval(struct thread *td, int error) default: frame->tf_rax = bsd_to_linux_errno(error); - frame->tf_r10 = frame->tf_rcx; break; } |