thread_info.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #ifndef _ASM_SCORE_THREAD_INFO_H
  2. #define _ASM_SCORE_THREAD_INFO_H
  3. #ifdef __KERNEL__
  4. #define KU_MASK 0x08
  5. #define KU_USER 0x08
  6. #define KU_KERN 0x00
  7. #include <asm/page.h>
  8. #include <linux/const.h>
  9. /* thread information allocation */
  10. #define THREAD_SIZE_ORDER (1)
  11. #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
  12. #define THREAD_MASK (THREAD_SIZE - _AC(1,UL))
  13. #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
  14. #ifndef __ASSEMBLY__
  15. #include <asm/processor.h>
  16. /*
  17. * low level task data that entry.S needs immediate access to
  18. * - this struct should fit entirely inside of one cache line
  19. * - this struct shares the supervisor stack pages
  20. * - if the contents of this structure are changed, the assembly constants
  21. * must also be changed
  22. */
  23. struct thread_info {
  24. struct task_struct *task; /* main task structure */
  25. struct exec_domain *exec_domain; /* execution domain */
  26. unsigned long flags; /* low level flags */
  27. unsigned long tp_value; /* thread pointer */
  28. __u32 cpu; /* current CPU */
  29. /* 0 => preemptable, < 0 => BUG */
  30. int preempt_count;
  31. /*
  32. * thread address space:
  33. * 0-0xBFFFFFFF for user-thead
  34. * 0-0xFFFFFFFF for kernel-thread
  35. */
  36. mm_segment_t addr_limit;
  37. struct restart_block restart_block;
  38. struct pt_regs *regs;
  39. };
  40. /*
  41. * macros/functions for gaining access to the thread information structure
  42. *
  43. * preempt_count needs to be 1 initially, until the scheduler is functional.
  44. */
  45. #define INIT_THREAD_INFO(tsk) \
  46. { \
  47. .task = &tsk, \
  48. .exec_domain = &default_exec_domain, \
  49. .cpu = 0, \
  50. .preempt_count = 1, \
  51. .addr_limit = KERNEL_DS, \
  52. .restart_block = { \
  53. .fn = do_no_restart_syscall, \
  54. }, \
  55. }
  56. #define init_thread_info (init_thread_union.thread_info)
  57. #define init_stack (init_thread_union.stack)
  58. /* How to get the thread information struct from C. */
  59. register struct thread_info *__current_thread_info __asm__("r28");
  60. #define current_thread_info() __current_thread_info
  61. #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
  62. #define free_thread_info(info) kfree(info)
  63. #endif /* !__ASSEMBLY__ */
  64. #define PREEMPT_ACTIVE 0x10000000
  65. /*
  66. * thread information flags
  67. * - these are process state flags that various assembly files may need to
  68. * access
  69. * - pending work-to-be-done flags are in LSW
  70. * - other flags in MSW
  71. */
  72. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  73. #define TIF_SIGPENDING 1 /* signal pending */
  74. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  75. #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
  76. #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
  77. #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling
  78. TIF_NEED_RESCHED */
  79. #define TIF_MEMDIE 18
  80. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  81. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  82. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  83. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  84. #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
  85. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  86. #define _TIF_WORK_MASK (0x0000ffff)
  87. #endif /* __KERNEL__ */
  88. #endif /* _ASM_SCORE_THREAD_INFO_H */