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