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/emulation/linux/i386/linux_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  * Copyright (c) 2006,2007 Konstantin Belousov
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 4. Neither the name of the University nor the names of its contributors
   14  *    may be used to endorse or promote products derived from this software
   15  *    without specific prior written permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * $FreeBSD$
   30  */
   31 
   32 #include "linux_assym.h"                /* system definitions */
   33 #include <machine/asmacros.h>           /* miscellaneous asm macros */
   34 #include <machine/cputypes.h>
   35 #include <machine/pmap.h>
   36 #include <machine/specialreg.h>
   37 
   38 #include "assym.s"
   39 
   40 /*
   41  * A stack-based on-fault routine is used for more complex PCB_ONFAULT
   42  * situations (such as memcpy/bcopy/bzero).  In this case the on-fault
   43  * routine must be pushed on the stack.
   44  */
   45 stack_onfault:
   46         ret
   47 
   48 futex_fault_decx:
   49         movl    PCPU(curthread),%ecx
   50         movl    TD_PCB(%ecx), %ecx
   51 futex_fault:
   52         movl    $0,PCB_ONFAULT(%ecx)
   53         movl    $EFAULT,%eax
   54         ret
   55 
   56 futex_fault_pop:
   57         addl    $4,%esp
   58         movl    $0,PCB_ONFAULT(%ecx)
   59         movl    $EFAULT,%eax
   60         ret
   61 
   62 ENTRY(futex_xchgl)
   63         movl    PCPU(curthread),%ecx
   64         movl    TD_PCB(%ecx),%ecx
   65         pushl   $futex_fault
   66         movl    $stack_onfault, PCB_ONFAULT(%ecx)
   67         movl    8(%esp),%eax
   68         movl    12(%esp),%edx
   69         cmpl    $VM_MAX_USER_ADDRESS-4,%edx
   70         ja      futex_fault_pop
   71         xchgl   %eax,(%edx)
   72         movl    16(%esp),%edx
   73         movl    %eax,(%edx)
   74         xorl    %eax,%eax
   75         movl    %eax,PCB_ONFAULT(%ecx)
   76         ret
   77 
   78 ENTRY(futex_addl)
   79         movl    PCPU(curthread),%ecx
   80         movl    TD_PCB(%ecx),%ecx
   81         pushl   $futex_fault
   82         movl    $stack_onfault,PCB_ONFAULT(%ecx)
   83         movl    8(%esp),%eax
   84         movl    12(%esp),%edx
   85         cmpl    $VM_MAX_USER_ADDRESS-4,%edx
   86         ja      futex_fault_pop
   87         lock
   88         xaddl   %eax,(%edx)
   89         movl    16(%esp),%edx
   90         movl    %eax,(%edx)
   91         xorl    %eax,%eax
   92         movl    %eax,PCB_ONFAULT(%ecx)
   93         ret
   94 
   95 ENTRY(futex_orl)
   96         movl    PCPU(curthread),%ecx
   97         movl    TD_PCB(%ecx),%ecx
   98         pushl   $futex_fault_decx
   99         movl    $stack_onfault,PCB_ONFAULT(%ecx)
  100         movl    12(%esp),%edx
  101         cmpl    $VM_MAX_USER_ADDRESS-4,%edx
  102         ja      futex_fault_pop
  103         movl    (%edx),%eax
  104 1:      movl    %eax,%ecx
  105         orl     8(%esp),%ecx
  106         lock
  107         cmpxchgl %ecx,(%edx)
  108         jnz     1b
  109 futex_tail:
  110         movl    16(%esp),%edx
  111         movl    %eax,(%edx)
  112         xorl    %eax,%eax
  113         movl    PCPU(curthread),%ecx
  114         movl    TD_PCB(%ecx),%ecx
  115         movl    %eax,PCB_ONFAULT(%ecx)
  116         ret
  117 
  118 ENTRY(futex_andl)
  119         movl    PCPU(curthread),%ecx
  120         movl    TD_PCB(%ecx),%ecx
  121         pushl   $futex_fault_decx
  122         movl    $stack_onfault,PCB_ONFAULT(%ecx)
  123         movl    12(%esp),%edx
  124         cmpl    $VM_MAX_USER_ADDRESS-4,%edx
  125         ja      futex_fault_pop
  126         movl    (%edx),%eax
  127 1:      movl    %eax,%ecx
  128         andl    8(%esp),%ecx
  129         lock
  130         cmpxchgl %ecx,(%edx)
  131         jnz     1b
  132         jmp     futex_tail
  133 
  134 ENTRY(futex_xorl)
  135         movl    PCPU(curthread),%ecx
  136         movl    TD_PCB(%ecx),%ecx
  137         pushl   $futex_fault_decx
  138         movl    $stack_onfault,PCB_ONFAULT(%ecx)
  139         movl    12(%esp),%edx
  140         cmpl    $VM_MAX_USER_ADDRESS-4,%edx
  141         ja      futex_fault_pop
  142         movl    (%edx),%eax
  143 1:      movl    %eax,%ecx
  144         xorl    8(%esp),%ecx
  145         lock
  146         cmpxchgl %ecx,(%edx)
  147         jnz     1b
  148         jmp     futex_tail

Cache object: 45578a5f81a4b6e0e3bcab03242f2ad9


[ 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.