Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 #ifndef __SELFTESTS_X86_HELPERS_H
0003 #define __SELFTESTS_X86_HELPERS_H
0004 
0005 #include <asm/processor-flags.h>
0006 
0007 static inline unsigned long get_eflags(void)
0008 {
0009 #ifdef __x86_64__
0010     return __builtin_ia32_readeflags_u64();
0011 #else
0012     return __builtin_ia32_readeflags_u32();
0013 #endif
0014 }
0015 
0016 static inline void set_eflags(unsigned long eflags)
0017 {
0018 #ifdef __x86_64__
0019     __builtin_ia32_writeeflags_u64(eflags);
0020 #else
0021     __builtin_ia32_writeeflags_u32(eflags);
0022 #endif
0023 }
0024 
0025 #endif /* __SELFTESTS_X86_HELPERS_H */