thread_info.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef _ASM_M68K_THREAD_INFO_H
  2. #define _ASM_M68K_THREAD_INFO_H
  3. #include <asm/types.h>
  4. #include <asm/page.h>
  5. /*
  6. * On machines with 4k pages we default to an 8k thread size, though we
  7. * allow a 4k with config option. Any other machine page size then
  8. * the thread size must match the page size (which is 8k and larger here).
  9. */
  10. #if PAGE_SHIFT < 13
  11. #ifdef CONFIG_4KSTACKS
  12. #define THREAD_SIZE 4096
  13. #else
  14. #define THREAD_SIZE 8192
  15. #endif
  16. #else
  17. #define THREAD_SIZE PAGE_SIZE
  18. #endif
  19. #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1)
  20. #ifndef __ASSEMBLY__
  21. struct thread_info {
  22. struct task_struct *task; /* main task structure */
  23. unsigned long flags;
  24. struct exec_domain *exec_domain; /* execution domain */
  25. int preempt_count; /* 0 => preemptable, <0 => BUG */
  26. __u32 cpu; /* should always be 0 on m68k */
  27. unsigned long tp_value; /* thread pointer */
  28. struct restart_block restart_block;
  29. };
  30. #endif /* __ASSEMBLY__ */
  31. #define PREEMPT_ACTIVE 0x4000000
  32. #define INIT_THREAD_INFO(tsk) \
  33. { \
  34. .task = &tsk, \
  35. .exec_domain = &default_exec_domain, \
  36. .preempt_count = INIT_PREEMPT_COUNT, \
  37. .restart_block = { \
  38. .fn = do_no_restart_syscall, \
  39. }, \
  40. }
  41. #define init_stack (init_thread_union.stack)
  42. #ifdef CONFIG_MMU
  43. #ifndef __ASSEMBLY__
  44. #include <asm/current.h>
  45. #endif
  46. #ifdef ASM_OFFSETS_C
  47. #define task_thread_info(tsk) ((struct thread_info *) NULL)
  48. #else
  49. #include <asm/asm-offsets.h>
  50. #define task_thread_info(tsk) ((struct thread_info *)((char *)tsk+TASK_TINFO))
  51. #endif
  52. #define init_thread_info (init_task.thread.info)
  53. #define task_stack_page(tsk) ((tsk)->stack)
  54. #define current_thread_info() task_thread_info(current)
  55. #define __HAVE_THREAD_FUNCTIONS
  56. #define setup_thread_stack(p, org) ({ \
  57. *(struct task_struct **)(p)->stack = (p); \
  58. task_thread_info(p)->task = (p); \
  59. })
  60. #define end_of_stack(p) ((unsigned long *)(p)->stack + 1)
  61. #else /* !CONFIG_MMU */
  62. #ifndef __ASSEMBLY__
  63. /* how to get the thread information struct from C */
  64. static inline struct thread_info *current_thread_info(void)
  65. {
  66. struct thread_info *ti;
  67. __asm__(
  68. "move.l %%sp, %0 \n\t"
  69. "and.l %1, %0"
  70. : "=&d"(ti)
  71. : "di" (~(THREAD_SIZE-1))
  72. );
  73. return ti;
  74. }
  75. #endif
  76. #define init_thread_info (init_thread_union.thread_info)
  77. #endif /* CONFIG_MMU */
  78. /* entry.S relies on these definitions!
  79. * bits 0-7 are tested at every exception exit
  80. * bits 8-15 are also tested at syscall exit
  81. */
  82. #define TIF_SIGPENDING 6 /* signal pending */
  83. #define TIF_NEED_RESCHED 7 /* rescheduling necessary */
  84. #define TIF_DELAYED_TRACE 14 /* single step a syscall */
  85. #define TIF_SYSCALL_TRACE 15 /* syscall trace active */
  86. #define TIF_MEMDIE 16 /* is terminating due to OOM killer */
  87. #define TIF_FREEZE 17 /* thread is freezing for suspend */
  88. #define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal */
  89. #endif /* _ASM_M68K_THREAD_INFO_H */