thread_info_no.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. #ifndef __ASSEMBLY__
  12. /*
  13. * Size of kernel stack for each process. This must be a power of 2...
  14. */
  15. #ifdef CONFIG_4KSTACKS
  16. #define THREAD_SIZE_ORDER (0)
  17. #else
  18. #define THREAD_SIZE_ORDER (1)
  19. #endif
  20. /*
  21. * for asm files, THREAD_SIZE is now generated by asm-offsets.c
  22. */
  23. #define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER)
  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. struct restart_block restart_block;
  34. };
  35. /*
  36. * macros/functions for gaining access to the thread information structure
  37. */
  38. #define INIT_THREAD_INFO(tsk) \
  39. { \
  40. .task = &tsk, \
  41. .exec_domain = &default_exec_domain, \
  42. .flags = 0, \
  43. .cpu = 0, \
  44. .preempt_count = INIT_PREEMPT_COUNT, \
  45. .restart_block = { \
  46. .fn = do_no_restart_syscall, \
  47. }, \
  48. }
  49. #define init_thread_info (init_thread_union.thread_info)
  50. #define init_stack (init_thread_union.stack)
  51. /* how to get the thread information struct from C */
  52. static inline struct thread_info *current_thread_info(void)
  53. {
  54. struct thread_info *ti;
  55. __asm__(
  56. "move.l %%sp, %0 \n\t"
  57. "and.l %1, %0"
  58. : "=&d"(ti)
  59. : "di" (~(THREAD_SIZE-1))
  60. );
  61. return ti;
  62. }
  63. #endif /* __ASSEMBLY__ */
  64. #define PREEMPT_ACTIVE 0x4000000
  65. /*
  66. * thread information flag bit numbers
  67. */
  68. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  69. #define TIF_SIGPENDING 1 /* signal pending */
  70. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  71. #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
  72. TIF_NEED_RESCHED */
  73. #define TIF_MEMDIE 4
  74. #define TIF_FREEZE 16 /* is freezing for suspend */
  75. /* as above, but as bit values */
  76. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  77. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  78. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  79. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  80. #define _TIF_FREEZE (1<<TIF_FREEZE)
  81. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  82. #endif /* __KERNEL__ */
  83. #endif /* _ASM_THREAD_INFO_H */