diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2018-05-04 04:05:07 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2018-05-04 04:05:07 +0000 |
commit | f0648bcc041dd862a217bc5c565fd80e8df4ddcf (patch) | |
tree | 7abe7406099390814a73fba8133b0253320877f4 /sys/amd64/amd64/trap.c | |
parent | a571c38536be64023a7753ccbf73acd8b7d774b8 (diff) | |
download | src-f0648bcc041dd862a217bc5c565fd80e8df4ddcf.tar.gz src-f0648bcc041dd862a217bc5c565fd80e8df4ddcf.zip |
amd64: get rid of the pessimized bcopy in syscall arg copy
The code was unnecessarily conditionally copying either 5 or 6 args.
It can blindly copy 6, which also means the size is known at compilation
time and the operation can be depessimized.
Note the entire syscall handling code is rather slow.
Tested on Skylake, sample result for getppid (calls/s):
without pti: 7310106 -> 10653569
with pti: 3304843 -> 4148306
Some syscalls (like read) did not note any difference, other have typically
very modest wins.
Notes
Notes:
svn path=/head/; revision=333241
Diffstat (limited to 'sys/amd64/amd64/trap.c')
-rw-r--r-- | sys/amd64/amd64/trap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 386eacfe0fbc..e651e411bb6f 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -908,7 +908,7 @@ cpu_fetch_syscall_args(struct thread *td) error = 0; argp = &frame->tf_rdi; argp += reg; - bcopy(argp, sa->args, sizeof(sa->args[0]) * regcnt); + bcopy(argp, sa->args, sizeof(sa->args[0]) * 6); if (sa->narg > regcnt) { KASSERT(params != NULL, ("copyin args with no params!")); error = copyin(params, &sa->args[regcnt], |