The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/amd64/linux32/linux32_support.s

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2007 Konstantin Belousov
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   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.
   15  *
   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
   26  * SUCH DAMAGE.
   27  *
   28  * $FreeBSD$
   29  */
   30 
   31 #include "linux32_assym.h"              /* system definitions */
   32 #include <machine/asmacros.h>           /* miscellaneous asm macros */
   33 #include <machine/specialreg.h>
   34 
   35 #include "assym.inc"
   36 
   37 futex_fault:
   38         testl   $CPUID_STDEXT_SMAP,cpu_stdext_feature(%rip)
   39         je      1f
   40         clac
   41 1:      movq    $0,PCB_ONFAULT(%r8)
   42         movl    $-EFAULT,%eax
   43         ret
   44 
   45 ENTRY(futex_xchgl_nosmap)
   46         movq    PCPU(CURPCB),%r8
   47         movq    $futex_fault,PCB_ONFAULT(%r8)
   48         movq    $VM_MAXUSER_ADDRESS-4,%rax
   49         cmpq    %rax,%rsi
   50         ja      futex_fault
   51         xchgl   %edi,(%rsi)
   52         movl    %edi,(%rdx)
   53         xorl    %eax,%eax
   54         movq    %rax,PCB_ONFAULT(%r8)
   55         ret
   56 END(futex_xchgl_nosmap)
   57 
   58 ENTRY(futex_xchgl_smap)
   59         movq    PCPU(CURPCB),%r8
   60         movq    $futex_fault,PCB_ONFAULT(%r8)
   61         movq    $VM_MAXUSER_ADDRESS-4,%rax
   62         cmpq    %rax,%rsi
   63         ja      futex_fault
   64         stac
   65         xchgl   %edi,(%rsi)
   66         clac
   67         movl    %edi,(%rdx)
   68         xorl    %eax,%eax
   69         movq    %rax,PCB_ONFAULT(%r8)
   70         ret
   71 END(futex_xchgl_smap)
   72 
   73 ENTRY(futex_addl_nosmap)
   74         movq    PCPU(CURPCB),%r8
   75         movq    $futex_fault,PCB_ONFAULT(%r8)
   76         movq    $VM_MAXUSER_ADDRESS-4,%rax
   77         cmpq    %rax,%rsi
   78         ja      futex_fault
   79 #ifdef SMP
   80         lock
   81 #endif
   82         xaddl   %edi,(%rsi)
   83         movl    %edi,(%rdx)
   84         xorl    %eax,%eax
   85         movq    %rax,PCB_ONFAULT(%r8)
   86         ret
   87 END(futex_addl_nosmap)
   88 
   89 ENTRY(futex_addl_smap)
   90         movq    PCPU(CURPCB),%r8
   91         movq    $futex_fault,PCB_ONFAULT(%r8)
   92         movq    $VM_MAXUSER_ADDRESS-4,%rax
   93         cmpq    %rax,%rsi
   94         ja      futex_fault
   95         stac
   96 #ifdef SMP
   97         lock
   98 #endif
   99         xaddl   %edi,(%rsi)
  100         clac
  101         movl    %edi,(%rdx)
  102         xorl    %eax,%eax
  103         movq    %rax,PCB_ONFAULT(%r8)
  104         ret
  105 END(futex_addl_smap)
  106 
  107 ENTRY(futex_orl_nosmap)
  108         movq    PCPU(CURPCB),%r8
  109         movq    $futex_fault,PCB_ONFAULT(%r8)
  110         movq    $VM_MAXUSER_ADDRESS-4,%rax
  111         cmpq    %rax,%rsi
  112         ja      futex_fault
  113         movl    (%rsi),%eax
  114 1:      movl    %eax,%ecx
  115         orl     %edi,%ecx
  116 #ifdef SMP
  117         lock
  118 #endif
  119         cmpxchgl %ecx,(%rsi)
  120         jnz     1b
  121         movl    %eax,(%rdx)
  122         xorl    %eax,%eax
  123         movq    %rax,PCB_ONFAULT(%r8)
  124         ret
  125 END(futex_orl_nosmap)
  126 
  127 ENTRY(futex_orl_smap)
  128         movq    PCPU(CURPCB),%r8
  129         movq    $futex_fault,PCB_ONFAULT(%r8)
  130         movq    $VM_MAXUSER_ADDRESS-4,%rax
  131         cmpq    %rax,%rsi
  132         ja      futex_fault
  133         stac
  134         movl    (%rsi),%eax
  135 1:      movl    %eax,%ecx
  136         orl     %edi,%ecx
  137 #ifdef SMP
  138         lock
  139 #endif
  140         cmpxchgl %ecx,(%rsi)
  141         jnz     1b
  142         clac
  143         movl    %eax,(%rdx)
  144         xorl    %eax,%eax
  145         movq    %rax,PCB_ONFAULT(%r8)
  146         ret
  147 END(futex_orl_smap)
  148 
  149 ENTRY(futex_andl_nosmap)
  150         movq    PCPU(CURPCB),%r8
  151         movq    $futex_fault,PCB_ONFAULT(%r8)
  152         movq    $VM_MAXUSER_ADDRESS-4,%rax
  153         cmpq    %rax,%rsi
  154         ja      futex_fault
  155         movl    (%rsi),%eax
  156 1:      movl    %eax,%ecx
  157         andl    %edi,%ecx
  158 #ifdef SMP
  159         lock
  160 #endif
  161         cmpxchgl %ecx,(%rsi)
  162         jnz     1b
  163         movl    %eax,(%rdx)
  164         xorl    %eax,%eax
  165         movq    %rax,PCB_ONFAULT(%r8)
  166         ret
  167 END(futex_andl_nosmap)
  168 
  169 ENTRY(futex_andl_smap)
  170         movq    PCPU(CURPCB),%r8
  171         movq    $futex_fault,PCB_ONFAULT(%r8)
  172         movq    $VM_MAXUSER_ADDRESS-4,%rax
  173         cmpq    %rax,%rsi
  174         ja      futex_fault
  175         stac
  176         movl    (%rsi),%eax
  177 1:      movl    %eax,%ecx
  178         andl    %edi,%ecx
  179 #ifdef SMP
  180         lock
  181 #endif
  182         cmpxchgl %ecx,(%rsi)
  183         jnz     1b
  184         clac
  185         movl    %eax,(%rdx)
  186         xorl    %eax,%eax
  187         movq    %rax,PCB_ONFAULT(%r8)
  188         ret
  189 END(futex_andl_smap)
  190 
  191 ENTRY(futex_xorl_nosmap)
  192         movq    PCPU(CURPCB),%r8
  193         movq    $futex_fault,PCB_ONFAULT(%r8)
  194         movq    $VM_MAXUSER_ADDRESS-4,%rax
  195         cmpq    %rax,%rsi
  196         ja      futex_fault
  197         movl    (%rsi),%eax
  198 1:      movl    %eax,%ecx
  199         xorl    %edi,%ecx
  200 #ifdef SMP
  201         lock
  202 #endif
  203         cmpxchgl %ecx,(%rsi)
  204         jnz     1b
  205         movl    %eax,(%rdx)
  206         xorl    %eax,%eax
  207         movq    %rax,PCB_ONFAULT(%r8)
  208         ret
  209 END(futex_xorl_nosmap)
  210 
  211 ENTRY(futex_xorl_smap)
  212         movq    PCPU(CURPCB),%r8
  213         movq    $futex_fault,PCB_ONFAULT(%r8)
  214         movq    $VM_MAXUSER_ADDRESS-4,%rax
  215         cmpq    %rax,%rsi
  216         ja      futex_fault
  217         stac
  218         movl    (%rsi),%eax
  219 1:      movl    %eax,%ecx
  220         xorl    %edi,%ecx
  221 #ifdef SMP
  222         lock
  223 #endif
  224         cmpxchgl %ecx,(%rsi)
  225         jnz     1b
  226         clac
  227         movl    %eax,(%rdx)
  228         xorl    %eax,%eax
  229         movq    %rax,PCB_ONFAULT(%r8)
  230         ret
  231 END(futex_xorl_smap)

Cache object: d99c21324e6061f33ec67c8ba00ad8be


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.