thread_info.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #ifndef _ALPHA_THREAD_INFO_H
  2. #define _ALPHA_THREAD_INFO_H
  3. #ifdef __KERNEL__
  4. #ifndef __ASSEMBLY__
  5. #include <asm/processor.h>
  6. #include <asm/types.h>
  7. #include <asm/hwrpb.h>
  8. #endif
  9. #ifndef __ASSEMBLY__
  10. struct thread_info {
  11. struct pcb_struct pcb; /* palcode state */
  12. struct task_struct *task; /* main task structure */
  13. unsigned int flags; /* low level flags */
  14. unsigned int ieee_state; /* see fpu.h */
  15. struct exec_domain *exec_domain; /* execution domain */
  16. mm_segment_t addr_limit; /* thread address space */
  17. unsigned cpu; /* current CPU */
  18. int preempt_count; /* 0 => preemptable, <0 => BUG */
  19. int bpt_nsaved;
  20. unsigned long bpt_addr[2]; /* breakpoint handling */
  21. unsigned int bpt_insn[2];
  22. struct restart_block restart_block;
  23. };
  24. /*
  25. * Macros/functions for gaining access to the thread information structure.
  26. */
  27. #define INIT_THREAD_INFO(tsk) \
  28. { \
  29. .task = &tsk, \
  30. .exec_domain = &default_exec_domain, \
  31. .addr_limit = KERNEL_DS, \
  32. .preempt_count = INIT_PREEMPT_COUNT, \
  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. /* How to get the thread information struct from C. */
  40. register struct thread_info *__current_thread_info __asm__("$8");
  41. #define current_thread_info() __current_thread_info
  42. #endif /* __ASSEMBLY__ */
  43. /* Thread information allocation. */
  44. #define THREAD_SIZE_ORDER 1
  45. #define THREAD_SIZE (2*PAGE_SIZE)
  46. #define PREEMPT_ACTIVE 0x40000000
  47. /*
  48. * Thread information flags:
  49. * - these are process state flags and used from assembly
  50. * - pending work-to-be-done flags come first and must be assigned to be
  51. * within bits 0 to 7 to fit in and immediate operand.
  52. * - ALPHA_UAC_SHIFT below must be kept consistent with the unaligned
  53. * control flags.
  54. *
  55. * TIF_SYSCALL_TRACE is known to be 0 via blbs.
  56. */
  57. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  58. #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
  59. #define TIF_SIGPENDING 2 /* signal pending */
  60. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  61. #define TIF_POLLING_NRFLAG 8 /* poll_idle is polling NEED_RESCHED */
  62. #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
  63. #define TIF_UAC_NOPRINT 10 /* ! Preserve sequence of following */
  64. #define TIF_UAC_NOFIX 11 /* ! flags as they match */
  65. #define TIF_UAC_SIGBUS 12 /* ! userspace part of 'osf_sysinfo' */
  66. #define TIF_MEMDIE 13 /* is terminating due to OOM killer */
  67. #define TIF_RESTORE_SIGMASK 14 /* restore signal mask in do_signal */
  68. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  69. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  70. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  71. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  72. #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
  73. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  74. /* Work to do on interrupt/exception return. */
  75. #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
  76. _TIF_NOTIFY_RESUME)
  77. /* Work to do on any return to userspace. */
  78. #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
  79. | _TIF_SYSCALL_TRACE)
  80. #define ALPHA_UAC_SHIFT TIF_UAC_NOPRINT
  81. #define ALPHA_UAC_MASK (1 << TIF_UAC_NOPRINT | 1 << TIF_UAC_NOFIX | \
  82. 1 << TIF_UAC_SIGBUS)
  83. #define SET_UNALIGN_CTL(task,value) ({ \
  84. task_thread_info(task)->flags = ((task_thread_info(task)->flags & \
  85. ~ALPHA_UAC_MASK) \
  86. | (((value) << ALPHA_UAC_SHIFT) & (1<<TIF_UAC_NOPRINT))\
  87. | (((value) << (ALPHA_UAC_SHIFT + 1)) & (1<<TIF_UAC_SIGBUS)) \
  88. | (((value) << (ALPHA_UAC_SHIFT - 1)) & (1<<TIF_UAC_NOFIX)));\
  89. 0; })
  90. #define GET_UNALIGN_CTL(task,value) ({ \
  91. put_user((task_thread_info(task)->flags & (1 << TIF_UAC_NOPRINT))\
  92. >> ALPHA_UAC_SHIFT \
  93. | (task_thread_info(task)->flags & (1 << TIF_UAC_SIGBUS))\
  94. >> (ALPHA_UAC_SHIFT + 1) \
  95. | (task_thread_info(task)->flags & (1 << TIF_UAC_NOFIX))\
  96. >> (ALPHA_UAC_SHIFT - 1), \
  97. (int __user *)(value)); \
  98. })
  99. #endif /* __KERNEL__ */
  100. #endif /* _ALPHA_THREAD_INFO_H */