thread_info.h 3.6 KB

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