Home | History | Annotate | Line # | Download | only in include
bwx.h revision 1.1
      1 /* $NetBSD: bwx.h,v 1.1 1999/12/02 19:41:40 thorpej Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  * NASA Ames Research Center.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  * 3. All advertising materials mentioning features or use of this software
     20  *    must display the following acknowledgement:
     21  *	This product includes software developed by the NetBSD
     22  *	Foundation, Inc. and its contributors.
     23  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  *    contributors may be used to endorse or promote products derived
     25  *    from this software without specific prior written permission.
     26  *
     27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  * POSSIBILITY OF SUCH DAMAGE.
     38  */
     39 
     40 #ifndef _ALPHA_BWX_H_
     41 #define	_ALPHA_BWX_H_
     42 
     43 /*
     44  * Alpha Byte/Word Extension instructions.
     45  *
     46  * These instructions are available on EV56 (21164A) and later processors.
     47  *
     48  * See "Alpha Architecture Handbook, Version 3", DEC order number EC-QD2KB-TE.
     49  */
     50 
     51 static __inline u_int8_t alpha_ldbu __P((__volatile u_int8_t *))
     52 	__attribute__((__unused__));
     53 static __inline u_int16_t alpha_ldwu __P((__volatile u_int16_t *))
     54 	__attribute__((__unused__));
     55 static __inline void alpha_stb __P((__volatile u_int8_t *, u_int8_t))
     56 	__attribute__((__unused__));
     57 static __inline void alpha_stw __P((__volatile u_int16_t *, u_int16_t))
     58 	__attribute__((__unused__));
     59 static __inline u_int8_t alpha_sextb __P((u_int8_t))
     60 	__attribute__((__unused__));
     61 static __inline u_int16_t alpha_sextw __P((u_int16_t))
     62 	__attribute__((__unused__));
     63 
     64 static __inline u_int8_t
     65 alpha_ldbu(a0)
     66 	__volatile u_int8_t *a0;
     67 {
     68 	u_int8_t v0;
     69 
     70 	__asm __volatile("ldbu %0, %1"
     71 		: "=r" (v0)
     72 		: "m" (*a0));
     73 
     74 	return (v0);
     75 }
     76 
     77 static __inline u_int16_t
     78 alpha_ldwu(a0)
     79 	__volatile u_int16_t *a0;
     80 {
     81 	u_int16_t v0;
     82 
     83 	__asm __volatile("ldwu %0, %1"
     84 		: "=r" (v0)
     85 		: "m" (*a0));
     86 
     87 	return (v0);
     88 }
     89 
     90 static __inline void
     91 alpha_stb(a0, a1)
     92 	__volatile u_int8_t *a0;
     93 	u_int8_t a1;
     94 {
     95 
     96 	__asm __volatile("stb %1, %0"
     97 		: "=m" (*a0)
     98 		: "r" (a1));
     99 }
    100 
    101 static __inline void
    102 alpha_stw(a0, a1)
    103 	__volatile u_int16_t *a0;
    104 	u_int16_t a1;
    105 {
    106 
    107 	__asm __volatile("stw %1, %0"
    108 		: "=m" (*a0)
    109 		: "r" (a1));
    110 }
    111 
    112 static __inline u_int8_t
    113 alpha_sextb(a0)
    114 	u_int8_t a0;
    115 {
    116 	u_int8_t v0;
    117 
    118 	__asm __volatile("sextb %1, %0"
    119 		: "=r" (v0)
    120 		: "r" (a0));
    121 
    122 	return (v0);
    123 }
    124 
    125 static __inline u_int16_t
    126 alpha_sextw(a0)
    127 	u_int16_t a0;
    128 {
    129 	u_int16_t v0;
    130 
    131 	__asm __volatile("sextw %1, %0"
    132 		: "=r" (v0)
    133 		: "r" (a0));
    134 
    135 	return (v0);
    136 }
    137 
    138 #endif /* _ALPHA_BWX_H_ */
    139