thread_info.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* thread_info.h: PPC low-level thread information
  2. * adapted from the i386 version by Paul Mackerras
  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. #ifdef __KERNEL__
  10. #ifndef __ASSEMBLY__
  11. /*
  12. * low level task data.
  13. * If you change this, change the TI_* offsets below to match.
  14. */
  15. struct thread_info {
  16. struct task_struct *task; /* main task structure */
  17. struct exec_domain *exec_domain; /* execution domain */
  18. unsigned long flags; /* low level flags */
  19. unsigned long local_flags; /* non-racy flags */
  20. int cpu; /* cpu we're on */
  21. int preempt_count; /* 0 => preemptable,
  22. <0 => BUG */
  23. struct restart_block restart_block;
  24. };
  25. #define INIT_THREAD_INFO(tsk) \
  26. { \
  27. .task = &tsk, \
  28. .exec_domain = &default_exec_domain, \
  29. .flags = 0, \
  30. .local_flags = 0, \
  31. .cpu = 0, \
  32. .preempt_count = 1, \
  33. .restart_block = { \
  34. .fn = do_no_restart_syscall, \
  35. }, \
  36. }
  37. #define init_thread_info (init_thread_union.thread_info)
  38. #define init_stack (init_thread_union.stack)
  39. /*
  40. * macros/functions for gaining access to the thread information structure
  41. */
  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__("rlwinm %0,1,0,0,18" : "=r"(ti));
  47. return ti;
  48. }
  49. /* thread information allocation */
  50. #define alloc_thread_info(tsk) ((struct thread_info *) \
  51. __get_free_pages(GFP_KERNEL, 1))
  52. #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  53. #define get_thread_info(ti) get_task_struct((ti)->task)
  54. #define put_thread_info(ti) put_task_struct((ti)->task)
  55. #endif /* __ASSEMBLY__ */
  56. /*
  57. * Size of kernel stack for each process.
  58. */
  59. #define THREAD_SIZE 8192 /* 2 pages */
  60. #define PREEMPT_ACTIVE 0x10000000
  61. /*
  62. * thread information flag bit numbers
  63. */
  64. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  65. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  66. #define TIF_SIGPENDING 2 /* signal pending */
  67. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  68. #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling
  69. TIF_NEED_RESCHED */
  70. #define TIF_MEMDIE 5
  71. #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */
  72. #define TIF_SECCOMP 7 /* secure computing */
  73. /* as above, but as bit values */
  74. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  75. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  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_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
  80. #define _TIF_SECCOMP (1<<TIF_SECCOMP)
  81. #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
  82. /*
  83. * Non racy (local) flags bit numbers
  84. */
  85. #define TIFL_FORCE_NOERROR 0 /* don't return error from current
  86. syscall even if result < 0 */
  87. /* as above, but as bit values */
  88. #define _TIFL_FORCE_NOERROR (1<<TIFL_FORCE_NOERROR)
  89. #endif /* __KERNEL__ */
  90. #endif /* _ASM_THREAD_INFO_H */