thread_info.h 2.3 KB

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