thread_info.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Copyright (C) 2002-2003 Hewlett-Packard Co
  3. * David Mosberger-Tang <davidm@hpl.hp.com>
  4. */
  5. #ifndef _ASM_IA64_THREAD_INFO_H
  6. #define _ASM_IA64_THREAD_INFO_H
  7. #ifndef ASM_OFFSETS_C
  8. #include <asm/asm-offsets.h>
  9. #endif
  10. #include <asm/processor.h>
  11. #include <asm/ptrace.h>
  12. #define PREEMPT_ACTIVE_BIT 30
  13. #define PREEMPT_ACTIVE (1 << PREEMPT_ACTIVE_BIT)
  14. #ifndef __ASSEMBLY__
  15. /*
  16. * On IA-64, we want to keep the task structure and kernel stack together, so they can be
  17. * mapped by a single TLB entry and so they can be addressed by the "current" pointer
  18. * without having to do pointer masking.
  19. */
  20. struct thread_info {
  21. struct task_struct *task; /* XXX not really needed, except for dup_task_struct() */
  22. struct exec_domain *exec_domain;/* execution domain */
  23. __u32 flags; /* thread_info flags (see TIF_*) */
  24. __u32 cpu; /* current CPU */
  25. mm_segment_t addr_limit; /* user-level address space limit */
  26. int preempt_count; /* 0=premptable, <0=BUG; will also serve as bh-counter */
  27. struct restart_block restart_block;
  28. struct {
  29. int signo;
  30. int code;
  31. void __user *addr;
  32. unsigned long start_time;
  33. pid_t pid;
  34. } sigdelayed; /* Saved information for TIF_SIGDELAYED */
  35. };
  36. #define THREAD_SIZE KERNEL_STACK_SIZE
  37. #define INIT_THREAD_INFO(tsk) \
  38. { \
  39. .task = &tsk, \
  40. .exec_domain = &default_exec_domain, \
  41. .flags = 0, \
  42. .cpu = 0, \
  43. .addr_limit = KERNEL_DS, \
  44. .preempt_count = 0, \
  45. .restart_block = { \
  46. .fn = do_no_restart_syscall, \
  47. }, \
  48. }
  49. #ifndef ASM_OFFSETS_C
  50. /* how to get the thread information struct from C */
  51. #define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
  52. #define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
  53. #define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
  54. #else
  55. #define current_thread_info() ((struct thread_info *) 0)
  56. #define alloc_thread_info(tsk) ((struct thread_info *) 0)
  57. #define task_thread_info(tsk) ((struct thread_info *) 0)
  58. #endif
  59. #define free_thread_info(ti) /* nothing */
  60. #define task_stack_page(tsk) ((void *)(tsk))
  61. #define __HAVE_THREAD_FUNCTIONS
  62. #define setup_thread_stack(p, org) \
  63. *task_thread_info(p) = *task_thread_info(org); \
  64. task_thread_info(p)->task = (p);
  65. #define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
  66. #define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
  67. #define alloc_task_struct() ((task_t *)__get_free_pages(GFP_KERNEL, KERNEL_STACK_SIZE_ORDER))
  68. #define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER)
  69. #endif /* !__ASSEMBLY */
  70. /*
  71. * thread information flags
  72. * - these are process state flags that various assembly files may need to access
  73. * - pending work-to-be-done flags are in least-significant 16 bits, other flags
  74. * in top 16 bits
  75. */
  76. #define TIF_NOTIFY_RESUME 0 /* resumption notification requested */
  77. #define TIF_SIGPENDING 1 /* signal pending */
  78. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  79. #define TIF_SYSCALL_TRACE 3 /* syscall trace active */
  80. #define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
  81. #define TIF_SIGDELAYED 5 /* signal delayed from MCA/INIT/NMI/PMI context */
  82. #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
  83. #define TIF_MEMDIE 17
  84. #define TIF_MCA_INIT 18 /* this task is processing MCA or INIT */
  85. #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */
  86. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  87. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  88. #define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)
  89. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  90. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  91. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  92. #define _TIF_SIGDELAYED (1 << TIF_SIGDELAYED)
  93. #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
  94. #define _TIF_MCA_INIT (1 << TIF_MCA_INIT)
  95. #define _TIF_DB_DISABLED (1 << TIF_DB_DISABLED)
  96. /* "work to do on user-return" bits */
  97. #define TIF_ALLWORK_MASK (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SIGDELAYED)
  98. /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
  99. #define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
  100. #endif /* _ASM_IA64_THREAD_INFO_H */