diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2018-09-20 13:29:43 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2018-09-20 13:29:43 +0000 |
commit | a286a3099c87bf015063bac0f10cec70b261fac7 (patch) | |
tree | ae6574a79e8f6e149750ed6a78adad5c5bae99c9 /sys/amd64/amd64/support.S | |
parent | 482a81508c58f007bdb67a36c151a17c52ff1991 (diff) | |
download | src-a286a3099c87bf015063bac0f10cec70b261fac7.tar.gz src-a286a3099c87bf015063bac0f10cec70b261fac7.zip |
amd64: move fusufault after all users
A lot of function have the following check:
cmpq %rax,%rdi /* verify address is valid */
ja fusufault
The label is present earlier in kernel .text, which means this is a jump
backwards. Absent any information in branch predictor, the cpu predicts it
as taken. Since it is almost never taken in practice, this results in a
completely avoidable misprediction.
Move it past all consumers, so that it is predicted as not taken.
Approved by: re (kib)
Notes
Notes:
svn path=/head/; revision=338828
Diffstat (limited to 'sys/amd64/amd64/support.S')
-rw-r--r-- | sys/amd64/amd64/support.S | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index bc849b21d965..33ffec1ff5f9 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -755,16 +755,6 @@ ENTRY(fubyte_smap) ret END(fubyte_smap) - ALIGN_TEXT - /* Fault entry clears PSL.AC */ -fusufault: - movq PCPU(CURPCB),%rcx - xorl %eax,%eax - movq %rax,PCB_ONFAULT(%rcx) - decq %rax - POP_FRAME_POINTER - ret - /* * Store a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit byte to * user memory. @@ -916,6 +906,16 @@ ENTRY(subyte_smap) ret END(subyte_smap) + ALIGN_TEXT + /* Fault entry clears PSL.AC */ +fusufault: + movq PCPU(CURPCB),%rcx + xorl %eax,%eax + movq %rax,PCB_ONFAULT(%rcx) + decq %rax + POP_FRAME_POINTER + ret + /* * copyinstr(from, to, maxlen, int *lencopied) * %rdi, %rsi, %rdx, %rcx |