thread_info.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * S390 version
  3. * Copyright IBM Corp. 2002, 2006
  4. * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
  5. */
  6. #ifndef _ASM_THREAD_INFO_H
  7. #define _ASM_THREAD_INFO_H
  8. /*
  9. * Size of kernel stack for each process
  10. */
  11. #ifndef CONFIG_64BIT
  12. #define THREAD_ORDER 1
  13. #define ASYNC_ORDER 1
  14. #else /* CONFIG_64BIT */
  15. #ifndef __SMALL_STACK
  16. #define THREAD_ORDER 2
  17. #define ASYNC_ORDER 2
  18. #else
  19. #define THREAD_ORDER 1
  20. #define ASYNC_ORDER 1
  21. #endif
  22. #endif /* CONFIG_64BIT */
  23. #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
  24. #define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)
  25. #ifndef __ASSEMBLY__
  26. #include <asm/lowcore.h>
  27. #include <asm/page.h>
  28. #include <asm/processor.h>
  29. /*
  30. * low level task data that entry.S needs immediate access to
  31. * - this struct should fit entirely inside of one cache line
  32. * - this struct shares the supervisor stack pages
  33. * - if the contents of this structure are changed, the assembly constants must also be changed
  34. */
  35. struct thread_info {
  36. struct task_struct *task; /* main task structure */
  37. struct exec_domain *exec_domain; /* execution domain */
  38. unsigned long flags; /* low level flags */
  39. unsigned int cpu; /* current CPU */
  40. int preempt_count; /* 0 => preemptable, <0 => BUG */
  41. struct restart_block restart_block;
  42. unsigned int system_call;
  43. __u64 user_timer;
  44. __u64 system_timer;
  45. unsigned long last_break; /* last breaking-event-address. */
  46. };
  47. /*
  48. * macros/functions for gaining access to the thread information structure
  49. */
  50. #define INIT_THREAD_INFO(tsk) \
  51. { \
  52. .task = &tsk, \
  53. .exec_domain = &default_exec_domain, \
  54. .flags = 0, \
  55. .cpu = 0, \
  56. .preempt_count = INIT_PREEMPT_COUNT, \
  57. .restart_block = { \
  58. .fn = do_no_restart_syscall, \
  59. }, \
  60. }
  61. #define init_thread_info (init_thread_union.thread_info)
  62. #define init_stack (init_thread_union.stack)
  63. /* how to get the thread information struct from C */
  64. static inline struct thread_info *current_thread_info(void)
  65. {
  66. return (struct thread_info *) S390_lowcore.thread_info;
  67. }
  68. #define THREAD_SIZE_ORDER THREAD_ORDER
  69. #endif
  70. /*
  71. * thread information flags bit numbers
  72. */
  73. #define TIF_SYSCALL 0 /* inside a system call */
  74. #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
  75. #define TIF_SIGPENDING 2 /* signal pending */
  76. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  77. #define TIF_PER_TRAP 6 /* deliver sigtrap on return to user */
  78. #define TIF_MCCK_PENDING 7 /* machine check handling is pending */
  79. #define TIF_SYSCALL_TRACE 8 /* syscall trace active */
  80. #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
  81. #define TIF_SECCOMP 10 /* secure computing */
  82. #define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
  83. #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling
  84. TIF_NEED_RESCHED */
  85. #define TIF_31BIT 17 /* 32bit process */
  86. #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
  87. #define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
  88. #define TIF_SINGLE_STEP 20 /* This task is single stepped */
  89. #define _TIF_SYSCALL (1<<TIF_SYSCALL)
  90. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  91. #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
  92. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  93. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  94. #define _TIF_PER_TRAP (1<<TIF_PER_TRAP)
  95. #define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING)
  96. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  97. #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
  98. #define _TIF_SECCOMP (1<<TIF_SECCOMP)
  99. #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
  100. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  101. #define _TIF_31BIT (1<<TIF_31BIT)
  102. #define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP)
  103. #ifdef CONFIG_64BIT
  104. #define is_32bit_task() (test_thread_flag(TIF_31BIT))
  105. #else
  106. #define is_32bit_task() (1)
  107. #endif
  108. #define PREEMPT_ACTIVE 0x4000000
  109. #endif /* _ASM_THREAD_INFO_H */