thread_info.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * Based on arch/arm/include/asm/thread_info.h
  3. *
  4. * Copyright (C) 2002 Russell King.
  5. * Copyright (C) 2012 ARM Ltd.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __ASM_THREAD_INFO_H
  20. #define __ASM_THREAD_INFO_H
  21. #ifdef __KERNEL__
  22. #include <linux/compiler.h>
  23. #ifndef __ASSEMBLY__
  24. struct task_struct;
  25. #include <asm/memory.h>
  26. #include <asm/stack_pointer.h>
  27. #include <asm/types.h>
  28. typedef unsigned long mm_segment_t;
  29. /*
  30. * low level task data that entry.S needs immediate access to.
  31. */
  32. struct thread_info {
  33. unsigned long flags; /* low level flags */
  34. mm_segment_t addr_limit; /* address limit */
  35. #ifdef CONFIG_ARM64_SW_TTBR0_PAN
  36. u64 ttbr0; /* saved TTBR0_EL1 */
  37. #endif
  38. int preempt_count; /* 0 => preemptable, <0 => bug */
  39. };
  40. #define INIT_THREAD_INFO(tsk) \
  41. { \
  42. .preempt_count = INIT_PREEMPT_COUNT, \
  43. .addr_limit = KERNEL_DS, \
  44. }
  45. #define thread_saved_pc(tsk) \
  46. ((unsigned long)(tsk->thread.cpu_context.pc))
  47. #define thread_saved_sp(tsk) \
  48. ((unsigned long)(tsk->thread.cpu_context.sp))
  49. #define thread_saved_fp(tsk) \
  50. ((unsigned long)(tsk->thread.cpu_context.fp))
  51. void arch_setup_new_exec(void);
  52. #define arch_setup_new_exec arch_setup_new_exec
  53. void arch_release_task_struct(struct task_struct *tsk);
  54. #endif
  55. /*
  56. * thread information flags:
  57. * TIF_SYSCALL_TRACE - syscall trace active
  58. * TIF_SYSCALL_TRACEPOINT - syscall tracepoint for ftrace
  59. * TIF_SYSCALL_AUDIT - syscall auditing
  60. * TIF_SECOMP - syscall secure computing
  61. * TIF_SIGPENDING - signal pending
  62. * TIF_NEED_RESCHED - rescheduling necessary
  63. * TIF_NOTIFY_RESUME - callback before returning to user
  64. * TIF_USEDFPU - FPU was used by this task this quantum (SMP)
  65. */
  66. #define TIF_SIGPENDING 0
  67. #define TIF_NEED_RESCHED 1
  68. #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
  69. #define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */
  70. #define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */
  71. #define TIF_FSCHECK 5 /* Check FS is USER_DS on return */
  72. #define TIF_NOHZ 7
  73. #define TIF_SYSCALL_TRACE 8
  74. #define TIF_SYSCALL_AUDIT 9
  75. #define TIF_SYSCALL_TRACEPOINT 10
  76. #define TIF_SECCOMP 11
  77. #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
  78. #define TIF_FREEZE 19
  79. #define TIF_RESTORE_SIGMASK 20
  80. #define TIF_SINGLESTEP 21
  81. #define TIF_32BIT 22 /* 32bit process */
  82. #define TIF_SVE 23 /* Scalable Vector Extension in use */
  83. #define TIF_SVE_VL_INHERIT 24 /* Inherit sve_vl_onexec across exec */
  84. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  85. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  86. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  87. #define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE)
  88. #define _TIF_NOHZ (1 << TIF_NOHZ)
  89. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  90. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  91. #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
  92. #define _TIF_SECCOMP (1 << TIF_SECCOMP)
  93. #define _TIF_UPROBE (1 << TIF_UPROBE)
  94. #define _TIF_FSCHECK (1 << TIF_FSCHECK)
  95. #define _TIF_32BIT (1 << TIF_32BIT)
  96. #define _TIF_SVE (1 << TIF_SVE)
  97. #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
  98. _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
  99. _TIF_UPROBE | _TIF_FSCHECK)
  100. #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
  101. _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
  102. _TIF_NOHZ)
  103. #endif /* __KERNEL__ */
  104. #endif /* __ASM_THREAD_INFO_H */