thread_info.h 3.0 KB

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