Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/asm Define x86 static_cpu_has(...
details: https://anonhg.NetBSD.org/src/rev/82f8de4b2143
branches: trunk
changeset: 1027935:82f8de4b2143
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 01:18:39 2021 +0000
description:
Define x86 static_cpu_has(X86_FEATURE_CLFLUSH), clflush.
diffstat:
sys/external/bsd/drm2/include/asm/cpufeature.h | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
diffs (41 lines):
diff -r 669f6d512427 -r 82f8de4b2143 sys/external/bsd/drm2/include/asm/cpufeature.h
--- a/sys/external/bsd/drm2/include/asm/cpufeature.h Sun Dec 19 01:18:31 2021 +0000
+++ b/sys/external/bsd/drm2/include/asm/cpufeature.h Sun Dec 19 01:18:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufeature.h,v 1.5 2020/09/05 07:45:44 maxv Exp $ */
+/* $NetBSD: cpufeature.h,v 1.6 2021/12/19 01:18:39 riastradh Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,12 +39,31 @@
#define cpu_has_clflush ((cpu_info_primary.ci_feat_val[0] & CPUID_CLFSH) != 0)
#define cpu_has_pat ((cpu_info_primary.ci_feat_val[0] & CPUID_PAT) != 0)
+#define X86_FEATURE_CLFLUSH 0
+
+static inline bool
+static_cpu_has(int feature)
+{
+ switch (feature) {
+ case X86_FEATURE_CLFLUSH:
+ return cpu_has_clflush;
+ default:
+ return false;
+ }
+}
+
static inline size_t
cache_line_size(void)
{
return cpu_info_primary.ci_cflush_lsize;
}
+static inline void
+clflush(const void *p)
+{
+ asm volatile ("clflush %0" : : "m" (*(const char *)p));
+}
+
#endif /* x86 */
#endif /* _LINUX_ASM_CPUFEATURE_H_ */
Home |
Main Index |
Thread Index |
Old Index