xref: /illumos-gate/usr/src/uts/sparc/asm/flush.h (revision 5c7544f740a475b813dfbc871b7c965e54df7989)
12b616c6cSwesolows /*
22b616c6cSwesolows  * CDDL HEADER START
32b616c6cSwesolows  *
42b616c6cSwesolows  * The contents of this file are subject to the terms of the
52b616c6cSwesolows  * Common Development and Distribution License (the "License").
62b616c6cSwesolows  * You may not use this file except in compliance with the License.
72b616c6cSwesolows  *
82b616c6cSwesolows  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
92b616c6cSwesolows  * or http://www.opensolaris.org/os/licensing.
102b616c6cSwesolows  * See the License for the specific language governing permissions
112b616c6cSwesolows  * and limitations under the License.
122b616c6cSwesolows  *
132b616c6cSwesolows  * When distributing Covered Code, include this CDDL HEADER in each
142b616c6cSwesolows  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
152b616c6cSwesolows  * If applicable, add the following below this CDDL HEADER, with the
162b616c6cSwesolows  * fields enclosed by brackets "[]" replaced with your own identifying
172b616c6cSwesolows  * information: Portions Copyright [yyyy] [name of copyright owner]
182b616c6cSwesolows  *
192b616c6cSwesolows  * CDDL HEADER END
202b616c6cSwesolows  */
212b616c6cSwesolows 
222b616c6cSwesolows /*
23*5c7544f7SDavid Plauger  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
242b616c6cSwesolows  * Use is subject to license terms.
252b616c6cSwesolows  */
262b616c6cSwesolows 
272b616c6cSwesolows #ifndef _ASM_FLUSH_H
282b616c6cSwesolows #define	_ASM_FLUSH_H
292b616c6cSwesolows 
302b616c6cSwesolows #include <sys/types.h>
312b616c6cSwesolows 
322b616c6cSwesolows #ifdef	__cplusplus
332b616c6cSwesolows extern "C" {
342b616c6cSwesolows #endif
352b616c6cSwesolows 
362b616c6cSwesolows #if !defined(__lint) && defined(__GNUC__)
372b616c6cSwesolows 
382b616c6cSwesolows extern __inline__ void
392b616c6cSwesolows doflush(void *addr)
402b616c6cSwesolows {
412b616c6cSwesolows #if defined(__sparcv9)
422b616c6cSwesolows 	__asm__ __volatile__(
432b616c6cSwesolows 	    "andn	%0, 3, %0\n\t"
442b616c6cSwesolows 	    "flush	%0\n\t"
452b616c6cSwesolows 	    : "=r" (addr)
462b616c6cSwesolows 	    : "0" (addr));
472b616c6cSwesolows #else
482b616c6cSwesolows #error	"port me"
492b616c6cSwesolows #endif
502b616c6cSwesolows }
512b616c6cSwesolows 
522b616c6cSwesolows #endif	/* !__lint && __GNUC__ */
532b616c6cSwesolows 
54*5c7544f7SDavid Plauger #if !defined(__lint) && defined(__GNUC__)
55*5c7544f7SDavid Plauger 
56*5c7544f7SDavid Plauger extern __inline__ void
57*5c7544f7SDavid Plauger prefetch64(caddr_t addr)
58*5c7544f7SDavid Plauger {
59*5c7544f7SDavid Plauger #if defined(__sparcv9)
60*5c7544f7SDavid Plauger 	__asm__ __volatile__(
61*5c7544f7SDavid Plauger 	    "prefetch	[%0], #n_writes\n\t"
62*5c7544f7SDavid Plauger 	    : /* no output */
63*5c7544f7SDavid Plauger 	    : "0" (addr));
64*5c7544f7SDavid Plauger #else
65*5c7544f7SDavid Plauger #error	"port me"
66*5c7544f7SDavid Plauger #endif
67*5c7544f7SDavid Plauger }
68*5c7544f7SDavid Plauger 
69*5c7544f7SDavid Plauger #endif	/* !__lint && __GNUC__ */
70*5c7544f7SDavid Plauger 
712b616c6cSwesolows #ifdef	__cplusplus
722b616c6cSwesolows }
732b616c6cSwesolows #endif
742b616c6cSwesolows 
752b616c6cSwesolows #endif	/* _ASM_FLUSH_H */
76