thread_info_no.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. .restart_block = { \
  45. .fn = do_no_restart_syscall, \
  46. }, \
  47. }
  48. #define init_thread_info (init_thread_union.thread_info)
  49. #define init_stack (init_thread_union.stack)
  50. /* how to get the thread information struct from C */
  51. static inline struct thread_info *current_thread_info(void)
  52. {
  53. struct thread_info *ti;
  54. __asm__(
  55. "move.l %%sp, %0 \n\t"
  56. "and.l %1, %0"
  57. : "=&d"(ti)
  58. : "di" (~(THREAD_SIZE-1))
  59. );
  60. return ti;
  61. }
  62. #endif /* __ASSEMBLY__ */
  63. #define PREEMPT_ACTIVE 0x4000000
  64. /*
  65. * thread information flag bit numbers
  66. */
  67. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  68. #define TIF_SIGPENDING 1 /* signal pending */
  69. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  70. #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
  71. TIF_NEED_RESCHED */
  72. #define TIF_MEMDIE 4
  73. #define TIF_FREEZE 16 /* is freezing for suspend */
  74. /* as above, but as bit values */
  75. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  76. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  77. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  78. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  79. #define _TIF_FREEZE (1<<TIF_FREEZE)
  80. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  81. #endif /* __KERNEL__ */
  82. #endif /* _ASM_THREAD_INFO_H */