Merge tag 'mm-nonmm-stable-2024-05-19-11-56' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / arch / x86 / include / asm / ia32.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_IA32_H
3 #define _ASM_X86_IA32_H
4
5 #ifdef CONFIG_IA32_EMULATION
6
7 #include <linux/compat.h>
8
9 /*
10  * 32 bit structures for IA32 support.
11  */
12
13 #include <uapi/asm/sigcontext.h>
14
15 /* signal.h */
16
17 struct ucontext_ia32 {
18         unsigned int      uc_flags;
19         unsigned int      uc_link;
20         compat_stack_t    uc_stack;
21         struct sigcontext_32 uc_mcontext;
22         compat_sigset_t   uc_sigmask;   /* mask last for extensibility */
23 };
24
25 /* This matches struct stat64 in glibc2.2, hence the absolutely
26  * insane amounts of padding around dev_t's.
27  */
28 struct stat64 {
29         unsigned long long      st_dev;
30         unsigned char           __pad0[4];
31
32 #define STAT64_HAS_BROKEN_ST_INO        1
33         unsigned int            __st_ino;
34
35         unsigned int            st_mode;
36         unsigned int            st_nlink;
37
38         unsigned int            st_uid;
39         unsigned int            st_gid;
40
41         unsigned long long      st_rdev;
42         unsigned char           __pad3[4];
43
44         long long               st_size;
45         unsigned int            st_blksize;
46
47         long long               st_blocks;/* Number 512-byte blocks allocated */
48
49         unsigned                st_atime;
50         unsigned                st_atime_nsec;
51         unsigned                st_mtime;
52         unsigned                st_mtime_nsec;
53         unsigned                st_ctime;
54         unsigned                st_ctime_nsec;
55
56         unsigned long long      st_ino;
57 } __attribute__((packed));
58
59 extern bool __ia32_enabled;
60
61 static __always_inline bool ia32_enabled(void)
62 {
63         return __ia32_enabled;
64 }
65
66 static inline void ia32_disable(void)
67 {
68         __ia32_enabled = false;
69 }
70
71 #else /* !CONFIG_IA32_EMULATION */
72
73 static __always_inline bool ia32_enabled(void)
74 {
75         return IS_ENABLED(CONFIG_X86_32);
76 }
77
78 static inline void ia32_disable(void) {}
79
80 #endif
81
82 static inline bool ia32_enabled_verbose(void)
83 {
84         bool enabled = ia32_enabled();
85
86         if (IS_ENABLED(CONFIG_IA32_EMULATION) && !enabled)
87                 pr_notice_once("32-bit emulation disabled. You can reenable with ia32_emulation=on\n");
88
89         return enabled;
90 }
91
92 #endif /* _ASM_X86_IA32_H */