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/cddl/dev/dtrace/powerpc/dtrace_asm.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  * CDDL HEADER START
    3  *
    4  * The contents of this file are subject to the terms of the
    5  * Common Development and Distribution License, Version 1.0 only
    6  * (the "License").  You may not use this file except in compliance
    7  * with the License.
    8  *
    9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   10  * or http://www.opensolaris.org/os/licensing.
   11  * See the License for the specific language governing permissions
   12  * and limitations under the License.
   13  *
   14  * When distributing Covered Code, include this CDDL HEADER in each
   15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
   16  * If applicable, add the following below this CDDL HEADER, with the
   17  * fields enclosed by brackets "[]" replaced with your own identifying
   18  * information: Portions Copyright [yyyy] [name of copyright owner]
   19  *
   20  * CDDL HEADER END
   21  *
   22  * Portions Copyright 2012,2013 Justin Hibbits <jhibbits@freebsd.org>
   23  *
   24  * $FreeBSD$
   25  */
   26 /*
   27  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
   28  * Use is subject to license terms.
   29  */
   30 
   31 #include "assym.inc"
   32 
   33 #define _ASM
   34 
   35 #include <sys/cpuvar_defs.h>
   36 #include <sys/dtrace.h>
   37 
   38 #include <machine/asm.h>
   39 /*
   40 #include <machine/cpu.h>
   41 */
   42 
   43 /*
   44  * Primitives
   45  */
   46 
   47         .text
   48 
   49 /*
   50 void dtrace_membar_producer(void)
   51 */
   52 ASENTRY_NOPROF(dtrace_membar_producer)
   53         sync
   54         blr
   55 END(dtrace_membar_producer)
   56 
   57 /*
   58 void dtrace_membar_consumer(void)
   59 */
   60 ASENTRY_NOPROF(dtrace_membar_consumer)
   61         isync
   62         blr
   63 END(dtrace_membar_consumer)
   64 
   65 /*
   66 dtrace_icookie_t dtrace_interrupt_disable(void)
   67 */
   68 ASENTRY_NOPROF(dtrace_interrupt_disable)
   69         mfmsr   %r3
   70 #ifdef __powerpc64__
   71         /* Two-instruction sequence to clear EE flag */
   72         rldicl  %r0,%r3,48,1
   73         rotldi  %r0,%r0,16
   74 #else
   75         rlwinm  %r0,%r3,0,17,15 /* Clear EE flag */
   76 #endif
   77         mtmsr   %r0
   78         blr
   79 END(dtrace_interrupt_disable)
   80 
   81 /*
   82 void dtrace_interrupt_enable(dtrace_icookie_t cookie)
   83 */
   84 ASENTRY_NOPROF(dtrace_interrupt_enable)
   85         mtmsr   %r3
   86         blr
   87 END(dtrace_interrupt_enable)
   88 
   89 /*
   90 uint32_t dtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new)
   91 */
   92 ASENTRY_NOPROF(dtrace_cas32)
   93 1:
   94         lwarx   %r0,0,%r3
   95         cmpw    %r4,%r0
   96         bne     2f
   97         stwcx.  %r5,0,%r3
   98         bne     1b
   99 2:      mr      %r3,%r0
  100         blr
  101 END(dtrace_cas32)
  102 
  103 /*
  104 void *
  105 dtrace_casptr(void *target, void *cmp, void *new)
  106 */
  107 ASENTRY_NOPROF(dtrace_casptr)
  108 #ifdef __powerpc64__
  109 1:
  110         ldarx   %r0,0,%r3
  111         cmpd    %r4,%r0
  112         bne     2f
  113         stdcx.  %r5,0,%r3
  114         bne     1b
  115 #else
  116 1:
  117         lwarx   %r0,0,%r3
  118         cmpw    %r4,%r0
  119         bne     2f
  120         stwcx.  %r5,0,%r3
  121         bne     1b
  122 #endif
  123 2:      mr      %r3,%r0
  124         blr
  125 END(dtrace_casptr)
  126 
  127 
  128 /*
  129 XXX: unoptimized
  130 void
  131 dtrace_copy(uintptr_t src, uintptr_t dest, size_t size)
  132 */
  133 ASENTRY_NOPROF(dtrace_copy)
  134         subi    %r7,%r3,1
  135         subi    %r8,%r4,1
  136         mtctr   %r5
  137 1:
  138         lbzu    %r3,1(%r7)
  139         stbu    %r3,1(%r8)
  140         bdnz    1b
  141 2:
  142         blr
  143 END(dtrace_copy)
  144 
  145 /*
  146 void
  147 dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
  148     volatile uint16_t *flags)
  149 */
  150 ASENTRY_NOPROF(dtrace_copystr)
  151         subi    %r7,%r3,1
  152         subi    %r8,%r4,1
  153 1:
  154         lbzu    %r3,1(%r7)
  155         stbu    %r3,1(%r8)
  156         subi    %r5,%r5,1
  157 #ifdef __powerpc64__
  158         cmpldi  %r5,0
  159 #else
  160         cmplwi  %r5,0
  161 #endif
  162         beq     2f
  163         cmplwi  %r3,0
  164         beq     2f
  165         andi.   %r0,%r5,0x0fff
  166         beq     2f
  167         lwz     %r0,0(%r6)
  168         andi.   %r0,%r0,CPU_DTRACE_BADADDR
  169         beq     1b
  170 2:
  171         blr
  172 END(dtrace_copystr)
  173 
  174 /*
  175 uintptr_t
  176 dtrace_caller(int aframes)
  177 */
  178 ASENTRY_NOPROF(dtrace_caller)
  179         li      %r3, -1
  180         blr
  181 END(dtrace_caller)
  182 
  183 /*
  184 greg_t
  185 dtrace_getfp(void)
  186 */
  187 ASENTRY_NOPROF(dtrace_getfp)
  188         mr      %r3,%r31
  189         blr
  190 END(dtrace_getfp)
  191 

Cache object: f5150c30704857f53aece012b95930aa


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