2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2007 Konstantin Belousov
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include "linux32_assym.h" /* system definitions */
32 #include <machine/asmacros.h> /* miscellaneous asm macros */
33 #include <machine/specialreg.h>
38 testl $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip)
41 1: movq $0,PCB_ONFAULT(%r8)
45 ENTRY(futex_xchgl_nosmap)
47 movq $futex_fault,PCB_ONFAULT(%r8)
48 movq $VM_MAXUSER_ADDRESS-4,%rax
54 movq %rax,PCB_ONFAULT(%r8)
56 END(futex_xchgl_nosmap)
58 ENTRY(futex_xchgl_smap)
60 movq $futex_fault,PCB_ONFAULT(%r8)
61 movq $VM_MAXUSER_ADDRESS-4,%rax
69 movq %rax,PCB_ONFAULT(%r8)
73 ENTRY(futex_addl_nosmap)
75 movq $futex_fault,PCB_ONFAULT(%r8)
76 movq $VM_MAXUSER_ADDRESS-4,%rax
85 movq %rax,PCB_ONFAULT(%r8)
87 END(futex_addl_nosmap)
89 ENTRY(futex_addl_smap)
91 movq $futex_fault,PCB_ONFAULT(%r8)
92 movq $VM_MAXUSER_ADDRESS-4,%rax
103 movq %rax,PCB_ONFAULT(%r8)
107 ENTRY(futex_orl_nosmap)
108 movq PCPU(CURPCB),%r8
109 movq $futex_fault,PCB_ONFAULT(%r8)
110 movq $VM_MAXUSER_ADDRESS-4,%rax
123 movq %rax,PCB_ONFAULT(%r8)
125 END(futex_orl_nosmap)
127 ENTRY(futex_orl_smap)
128 movq PCPU(CURPCB),%r8
129 movq $futex_fault,PCB_ONFAULT(%r8)
130 movq $VM_MAXUSER_ADDRESS-4,%rax
145 movq %rax,PCB_ONFAULT(%r8)
149 ENTRY(futex_andl_nosmap)
150 movq PCPU(CURPCB),%r8
151 movq $futex_fault,PCB_ONFAULT(%r8)
152 movq $VM_MAXUSER_ADDRESS-4,%rax
165 movq %rax,PCB_ONFAULT(%r8)
167 END(futex_andl_nosmap)
169 ENTRY(futex_andl_smap)
170 movq PCPU(CURPCB),%r8
171 movq $futex_fault,PCB_ONFAULT(%r8)
172 movq $VM_MAXUSER_ADDRESS-4,%rax
187 movq %rax,PCB_ONFAULT(%r8)
191 ENTRY(futex_xorl_nosmap)
192 movq PCPU(CURPCB),%r8
193 movq $futex_fault,PCB_ONFAULT(%r8)
194 movq $VM_MAXUSER_ADDRESS-4,%rax
207 movq %rax,PCB_ONFAULT(%r8)
209 END(futex_xorl_nosmap)
211 ENTRY(futex_xorl_smap)
212 movq PCPU(CURPCB),%r8
213 movq $futex_fault,PCB_ONFAULT(%r8)
214 movq $VM_MAXUSER_ADDRESS-4,%rax
229 movq %rax,PCB_ONFAULT(%r8)