thread_info.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Based on arch/arm/include/asm/thread_info.h
  4. *
  5. * Copyright (C) 2002 Russell King.
  6. * Copyright (C) 2012 ARM Ltd.
  7. */
  8. #ifndef __ASM_THREAD_INFO_H
  9. #define __ASM_THREAD_INFO_H
  10. #include <linux/compiler.h>
  11. #ifndef __ASSEMBLY__
  12. struct task_struct;
  13. #include <asm/memory.h>
  14. #include <asm/stack_pointer.h>
  15. #include <asm/types.h>
  16. /*
  17. * low level task data that entry.S needs immediate access to.
  18. */
  19. struct thread_info {
  20. unsigned long flags; /* low level flags */
  21. #ifdef CONFIG_ARM64_SW_TTBR0_PAN
  22. u64 ttbr0; /* saved TTBR0_EL1 */
  23. #endif
  24. union {
  25. u64 preempt_count; /* 0 => preemptible, <0 => bug */
  26. struct {
  27. #ifdef CONFIG_CPU_BIG_ENDIAN
  28. u32 need_resched;
  29. u32 count;
  30. #else
  31. u32 count;
  32. u32 need_resched;
  33. #endif
  34. } preempt;
  35. };
  36. #ifdef CONFIG_SHADOW_CALL_STACK
  37. void *scs_base;
  38. void *scs_sp;
  39. #endif
  40. u32 cpu;
  41. };
  42. #define thread_saved_pc(tsk) \
  43. ((unsigned long)(tsk->thread.cpu_context.pc))
  44. #define thread_saved_sp(tsk) \
  45. ((unsigned long)(tsk->thread.cpu_context.sp))
  46. #define thread_saved_fp(tsk) \
  47. ((unsigned long)(tsk->thread.cpu_context.fp))
  48. void arch_setup_new_exec(void);
  49. #define arch_setup_new_exec arch_setup_new_exec
  50. void arch_release_task_struct(struct task_struct *tsk);
  51. int arch_dup_task_struct(struct task_struct *dst,
  52. struct task_struct *src);
  53. #endif
  54. #define TIF_SIGPENDING 0 /* signal pending */
  55. #define TIF_NEED_RESCHED 1 /* rescheduling necessary */
  56. #define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
  57. #define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */
  58. #define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */
  59. #define TIF_MTE_ASYNC_FAULT 5 /* MTE Asynchronous Tag Check Fault */
  60. #define TIF_NOTIFY_SIGNAL 6 /* signal notifications exist */
  61. #define TIF_SYSCALL_TRACE 8 /* syscall trace active */
  62. #define TIF_SYSCALL_AUDIT 9 /* syscall auditing */
  63. #define TIF_SYSCALL_TRACEPOINT 10 /* syscall tracepoint for ftrace */
  64. #define TIF_SECCOMP 11 /* syscall secure computing */
  65. #define TIF_SYSCALL_EMU 12 /* syscall emulation active */
  66. #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
  67. #define TIF_FREEZE 19
  68. #define TIF_RESTORE_SIGMASK 20
  69. #define TIF_SINGLESTEP 21
  70. #define TIF_32BIT 22 /* 32bit process */
  71. #define TIF_SVE 23 /* Scalable Vector Extension in use */
  72. #define TIF_SVE_VL_INHERIT 24 /* Inherit SVE vl_onexec across exec */
  73. #define TIF_SSBD 25 /* Wants SSB mitigation */
  74. #define TIF_TAGGED_ADDR 26 /* Allow tagged user addresses */
  75. #define TIF_SME 27 /* SME in use */
  76. #define TIF_SME_VL_INHERIT 28 /* Inherit SME vl_onexec across exec */
  77. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  78. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  79. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  80. #define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE)
  81. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  82. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  83. #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
  84. #define _TIF_SECCOMP (1 << TIF_SECCOMP)
  85. #define _TIF_SYSCALL_EMU (1 << TIF_SYSCALL_EMU)
  86. #define _TIF_UPROBE (1 << TIF_UPROBE)
  87. #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
  88. #define _TIF_32BIT (1 << TIF_32BIT)
  89. #define _TIF_SVE (1 << TIF_SVE)
  90. #define _TIF_MTE_ASYNC_FAULT (1 << TIF_MTE_ASYNC_FAULT)
  91. #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
  92. #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
  93. _TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
  94. _TIF_UPROBE | _TIF_MTE_ASYNC_FAULT | \
  95. _TIF_NOTIFY_SIGNAL)
  96. #define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
  97. _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
  98. _TIF_SYSCALL_EMU)
  99. #ifdef CONFIG_SHADOW_CALL_STACK
  100. #define INIT_SCS \
  101. .scs_base = init_shadow_call_stack, \
  102. .scs_sp = init_shadow_call_stack,
  103. #else
  104. #define INIT_SCS
  105. #endif
  106. #define INIT_THREAD_INFO(tsk) \
  107. { \
  108. .flags = _TIF_FOREIGN_FPSTATE, \
  109. .preempt_count = INIT_PREEMPT_COUNT, \
  110. INIT_SCS \
  111. }
  112. #endif /* __ASM_THREAD_INFO_H */