thread_info_no.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* thread_info.h: m68knommu low-level thread information
  2. * adapted from the i386 and PPC versions by Greg Ungerer (gerg@snapgear.com)
  3. *
  4. * Copyright (C) 2002 David Howells (dhowells@redhat.com)
  5. * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  6. */
  7. #ifndef _ASM_THREAD_INFO_H
  8. #define _ASM_THREAD_INFO_H
  9. #include <asm/page.h>
  10. #ifdef __KERNEL__
  11. /*
  12. * Size of kernel stack for each process. This must be a power of 2...
  13. */
  14. #ifdef CONFIG_4KSTACKS
  15. #define THREAD_SIZE_ORDER (0)
  16. #else
  17. #define THREAD_SIZE_ORDER (1)
  18. #endif
  19. /*
  20. * for asm files, THREAD_SIZE is now generated by asm-offsets.c
  21. */
  22. #define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)
  23. #ifndef __ASSEMBLY__
  24. /*
  25. * low level task data.
  26. */
  27. struct thread_info {
  28. struct task_struct *task; /* main task structure */
  29. struct exec_domain *exec_domain; /* execution domain */
  30. unsigned long flags; /* low level flags */
  31. int cpu; /* cpu we're on */
  32. int preempt_count; /* 0 => preemptable, <0 => BUG */
  33. unsigned long tp_value; /* thread pointer */
  34. struct restart_block restart_block;
  35. };
  36. /*
  37. * macros/functions for gaining access to the thread information structure
  38. */
  39. #define INIT_THREAD_INFO(tsk) \
  40. { \
  41. .task = &tsk, \
  42. .exec_domain = &default_exec_domain, \
  43. .flags = 0, \
  44. .cpu = 0, \
  45. .preempt_count = INIT_PREEMPT_COUNT, \
  46. .restart_block = { \
  47. .fn = do_no_restart_syscall, \
  48. }, \
  49. }
  50. #define init_thread_info (init_thread_union.thread_info)
  51. #define init_stack (init_thread_union.stack)
  52. /* how to get the thread information struct from C */
  53. static inline struct thread_info *current_thread_info(void)
  54. {
  55. struct thread_info *ti;
  56. __asm__(
  57. "move.l %%sp, %0 \n\t"
  58. "and.l %1, %0"
  59. : "=&d"(ti)
  60. : "di" (~(THREAD_SIZE-1))
  61. );
  62. return ti;
  63. }
  64. #endif /* __ASSEMBLY__ */
  65. #define PREEMPT_ACTIVE 0x4000000
  66. /*
  67. * thread information flag bit numbers
  68. */
  69. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  70. #define TIF_SIGPENDING 1 /* signal pending */
  71. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  72. #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
  73. TIF_NEED_RESCHED */
  74. #define TIF_MEMDIE 4 /* is terminating due to OOM killer */
  75. #define TIF_FREEZE 16 /* is freezing for suspend */
  76. /* as above, but as bit values */
  77. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  78. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  79. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  80. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  81. #define _TIF_FREEZE (1<<TIF_FREEZE)
  82. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  83. #endif /* __KERNEL__ */
  84. #endif /* _ASM_THREAD_INFO_H */