From 3212707a9ab549119ad0ad6441a07fe774c99f3b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 27 Jul 2023 20:29:28 +0300 Subject: use nifty variable argument count trick + Found it in newlib. This allows the compiler to more effectively optimize away unnecessary register operations. Applied to both kernel and init.c for a slight speed increase. I really should move init.c to some other repository though, the binary files are starting to get annoying --- common/uapi/dispatch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/uapi/dispatch.c') diff --git a/common/uapi/dispatch.c b/common/uapi/dispatch.c index d071db3..a9caa1e 100644 --- a/common/uapi/dispatch.c +++ b/common/uapi/dispatch.c @@ -23,7 +23,7 @@ SYSCALL_DEFINE0(noop)(struct tcb *t) { info("sys_noop\n"); - set_args(t, SYS_RET1(OK)); + set_args1(t, OK); } /** @@ -37,7 +37,7 @@ SYSCALL_DEFINE0(noop)(struct tcb *t) SYSCALL_DEFINE1(putch)(struct tcb *t, sys_arg_t a) { dbg("%c", (char)a); - set_args(t, SYS_RET1(OK)); + set_args1(t, OK); } void handle_syscall(sys_arg_t syscall, sys_arg_t a, sys_arg_t b, @@ -79,7 +79,7 @@ void handle_syscall(sys_arg_t syscall, sys_arg_t a, sys_arg_t b, default: error("Syscall %zu outside allowed range [0 - %i]\n", syscall, SYS_NUM - 1); - set_args(t, SYS_RET1(ERR_INVAL)); + set_args1(t, ERR_INVAL); }; if (check_canary(t)) { -- cgit v1.3