thread_info.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
  4. */
  5. #ifndef __UM_THREAD_INFO_H
  6. #define __UM_THREAD_INFO_H
  7. #define THREAD_SIZE_ORDER CONFIG_KERNEL_STACK_ORDER
  8. #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
  9. #ifndef __ASSEMBLY__
  10. #include <asm/types.h>
  11. #include <asm/page.h>
  12. #include <asm/segment.h>
  13. #include <sysdep/ptrace_user.h>
  14. struct thread_info {
  15. struct task_struct *task; /* main task structure */
  16. unsigned long flags; /* low level flags */
  17. __u32 cpu; /* current CPU */
  18. int preempt_count; /* 0 => preemptable,
  19. <0 => BUG */
  20. struct thread_info *real_thread; /* Points to non-IRQ stack */
  21. unsigned long aux_fp_regs[FP_SIZE]; /* auxiliary fp_regs to save/restore
  22. them out-of-band */
  23. };
  24. #define INIT_THREAD_INFO(tsk) \
  25. { \
  26. .task = &tsk, \
  27. .flags = 0, \
  28. .cpu = 0, \
  29. .preempt_count = INIT_PREEMPT_COUNT, \
  30. .real_thread = NULL, \
  31. }
  32. /* how to get the thread information struct from C */
  33. static inline struct thread_info *current_thread_info(void)
  34. {
  35. struct thread_info *ti;
  36. unsigned long mask = THREAD_SIZE - 1;
  37. void *p;
  38. asm volatile ("" : "=r" (p) : "0" (&ti));
  39. ti = (struct thread_info *) (((unsigned long)p) & ~mask);
  40. return ti;
  41. }
  42. #endif
  43. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  44. #define TIF_SIGPENDING 1 /* signal pending */
  45. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  46. #define TIF_NOTIFY_SIGNAL 3 /* signal notifications exist */
  47. #define TIF_RESTART_BLOCK 4
  48. #define TIF_MEMDIE 5 /* is terminating due to OOM killer */
  49. #define TIF_SYSCALL_AUDIT 6
  50. #define TIF_RESTORE_SIGMASK 7
  51. #define TIF_NOTIFY_RESUME 8
  52. #define TIF_SECCOMP 9 /* secure computing */
  53. #define TIF_SINGLESTEP 10 /* single stepping userspace */
  54. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  55. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  56. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  57. #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
  58. #define _TIF_MEMDIE (1 << TIF_MEMDIE)
  59. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  60. #define _TIF_SECCOMP (1 << TIF_SECCOMP)
  61. #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
  62. #endif