thread_info.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * File: include/asm-blackfin/thread_info.h
  3. * Based on: include/asm-m68knommu/thread_info.h
  4. * Author: LG Soft India
  5. * Copyright (C) 2004-2005 Analog Devices Inc.
  6. * Created: Tue Sep 21 2004
  7. * Description: Blackfin low-level thread information
  8. * Modified:
  9. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2, or (at your option)
  14. * any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; see the file COPYING.
  23. * If not, write to the Free Software Foundation,
  24. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  25. */
  26. #ifndef _ASM_THREAD_INFO_H
  27. #define _ASM_THREAD_INFO_H
  28. #include <asm/page.h>
  29. #include <asm/entry.h>
  30. #include <asm/l1layout.h>
  31. #include <linux/compiler.h>
  32. #ifdef __KERNEL__
  33. /* Thread Align Mask to reach to the top of the stack
  34. * for any process
  35. */
  36. #define ALIGN_PAGE_MASK 0xffffe000
  37. /*
  38. * Size of kernel stack for each process. This must be a power of 2...
  39. */
  40. #define THREAD_SIZE_ORDER 1
  41. #define THREAD_SIZE 8192 /* 2 pages */
  42. #define STACK_WARN (THREAD_SIZE/8)
  43. #ifndef __ASSEMBLY__
  44. typedef unsigned long mm_segment_t;
  45. /*
  46. * low level task data.
  47. * If you change this, change the TI_* offsets below to match.
  48. */
  49. struct thread_info {
  50. struct task_struct *task; /* main task structure */
  51. struct exec_domain *exec_domain; /* execution domain */
  52. unsigned long flags; /* low level flags */
  53. int cpu; /* cpu we're on */
  54. int preempt_count; /* 0 => preemptable, <0 => BUG */
  55. mm_segment_t addr_limit; /* address limit */
  56. struct restart_block restart_block;
  57. #ifndef CONFIG_SMP
  58. struct l1_scratch_task_info l1_task_info;
  59. #endif
  60. };
  61. /*
  62. * macros/functions for gaining access to the thread information structure
  63. */
  64. #define INIT_THREAD_INFO(tsk) \
  65. { \
  66. .task = &tsk, \
  67. .exec_domain = &default_exec_domain, \
  68. .flags = 0, \
  69. .cpu = 0, \
  70. .preempt_count = 1, \
  71. .restart_block = { \
  72. .fn = do_no_restart_syscall, \
  73. }, \
  74. }
  75. #define init_thread_info (init_thread_union.thread_info)
  76. #define init_stack (init_thread_union.stack)
  77. /* Given a task stack pointer, you can find its corresponding
  78. * thread_info structure just by masking it to the THREAD_SIZE
  79. * boundary (currently 8K as you can see above).
  80. */
  81. __attribute_const__
  82. static inline struct thread_info *current_thread_info(void)
  83. {
  84. struct thread_info *ti;
  85. __asm__("%0 = sp;" : "=da"(ti) :
  86. );
  87. return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
  88. }
  89. #endif /* __ASSEMBLY__ */
  90. /*
  91. * Offsets in thread_info structure, used in assembly code
  92. */
  93. #define TI_TASK 0
  94. #define TI_EXECDOMAIN 4
  95. #define TI_FLAGS 8
  96. #define TI_CPU 12
  97. #define TI_PREEMPT 16
  98. #define PREEMPT_ACTIVE 0x4000000
  99. /*
  100. * thread information flag bit numbers
  101. */
  102. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  103. #define TIF_SIGPENDING 1 /* signal pending */
  104. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  105. #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
  106. TIF_NEED_RESCHED */
  107. #define TIF_MEMDIE 4
  108. #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
  109. #define TIF_FREEZE 6 /* is freezing for suspend */
  110. #define TIF_IRQ_SYNC 7 /* sync pipeline stage */
  111. /* as above, but as bit values */
  112. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  113. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  114. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  115. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  116. #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
  117. #define _TIF_FREEZE (1<<TIF_FREEZE)
  118. #define _TIF_IRQ_SYNC (1<<TIF_IRQ_SYNC)
  119. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  120. #endif /* __KERNEL__ */
  121. #endif /* _ASM_THREAD_INFO_H */