thread_info.h 3.8 KB

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