commit d1edce71135cc6d98c0a4b5729774542b676e769 Author: sophgo-forum-service <forum_service@sophgo.com> Date: Fri Mar 15 16:07:33 2024 +0800 [fix] recommend using ssh method to clone repo. [fix] fix sensor driver repo branch name.
42 lines
705 B
C
42 lines
705 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)
|
|
{
|
|
unsigned long eflags;
|
|
|
|
asm volatile (
|
|
#ifdef __x86_64__
|
|
"subq $128, %%rsp\n\t"
|
|
"pushfq\n\t"
|
|
"popq %0\n\t"
|
|
"addq $128, %%rsp"
|
|
#else
|
|
"pushfl\n\t"
|
|
"popl %0"
|
|
#endif
|
|
: "=r" (eflags) :: "memory");
|
|
|
|
return eflags;
|
|
}
|
|
|
|
static inline void set_eflags(unsigned long eflags)
|
|
{
|
|
asm volatile (
|
|
#ifdef __x86_64__
|
|
"subq $128, %%rsp\n\t"
|
|
"pushq %0\n\t"
|
|
"popfq\n\t"
|
|
"addq $128, %%rsp"
|
|
#else
|
|
"pushl %0\n\t"
|
|
"popfl"
|
|
#endif
|
|
:: "r" (eflags) : "flags", "memory");
|
|
}
|
|
|
|
#endif /* __SELFTESTS_X86_HELPERS_H */
|