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/sparc64/include/asmacros.h

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) 2001 Jake Burkholder.
    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  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/8.2/sys/sparc64/include/asmacros.h 205936 2010-03-30 20:46:10Z marius $
   27  */
   28 
   29 #ifndef _MACHINE_ASMACROS_H_
   30 #define _MACHINE_ASMACROS_H_
   31 
   32 #ifdef _KERNEL
   33 
   34 /*
   35  * Normal and alternate %g6 point to the pcb of the current process.  Normal,
   36  & alternate and interrupt %g7 point to per-cpu data.
   37  */
   38 #define PCB_REG         %g6
   39 #define PCPU_REG        %g7
   40 
   41 /*
   42  * Alternate %g5 points to a per-cpu panic stack, which is used as a last
   43  * resort, and for temporarily saving alternate globals.
   44  */
   45 #define ASP_REG         %g5
   46 
   47 #ifdef LOCORE
   48 
   49 /*
   50  * Atomically decrement an integer in memory.
   51  */
   52 #define ATOMIC_DEC_INT(r1, r2, r3) \
   53         lduw    [r1], r2 ; \
   54 9:      sub     r2, 1, r3 ; \
   55         casa    [r1] ASI_N, r2, r3 ; \
   56         cmp     r2, r3 ; \
   57         bne,pn  %icc, 9b ; \
   58          mov    r3, r2
   59 
   60 /*
   61  * Atomically increment an integer in memory.
   62  */
   63 #define ATOMIC_INC_INT(r1, r2, r3) \
   64         lduw    [r1], r2 ; \
   65 9:      add     r2, 1, r3 ; \
   66         casa    [r1] ASI_N, r2, r3 ; \
   67         cmp     r2, r3 ; \
   68         bne,pn  %icc, 9b ; \
   69          mov    r3, r2
   70 
   71 /*
   72  * Atomically increment an u_long in memory.
   73  */
   74 #define ATOMIC_INC_ULONG(r1, r2, r3) \
   75         ldx     [r1], r2 ; \
   76 9:      add     r2, 1, r3 ; \
   77         casxa   [r1] ASI_N, r2, r3 ; \
   78         cmp     r2, r3 ; \
   79         bne,pn  %icc, 9b ; \
   80          mov    r3, r2
   81 
   82 /*
   83  * Atomically clear a number of bits of an integer in memory.
   84  */
   85 #define ATOMIC_CLEAR_INT(r1, r2, r3, bits) \
   86         lduw    [r1], r2 ; \
   87 9:      andn    r2, bits, r3 ; \
   88         casa    [r1] ASI_N, r2, r3 ; \
   89         cmp     r2, r3 ; \
   90         bne,pn  %icc, 9b ; \
   91          mov    r3, r2
   92 
   93 #define PCPU(member)    PCPU_REG + PC_ ## member
   94 #define PCPU_ADDR(member, reg) \
   95         add     PCPU_REG, PC_ ## member, reg
   96 
   97 #define DEBUGGER() \
   98         ta      %xcc, 1
   99 
  100 #define PANIC(msg, r1) \
  101         .sect   .rodata ; \
  102 9:      .asciz  msg ; \
  103         .previous ; \
  104         SET(9b, r1, %o0) ; \
  105         call    panic ; \
  106          nop
  107 
  108 #ifdef INVARIANTS
  109 #define KASSERT(r1, msg) \
  110         brnz,pt r1, 8f ; \
  111          nop ; \
  112         PANIC(msg, r1) ; \
  113 8:
  114 #else
  115 #define KASSERT(r1, msg)
  116 #endif
  117 
  118 #define PUTS(msg, r1) \
  119         .sect   .rodata ; \
  120 9:      .asciz  msg ; \
  121         .previous ; \
  122         SET(9b, r1, %o0) ; \
  123         call    printf ; \
  124          nop
  125 
  126 #define _ALIGN_DATA     .align 8
  127 
  128 #define DATA(name) \
  129         .data ; \
  130         _ALIGN_DATA ; \
  131         .globl  name ; \
  132         .type   name, @object ; \
  133 name:
  134 
  135 #define EMPTY
  136 
  137 #endif /* LOCORE */
  138 
  139 #endif /* _KERNEL */
  140 
  141 #endif /* !_MACHINE_ASMACROS_H_ */

Cache object: d75aae0bd9a2027dfba011d0020e39ef


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