thread_info.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. unsigned long flags; /* low level flags */
  25. unsigned long tp_value; /* thread pointer */
  26. __u32 cpu; /* current CPU */
  27. /* 0 => preemptable, < 0 => BUG */
  28. int preempt_count;
  29. /*
  30. * thread address space:
  31. * 0-0xBFFFFFFF for user-thead
  32. * 0-0xFFFFFFFF for kernel-thread
  33. */
  34. mm_segment_t addr_limit;
  35. struct pt_regs *regs;
  36. };
  37. /*
  38. * macros/functions for gaining access to the thread information structure
  39. *
  40. * preempt_count needs to be 1 initially, until the scheduler is functional.
  41. */
  42. #define INIT_THREAD_INFO(tsk) \
  43. { \
  44. .task = &tsk, \
  45. .cpu = 0, \
  46. .preempt_count = 1, \
  47. .addr_limit = KERNEL_DS, \
  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. #endif /* !__ASSEMBLY__ */
  55. /*
  56. * thread information flags
  57. * - these are process state flags that various assembly files may need to
  58. * access
  59. * - pending work-to-be-done flags are in LSW
  60. * - other flags in MSW
  61. */
  62. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  63. #define TIF_SIGPENDING 1 /* signal pending */
  64. #define TIF_NEED_RESCHED 2 /* rescheduling necessary */
  65. #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
  66. #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
  67. #define TIF_MEMDIE 18 /* is terminating due to OOM killer */
  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_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  72. #define _TIF_WORK_MASK (0x0000ffff)
  73. #endif /* __KERNEL__ */
  74. #endif /* _ASM_SCORE_THREAD_INFO_H */