aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/linux
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2021-06-23 17:42:12 +0200
committerBorislav Petkov <bp@suse.de>2021-06-23 17:43:38 +0200
commitc4cf5f61982e35348f522464010445efcc0aeb60 (patch)
treeb3e65bfae5786e33ac82b30d6801983b10934a2f /tools/include/linux
parentselftests/x86: Test signal frame XSTATE header corruption handling (diff)
parentx86/fpu: Make init_fpstate correct with optimized XSAVE (diff)
downloadlinux-dev-c4cf5f61982e35348f522464010445efcc0aeb60.tar.xz
linux-dev-c4cf5f61982e35348f522464010445efcc0aeb60.zip
Merge x86/urgent into x86/fpu
Pick up dependent changes which either went mainline (x86/urgent is based on -rc7 and that contains them) as urgent fixes and the current x86/urgent branch which contains two more urgent fixes, so that the bigger FPU rework can base off ontop. Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'tools/include/linux')
-rw-r--r--tools/include/linux/bits.h2
-rw-r--r--tools/include/linux/const.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/tools/include/linux/bits.h b/tools/include/linux/bits.h
index 7f475d59a097..87d112650dfb 100644
--- a/tools/include/linux/bits.h
+++ b/tools/include/linux/bits.h
@@ -22,7 +22,7 @@
#include <linux/build_bug.h>
#define GENMASK_INPUT_CHECK(h, l) \
(BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
- __builtin_constant_p((l) > (h)), (l) > (h), 0)))
+ __is_constexpr((l) > (h)), (l) > (h), 0)))
#else
/*
* BUILD_BUG_ON_ZERO is not available in h files included from asm files,
diff --git a/tools/include/linux/const.h b/tools/include/linux/const.h
index 81b8aae5a855..435ddd72d2c4 100644
--- a/tools/include/linux/const.h
+++ b/tools/include/linux/const.h
@@ -3,4 +3,12 @@
#include <vdso/const.h>
+/*
+ * This returns a constant expression while determining if an argument is
+ * a constant expression, most importantly without evaluating the argument.
+ * Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de>
+ */
+#define __is_constexpr(x) \
+ (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
+
#endif /* _LINUX_CONST_H */