Author: andrew Date: Mon Jun 25 22:36:25 2018 New Revision: 335649 URL: https://svnweb.freebsd.org/changeset/base/335649
Log: Make cpu_set_syscall_retval common between the existing FreeBSD ABI and the Linuxulator. We need to translate error values onto Linux errno values and return them to userspace when a syscall fails. We also need to preserve x1 as all registers are preserved other than the return value. Reviewed by: emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D16008 Modified: head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/linux/linux_sysvec.c Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Mon Jun 25 22:05:33 2018 (r335648) +++ head/sys/arm64/arm64/vm_machdep.c Mon Jun 25 22:36:25 2018 (r335649) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/sf_buf.h> #include <sys/signal.h> +#include <sys/sysent.h> #include <sys/unistd.h> #include <vm/vm.h> @@ -154,7 +155,7 @@ cpu_set_syscall_retval(struct thread *td, int error) break; default: frame->tf_spsr |= PSR_C; /* carry bit */ - frame->tf_x[0] = error; + frame->tf_x[0] = SV_ABI_ERRNO(td->td_proc, error); break; } } Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Mon Jun 25 22:05:33 2018 (r335648) +++ head/sys/arm64/linux/linux_sysvec.c Mon Jun 25 22:36:25 2018 (r335649) @@ -143,25 +143,9 @@ linux_fetch_syscall_args(struct thread *td) static void linux_set_syscall_retval(struct thread *td, int error) { - struct trapframe *frame; - frame = td->td_frame; - - switch (error) { - case 0: - frame->tf_x[0] = td->td_retval[0]; - frame->tf_x[1] = td->td_retval[1]; - break; - case ERESTART: - /* LINUXTODO: verify */ - frame->tf_elr -= 4; - break; - case EJUSTRETURN: - break; - default: - frame->tf_x[0] = error; - break; - } + td->td_retval[1] = td->td_frame->tf_x[1]; + cpu_set_syscall_retval(td, error); } static int _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"