Optimize set_syscall_retval for riscv by predicting the return

value to be zero.

Reviewed by:	mhorne, kp
MFC after:	2 weeks
Sponsored by:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D26990
This commit is contained in:
trasz 2020-10-29 15:36:20 +00:00
parent d4c9e71912
commit 97976aac34

View File

@ -132,12 +132,14 @@ cpu_set_syscall_retval(struct thread *td, int error)
frame = td->td_frame;
switch (error) {
case 0:
if (__predict_true(error == 0)) {
frame->tf_a[0] = td->td_retval[0];
frame->tf_a[1] = td->td_retval[1];
frame->tf_t[0] = 0; /* syscall succeeded */
break;
return;
}
switch (error) {
case ERESTART:
frame->tf_sepc -= 4; /* prev instruction */
break;