thread_info.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef __ASM_SH_THREAD_INFO_H
  2. #define __ASM_SH_THREAD_INFO_H
  3. /* SuperH version
  4. * Copyright (C) 2002 Niibe Yutaka
  5. *
  6. * The copyright of original i386 version is:
  7. *
  8. * Copyright (C) 2002 David Howells (dhowells@redhat.com)
  9. * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  10. */
  11. #ifdef __KERNEL__
  12. #ifndef __ASSEMBLY__
  13. #include <asm/processor.h>
  14. struct thread_info {
  15. struct task_struct *task; /* main task structure */
  16. struct exec_domain *exec_domain; /* execution domain */
  17. __u32 flags; /* low level flags */
  18. __u32 cpu;
  19. int preempt_count; /* 0 => preemptable, <0 => BUG */
  20. struct restart_block restart_block;
  21. __u8 supervisor_stack[0];
  22. };
  23. #endif
  24. #define PREEMPT_ACTIVE 0x10000000
  25. /*
  26. * macros/functions for gaining access to the thread information structure
  27. */
  28. #ifndef __ASSEMBLY__
  29. #define INIT_THREAD_INFO(tsk) \
  30. { \
  31. .task = &tsk, \
  32. .exec_domain = &default_exec_domain, \
  33. .flags = 0, \
  34. .cpu = 0, \
  35. .preempt_count = 1, \
  36. .restart_block = { \
  37. .fn = do_no_restart_syscall, \
  38. }, \
  39. }
  40. #define init_thread_info (init_thread_union.thread_info)
  41. #define init_stack (init_thread_union.stack)
  42. /* how to get the thread information struct from C */
  43. static inline struct thread_info *current_thread_info(void)
  44. {
  45. struct thread_info *ti;
  46. __asm__("stc r7_bank, %0" : "=r" (ti));
  47. return ti;
  48. }
  49. /* thread information allocation */
  50. #define THREAD_SIZE (2*PAGE_SIZE)
  51. #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
  52. #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  53. #else /* !__ASSEMBLY__ */
  54. /* how to get the thread information struct from ASM */
  55. #define GET_THREAD_INFO(reg) \
  56. stc r7_bank, reg
  57. #endif
  58. /*
  59. * thread information flags
  60. * - these are process state flags that various assembly files may need to access
  61. * - pending work-to-be-done flags are in LSW
  62. * - other flags in MSW
  63. */
  64. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  65. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  66. #define TIF_SIGPENDING 2 /* signal pending */
  67. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  68. #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
  69. #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
  70. #define TIF_MEMDIE 18
  71. #define TIF_USERSPACE 31 /* true if FS sets userspace */
  72. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  73. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  74. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  75. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  76. #define _TIF_USEDFPU (1<<TIF_USEDFPU)
  77. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  78. #define _TIF_USERSPACE (1<<TIF_USERSPACE)
  79. #define _TIF_WORK_MASK 0x000000FE /* work to do on interrupt/exception return */
  80. #define _TIF_ALLWORK_MASK 0x000000FF /* work to do on any return to u-space */
  81. #endif /* __KERNEL__ */
  82. #endif /* __ASM_SH_THREAD_INFO_H */