thread_info.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * include/asm-xtensa/thread_info.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2001 - 2005 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_THREAD_INFO_H
  11. #define _XTENSA_THREAD_INFO_H
  12. #include <linux/stringify.h>
  13. #include <asm/kmem_layout.h>
  14. #define CURRENT_SHIFT KERNEL_STACK_SHIFT
  15. #ifndef __ASSEMBLY__
  16. # include <asm/processor.h>
  17. #endif
  18. /*
  19. * low level task data that entry.S needs immediate access to
  20. * - this struct should fit entirely inside of one cache line
  21. * - this struct shares the supervisor stack pages
  22. * - if the contents of this structure are changed, the assembly constants
  23. * must also be changed
  24. */
  25. #ifndef __ASSEMBLY__
  26. #if XTENSA_HAVE_COPROCESSORS
  27. typedef struct xtregs_coprocessor {
  28. xtregs_cp0_t cp0;
  29. xtregs_cp1_t cp1;
  30. xtregs_cp2_t cp2;
  31. xtregs_cp3_t cp3;
  32. xtregs_cp4_t cp4;
  33. xtregs_cp5_t cp5;
  34. xtregs_cp6_t cp6;
  35. xtregs_cp7_t cp7;
  36. } xtregs_coprocessor_t;
  37. #endif
  38. struct thread_info {
  39. struct task_struct *task; /* main task structure */
  40. unsigned long flags; /* low level flags */
  41. unsigned long status; /* thread-synchronous flags */
  42. __u32 cpu; /* current CPU */
  43. __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
  44. #if XCHAL_HAVE_EXCLUSIVE
  45. /* result of the most recent exclusive store */
  46. unsigned long atomctl8;
  47. #endif
  48. #ifdef CONFIG_USER_ABI_CALL0_PROBE
  49. /* Address where PS.WOE was enabled by the ABI probing code */
  50. unsigned long ps_woe_fix_addr;
  51. #endif
  52. /*
  53. * If i-th bit is set then coprocessor state is loaded into the
  54. * coprocessor i on CPU cp_owner_cpu.
  55. */
  56. unsigned long cpenable;
  57. u32 cp_owner_cpu;
  58. /* Allocate storage for extra user states and coprocessor states. */
  59. #if XTENSA_HAVE_COPROCESSORS
  60. xtregs_coprocessor_t xtregs_cp;
  61. #endif
  62. xtregs_user_t xtregs_user;
  63. };
  64. #endif
  65. /*
  66. * macros/functions for gaining access to the thread information structure
  67. */
  68. #ifndef __ASSEMBLY__
  69. #define INIT_THREAD_INFO(tsk) \
  70. { \
  71. .task = &tsk, \
  72. .flags = 0, \
  73. .cpu = 0, \
  74. .preempt_count = INIT_PREEMPT_COUNT, \
  75. }
  76. /* how to get the thread information struct from C */
  77. static inline struct thread_info *current_thread_info(void)
  78. {
  79. struct thread_info *ti;
  80. __asm__("extui %0, a1, 0, "__stringify(CURRENT_SHIFT)"\n\t"
  81. "xor %0, a1, %0" : "=&r" (ti) : );
  82. return ti;
  83. }
  84. #else /* !__ASSEMBLY__ */
  85. /* how to get the thread information struct from ASM */
  86. #define GET_THREAD_INFO(reg,sp) \
  87. extui reg, sp, 0, CURRENT_SHIFT; \
  88. xor reg, sp, reg
  89. #endif
  90. /*
  91. * thread information flags
  92. * - these are process state flags that various assembly files may need to access
  93. */
  94. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  95. #define TIF_SIGPENDING 1 /* signal pending */
  96. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  97. #define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */
  98. #define TIF_SYSCALL_TRACEPOINT 4 /* syscall tracepoint instrumentation */
  99. #define TIF_NOTIFY_SIGNAL 5 /* signal notifications exist */
  100. #define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */
  101. #define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
  102. #define TIF_DB_DISABLED 8 /* debug trap disabled for syscall */
  103. #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
  104. #define TIF_SECCOMP 10 /* secure computing */
  105. #define TIF_MEMDIE 11 /* is terminating due to OOM killer */
  106. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  107. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  108. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  109. #define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
  110. #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
  111. #define _TIF_NOTIFY_SIGNAL (1<<TIF_NOTIFY_SIGNAL)
  112. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  113. #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
  114. #define _TIF_SECCOMP (1<<TIF_SECCOMP)
  115. #define _TIF_WORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
  116. _TIF_SYSCALL_TRACEPOINT | \
  117. _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
  118. #define THREAD_SIZE KERNEL_STACK_SIZE
  119. #define THREAD_SIZE_ORDER (KERNEL_STACK_SHIFT - PAGE_SHIFT)
  120. #endif /* _XTENSA_THREAD_INFO */