thread_info.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* thread_info.h: h8300 low-level thread information
  2. * adapted from the i386 and PPC versions by Yoshinori Sato <ysato@users.sourceforge.jp>
  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. #include <asm/segment.h>
  11. #ifdef __KERNEL__
  12. /*
  13. * Size of kernel stack for each process. This must be a power of 2...
  14. */
  15. #define THREAD_SIZE_ORDER 1
  16. #define THREAD_SIZE 8192 /* 2 pages */
  17. #ifndef __ASSEMBLY__
  18. /*
  19. * low level task data.
  20. * If you change this, change the TI_* offsets below to match.
  21. */
  22. struct thread_info {
  23. struct task_struct *task; /* main task structure */
  24. unsigned long flags; /* low level flags */
  25. int cpu; /* cpu we're on */
  26. int preempt_count; /* 0 => preemptable, <0 => BUG */
  27. mm_segment_t addr_limit;
  28. };
  29. /*
  30. * macros/functions for gaining access to the thread information structure
  31. */
  32. #define INIT_THREAD_INFO(tsk) \
  33. { \
  34. .task = &tsk, \
  35. .flags = 0, \
  36. .cpu = 0, \
  37. .preempt_count = INIT_PREEMPT_COUNT, \
  38. .addr_limit = KERNEL_DS, \
  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__("mov.l sp, %0\n\t"
  47. "and.w %1, %T0"
  48. : "=&r"(ti)
  49. : "i" (~(THREAD_SIZE-1) & 0xffff));
  50. return ti;
  51. }
  52. #endif /* __ASSEMBLY__ */
  53. /*
  54. * thread information flag bit numbers
  55. */
  56. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  57. #define TIF_SIGPENDING 1 /* signal pending */
  58. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  59. #define TIF_SINGLESTEP 3 /* singlestepping active */
  60. #define TIF_MEMDIE 4 /* is terminating due to OOM killer */
  61. #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
  62. #define TIF_NOTIFY_RESUME 6 /* callback before returning to user */
  63. #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
  64. #define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */
  65. #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling TIF_NEED_RESCHED */
  66. /* as above, but as bit values */
  67. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  68. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  69. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  70. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  71. #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
  72. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  73. #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
  74. #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
  75. /* work to do in syscall trace */
  76. #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
  77. _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
  78. /* work to do on any return to u-space */
  79. #define _TIF_ALLWORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING | \
  80. _TIF_NEED_RESCHED | _TIF_SYSCALL_AUDIT | \
  81. _TIF_SINGLESTEP | _TIF_NOTIFY_RESUME | \
  82. _TIF_SYSCALL_TRACEPOINT)
  83. /* work to do on interrupt/exception return */
  84. #define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
  85. _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP))
  86. #endif /* __KERNEL__ */
  87. #endif /* _ASM_THREAD_INFO_H */