thread_info.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
  3. * Licensed under the GPL
  4. */
  5. #ifndef __UM_THREAD_INFO_H
  6. #define __UM_THREAD_INFO_H
  7. #ifndef __ASSEMBLY__
  8. #include <asm/processor.h>
  9. #include <asm/types.h>
  10. struct thread_info {
  11. struct task_struct *task; /* main task structure */
  12. struct exec_domain *exec_domain; /* execution domain */
  13. unsigned long flags; /* low level flags */
  14. __u32 cpu; /* current CPU */
  15. int preempt_count; /* 0 => preemptable,
  16. <0 => BUG */
  17. mm_segment_t addr_limit; /* thread address space:
  18. 0-0xBFFFFFFF for user
  19. 0-0xFFFFFFFF for kernel */
  20. struct restart_block restart_block;
  21. };
  22. #define INIT_THREAD_INFO(tsk) \
  23. { \
  24. .task = &tsk, \
  25. .exec_domain = &default_exec_domain, \
  26. .flags = 0, \
  27. .cpu = 0, \
  28. .preempt_count = 1, \
  29. .addr_limit = KERNEL_DS, \
  30. .restart_block = { \
  31. .fn = do_no_restart_syscall, \
  32. }, \
  33. }
  34. #define init_thread_info (init_thread_union.thread_info)
  35. #define init_stack (init_thread_union.stack)
  36. #define THREAD_SIZE ((1 << CONFIG_KERNEL_STACK_ORDER) * PAGE_SIZE)
  37. /* how to get the thread information struct from C */
  38. static inline struct thread_info *current_thread_info(void)
  39. {
  40. struct thread_info *ti;
  41. unsigned long mask = THREAD_SIZE - 1;
  42. ti = (struct thread_info *) (((unsigned long) &ti) & ~mask);
  43. return ti;
  44. }
  45. /* thread information allocation */
  46. #define alloc_thread_info(tsk) \
  47. ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL))
  48. #define free_thread_info(ti) kfree(ti)
  49. #endif
  50. #define PREEMPT_ACTIVE 0x10000000
  51. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  52. #define TIF_SIGPENDING 1 /* signal pending */
  53. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  54. #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
  55. * TIF_NEED_RESCHED
  56. */
  57. #define TIF_RESTART_BLOCK 4
  58. #define TIF_MEMDIE 5
  59. #define TIF_SYSCALL_AUDIT 6
  60. #define TIF_RESTORE_SIGMASK 7
  61. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  62. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  63. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  64. #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
  65. #define _TIF_MEMDIE (1 << TIF_MEMDIE)
  66. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  67. #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
  68. #endif