thread_info.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. .restart_block = { \
  33. .fn = do_no_restart_syscall, \
  34. }, \
  35. }
  36. #define init_thread_info (init_thread_union.thread_info)
  37. #define init_stack (init_thread_union.stack)
  38. /* How to get the thread information struct from C. */
  39. register struct thread_info *__current_thread_info __asm__("$8");
  40. #define current_thread_info() __current_thread_info
  41. /* Thread information allocation. */
  42. #define THREAD_SIZE (2*PAGE_SIZE)
  43. #define alloc_thread_info(tsk) \
  44. ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
  45. #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  46. #endif /* __ASSEMBLY__ */
  47. #define PREEMPT_ACTIVE 0x40000000
  48. /*
  49. * Thread information flags:
  50. * - these are process state flags and used from assembly
  51. * - pending work-to-be-done flags come first to fit in and immediate operand.
  52. *
  53. * TIF_SYSCALL_TRACE is known to be 0 via blbs.
  54. */
  55. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  56. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  57. #define TIF_SIGPENDING 2 /* signal pending */
  58. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  59. #define TIF_POLLING_NRFLAG 4 /* poll_idle is polling NEED_RESCHED */
  60. #define TIF_DIE_IF_KERNEL 5 /* dik recursion lock */
  61. #define TIF_UAC_NOPRINT 6 /* see sysinfo.h */
  62. #define TIF_UAC_NOFIX 7
  63. #define TIF_UAC_SIGBUS 8
  64. #define TIF_MEMDIE 9
  65. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  66. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  67. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  68. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  69. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  70. /* Work to do on interrupt/exception return. */
  71. #define _TIF_WORK_MASK (_TIF_NOTIFY_RESUME \
  72. | _TIF_SIGPENDING \
  73. | _TIF_NEED_RESCHED)
  74. /* Work to do on any return to userspace. */
  75. #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
  76. | _TIF_SYSCALL_TRACE)
  77. #endif /* __KERNEL__ */
  78. #endif /* _ALPHA_THREAD_INFO_H */