xref: /illumos-gate/usr/src/uts/sparc/asm/cpu.h (revision afab0816ecb604f0099a09ad8ee398f0d7b77b1c)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _ASM_CPU_H
28 #define	_ASM_CPU_H
29 
30 #include <sys/types.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #if !defined(__lint) && defined(__GNUC__)
37 
38 extern __inline__ void
39 prefetch_read_many(void *addr)
40 {
41 #if defined(__sparcv9)
42 	__asm__ __volatile__(
43 	    "prefetch	[%0],#n_reads\n\t"
44 	    : "=r" (addr)
45 	    : "0" (addr));
46 #else
47 #error	"port me"
48 #endif
49 }
50 
51 extern __inline__ void
52 prefetch_read_once(void *addr)
53 {
54 #if defined(__sparcv9)
55 	__asm__ __volatile__(
56 	    "prefetch	[%0],#one_read\n\t"
57 	    : "=r" (addr)
58 	    : "0" (addr));
59 #else
60 #error	"port me"
61 #endif
62 }
63 
64 extern __inline__ void
65 prefetch_write_many(void *addr)
66 {
67 #if defined(__sparcv9)
68 	__asm__ __volatile__(
69 	    "prefetch	[%0],#n_writes\n\t"
70 	    : "=r" (addr)
71 	    : "0" (addr));
72 #else
73 #error	"port me"
74 #endif
75 }
76 
77 extern __inline__ void
78 prefetch_write_once(void *addr)
79 {
80 #if defined(__sparcv9)
81 	__asm__ __volatile__(
82 	    "prefetch	[%0],#one_write\n\t"
83 	    : "=r" (addr)
84 	    : "0" (addr));
85 #else
86 #error	"port me"
87 #endif
88 }
89 
90 #endif	/* !__lint && __GNUC__ */
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _ASM_CPU_H */
97