mirror of
https://github.com/torvalds/linux.git
synced 2024-12-05 18:41:23 +00:00
9297e602ad
The asm to read and write EFLAGS from userspace is horrible. The compiler builtins are now available on all supported compilers, so use them instead. (The compiler builtins are also unnecessarily ugly, but that's a more manageable level of ugliness.) Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lkml.kernel.org/r/aee4b1cdfc56083eb779ce927b7d3459aad2af76.1604346818.git.luto@kernel.org
26 lines
516 B
C
26 lines
516 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
#ifndef __SELFTESTS_X86_HELPERS_H
|
|
#define __SELFTESTS_X86_HELPERS_H
|
|
|
|
#include <asm/processor-flags.h>
|
|
|
|
static inline unsigned long get_eflags(void)
|
|
{
|
|
#ifdef __x86_64__
|
|
return __builtin_ia32_readeflags_u64();
|
|
#else
|
|
return __builtin_ia32_readeflags_u32();
|
|
#endif
|
|
}
|
|
|
|
static inline void set_eflags(unsigned long eflags)
|
|
{
|
|
#ifdef __x86_64__
|
|
__builtin_ia32_writeeflags_u64(eflags);
|
|
#else
|
|
__builtin_ia32_writeeflags_u32(eflags);
|
|
#endif
|
|
}
|
|
|
|
#endif /* __SELFTESTS_X86_HELPERS_H */
|