Module Name: src Committed By: riastradh Date: Sun Dec 19 01:18:39 UTC 2021
Modified Files: src/sys/external/bsd/drm2/include/asm: cpufeature.h Log Message: Define x86 static_cpu_has(X86_FEATURE_CLFLUSH), clflush. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/asm/cpufeature.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/external/bsd/drm2/include/asm/cpufeature.h diff -u src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.5 src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.6 --- src/sys/external/bsd/drm2/include/asm/cpufeature.h:1.5 Sat Sep 5 07:45:44 2020 +++ src/sys/external/bsd/drm2/include/asm/cpufeature.h Sun Dec 19 01:18:39 2021 @@ -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_ */