x86/entry: Use generic syscall entry function
[linux-2.6-microblaze.git] / arch / x86 / include / asm / entry-common.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef _ASM_X86_ENTRY_COMMON_H
3 #define _ASM_X86_ENTRY_COMMON_H
4
5 /* Check that the stack and regs on entry from user mode are sane. */
6 static __always_inline void arch_check_user_regs(struct pt_regs *regs)
7 {
8         if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) {
9                 /*
10                  * Make sure that the entry code gave us a sensible EFLAGS
11                  * register.  Native because we want to check the actual CPU
12                  * state, not the interrupt state as imagined by Xen.
13                  */
14                 unsigned long flags = native_save_fl();
15                 WARN_ON_ONCE(flags & (X86_EFLAGS_AC | X86_EFLAGS_DF |
16                                       X86_EFLAGS_NT));
17
18                 /* We think we came from user mode. Make sure pt_regs agrees. */
19                 WARN_ON_ONCE(!user_mode(regs));
20
21                 /*
22                  * All entries from user mode (except #DF) should be on the
23                  * normal thread stack and should have user pt_regs in the
24                  * correct location.
25                  */
26                 WARN_ON_ONCE(!on_thread_stack());
27                 WARN_ON_ONCE(regs != task_pt_regs(current));
28         }
29 }
30 #define arch_check_user_regs arch_check_user_regs
31
32 #endif