1*22ce4affSfengbojiang /*-
2*22ce4affSfengbojiang * Copyright (c) 2016-2018 Netflix, Inc.
3*22ce4affSfengbojiang *
4*22ce4affSfengbojiang * Redistribution and use in source and binary forms, with or without
5*22ce4affSfengbojiang * modification, are permitted provided that the following conditions
6*22ce4affSfengbojiang * are met:
7*22ce4affSfengbojiang * 1. Redistributions of source code must retain the above copyright
8*22ce4affSfengbojiang * notice, this list of conditions and the following disclaimer.
9*22ce4affSfengbojiang * 2. Redistributions in binary form must reproduce the above copyright
10*22ce4affSfengbojiang * notice, this list of conditions and the following disclaimer in the
11*22ce4affSfengbojiang * documentation and/or other materials provided with the distribution.
12*22ce4affSfengbojiang *
13*22ce4affSfengbojiang * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14*22ce4affSfengbojiang * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*22ce4affSfengbojiang * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*22ce4affSfengbojiang * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17*22ce4affSfengbojiang * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*22ce4affSfengbojiang * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*22ce4affSfengbojiang * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*22ce4affSfengbojiang * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*22ce4affSfengbojiang * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*22ce4affSfengbojiang * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*22ce4affSfengbojiang * SUCH DAMAGE.
24*22ce4affSfengbojiang *
25*22ce4affSfengbojiang * $FreeBSD$
26*22ce4affSfengbojiang */
27*22ce4affSfengbojiang #ifndef __kern_prefetch_h__
28*22ce4affSfengbojiang #define __kern_prefetch_h__
29*22ce4affSfengbojiang #ifdef _KERNEL
30*22ce4affSfengbojiang
31*22ce4affSfengbojiang static __inline void
kern_prefetch(const volatile void * addr,void * before)32*22ce4affSfengbojiang kern_prefetch(const volatile void *addr, void* before)
33*22ce4affSfengbojiang {
34*22ce4affSfengbojiang #if defined(__amd64__)
35*22ce4affSfengbojiang __asm __volatile("prefetcht1 (%1)":"=rm"(*((int32_t *)before)):"r"(addr):);
36*22ce4affSfengbojiang #else
37*22ce4affSfengbojiang /* __builtin_prefetch(addr);*/
38*22ce4affSfengbojiang #endif
39*22ce4affSfengbojiang }
40*22ce4affSfengbojiang
41*22ce4affSfengbojiang #endif /* _KERNEL */
42*22ce4affSfengbojiang #endif /* __kern_prefetch_h__ */
43