thread_info.h 2.7 KB

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