thread_info.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (C) 2006 Atmark Techno, Inc.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. */
  8. #ifndef _ASM_MICROBLAZE_THREAD_INFO_H
  9. #define _ASM_MICROBLAZE_THREAD_INFO_H
  10. #ifdef __KERNEL__
  11. /* we have 8k stack */
  12. #define THREAD_SHIFT 13
  13. #define THREAD_SIZE (1 << THREAD_SHIFT)
  14. #define THREAD_SIZE_ORDER 1
  15. #ifndef __ASSEMBLY__
  16. # include <linux/types.h>
  17. # include <asm/processor.h>
  18. /*
  19. * low level task data that entry.S needs immediate access to
  20. * - this struct should fit entirely inside of one cache line
  21. * - this struct shares the supervisor stack pages
  22. * - if the contents of this structure are changed, the assembly constants
  23. * must also be changed
  24. */
  25. struct cpu_context {
  26. __u32 r1; /* stack pointer */
  27. __u32 r2;
  28. /* dedicated registers */
  29. __u32 r13;
  30. __u32 r14;
  31. __u32 r15;
  32. __u32 r16;
  33. __u32 r17;
  34. __u32 r18;
  35. /* non-volatile registers */
  36. __u32 r19;
  37. __u32 r20;
  38. __u32 r21;
  39. __u32 r22;
  40. __u32 r23;
  41. __u32 r24;
  42. __u32 r25;
  43. __u32 r26;
  44. __u32 r27;
  45. __u32 r28;
  46. __u32 r29;
  47. __u32 r30;
  48. /* r31 is used as current task pointer */
  49. /* special purpose registers */
  50. __u32 msr;
  51. __u32 ear;
  52. __u32 esr;
  53. __u32 fsr;
  54. };
  55. typedef struct {
  56. unsigned long seg;
  57. } mm_segment_t;
  58. struct thread_info {
  59. struct task_struct *task; /* main task structure */
  60. unsigned long flags; /* low level flags */
  61. unsigned long status; /* thread-synchronous flags */
  62. __u32 cpu; /* current CPU */
  63. __s32 preempt_count; /* 0 => preemptable,< 0 => BUG*/
  64. mm_segment_t addr_limit; /* thread address space */
  65. struct cpu_context cpu_context;
  66. };
  67. /*
  68. * macros/functions for gaining access to the thread information structure
  69. */
  70. #define INIT_THREAD_INFO(tsk) \
  71. { \
  72. .task = &tsk, \
  73. .flags = 0, \
  74. .cpu = 0, \
  75. .preempt_count = INIT_PREEMPT_COUNT, \
  76. .addr_limit = KERNEL_DS, \
  77. }
  78. /* how to get the thread information struct from C */
  79. static inline struct thread_info *current_thread_info(void)
  80. {
  81. register unsigned long sp asm("r1");
  82. return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
  83. }
  84. /* thread information allocation */
  85. #endif /* __ASSEMBLY__ */
  86. /*
  87. * thread information flags
  88. * - these are process state flags that various assembly files may
  89. * need to access
  90. * - pending work-to-be-done flags are in LSW
  91. * - other flags in MSW
  92. */
  93. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  94. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  95. #define TIF_SIGPENDING 2 /* signal pending */
  96. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  97. /* restore singlestep on return to user mode */
  98. #define TIF_SINGLESTEP 4
  99. #define TIF_MEMDIE 6 /* is terminating due to OOM killer */
  100. #define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
  101. #define TIF_SECCOMP 10 /* secure computing */
  102. /* true if poll_idle() is polling TIF_NEED_RESCHED */
  103. #define TIF_POLLING_NRFLAG 16
  104. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  105. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  106. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  107. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  108. #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
  109. #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
  110. #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
  111. #define _TIF_SECCOMP (1 << TIF_SECCOMP)
  112. /* work to do in syscall trace */
  113. #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
  114. _TIF_SYSCALL_AUDIT | _TIF_SECCOMP)
  115. /* work to do on interrupt/exception return */
  116. #define _TIF_WORK_MASK 0x0000FFFE
  117. /* work to do on any return to u-space */
  118. #define _TIF_ALLWORK_MASK 0x0000FFFF
  119. /*
  120. * Thread-synchronous status.
  121. *
  122. * This is different from the flags in that nobody else
  123. * ever touches our thread-synchronous status, so we don't
  124. * have to worry about atomic accesses.
  125. */
  126. /* FPU was used by this task this quantum (SMP) */
  127. #define TS_USEDFPU 0x0001
  128. #endif /* __KERNEL__ */
  129. #endif /* _ASM_MICROBLAZE_THREAD_INFO_H */