| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: processor.h,v 1.4 2021/05/31 10:33:04 riastradh Exp $ */ | | 1 | /* $NetBSD: processor.h,v 1.5 2021/12/19 01:39:34 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2013 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Taylor R. Campbell. | | 8 | * by Taylor R. Campbell. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -26,14 +26,23 @@ | | | @@ -26,14 +26,23 @@ |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #ifndef _ASM_PROCESSOR_H_ | | 32 | #ifndef _ASM_PROCESSOR_H_ |
33 | #define _ASM_PROCESSOR_H_ | | 33 | #define _ASM_PROCESSOR_H_ |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | | | 36 | |
37 | #define cpu_relax() DELAY(1) /* XXX */ | | 37 | #define cpu_relax() DELAY(1) /* XXX */ |
38 | | | 38 | |
| | | 39 | #if defined(__i386__) || defined(__x86_64__) |
| | | 40 | static inline void |
| | | 41 | clflushopt(void *p) |
| | | 42 | { |
| | | 43 | /* XXX Test CPUID bit, use CLFLUSHOPT... */ |
| | | 44 | asm volatile ("clflush %0" : : "m" (*(const char *)p)); |
| | | 45 | } |
| | | 46 | #endif |
| | | 47 | |
39 | #endif /* _ASM_PROCESSOR_H_ */ | | 48 | #endif /* _ASM_PROCESSOR_H_ */ |