ia32.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_X86_IA32_H
  3. #define _ASM_X86_IA32_H
  4. #ifdef CONFIG_IA32_EMULATION
  5. #include <linux/compat.h>
  6. /*
  7. * 32 bit structures for IA32 support.
  8. */
  9. #include <uapi/asm/sigcontext.h>
  10. /* signal.h */
  11. struct ucontext_ia32 {
  12. unsigned int uc_flags;
  13. unsigned int uc_link;
  14. compat_stack_t uc_stack;
  15. struct sigcontext_32 uc_mcontext;
  16. compat_sigset_t uc_sigmask; /* mask last for extensibility */
  17. };
  18. /* This matches struct stat64 in glibc2.2, hence the absolutely
  19. * insane amounts of padding around dev_t's.
  20. */
  21. struct stat64 {
  22. unsigned long long st_dev;
  23. unsigned char __pad0[4];
  24. #define STAT64_HAS_BROKEN_ST_INO 1
  25. unsigned int __st_ino;
  26. unsigned int st_mode;
  27. unsigned int st_nlink;
  28. unsigned int st_uid;
  29. unsigned int st_gid;
  30. unsigned long long st_rdev;
  31. unsigned char __pad3[4];
  32. long long st_size;
  33. unsigned int st_blksize;
  34. long long st_blocks;/* Number 512-byte blocks allocated */
  35. unsigned st_atime;
  36. unsigned st_atime_nsec;
  37. unsigned st_mtime;
  38. unsigned st_mtime_nsec;
  39. unsigned st_ctime;
  40. unsigned st_ctime_nsec;
  41. unsigned long long st_ino;
  42. } __attribute__((packed));
  43. #define IA32_STACK_TOP IA32_PAGE_OFFSET
  44. #ifdef __KERNEL__
  45. struct linux_binprm;
  46. extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
  47. unsigned long stack_top, int exec_stack);
  48. struct mm_struct;
  49. extern void ia32_pick_mmap_layout(struct mm_struct *mm);
  50. #endif
  51. extern bool __ia32_enabled;
  52. static inline bool ia32_enabled(void)
  53. {
  54. return __ia32_enabled;
  55. }
  56. static inline void ia32_disable(void)
  57. {
  58. __ia32_enabled = false;
  59. }
  60. #else /* !CONFIG_IA32_EMULATION */
  61. static inline bool ia32_enabled(void)
  62. {
  63. return IS_ENABLED(CONFIG_X86_32);
  64. }
  65. static inline void ia32_disable(void) {}
  66. #endif
  67. #endif /* _ASM_X86_IA32_H */