aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2021-02-08 10:46:29 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2021-02-08 10:46:47 +0000
commitfb8c2f743ab695f6004650b58bf96972e2535b20 (patch)
tree8a0025c37e8cafd33a2c0c24b99495acd642016f /sys
parent866c8b8d5ddb982c2b8139153a4ddfdb2aac3364 (diff)
downloadsrc-fb8c2f743ab695f6004650b58bf96972e2535b20.tar.gz
src-fb8c2f743ab695f6004650b58bf96972e2535b20.zip
arm64: optimize set_syscall_retval()
Microoptimize set_syscall_retval() for arm64 by predicting the return value to be zero. This is similar to what has been done for other architectures Reviewed By: emaste, mhorne Differential Revision: https://reviews.freebsd.org/D26991
Diffstat (limited to 'sys')
-rw-r--r--sys/arm64/arm64/vm_machdep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c
index 9e9b588c7db1..d4dd32caef06 100644
--- a/sys/arm64/arm64/vm_machdep.c
+++ b/sys/arm64/arm64/vm_machdep.c
@@ -143,12 +143,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_x[0] = td->td_retval[0];
frame->tf_x[1] = td->td_retval[1];
frame->tf_spsr &= ~PSR_C; /* carry bit */
- break;
+ return;
+ }
+
+ switch (error) {
case ERESTART:
frame->tf_elr -= 4;
break;