thread_info.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_M68K_THREAD_INFO_H
  3. #define _ASM_M68K_THREAD_INFO_H
  4. #include <asm/types.h>
  5. #include <asm/page.h>
  6. #include <asm/segment.h>
  7. /*
  8. * On machines with 4k pages we default to an 8k thread size, though we
  9. * allow a 4k with config option. Any other machine page size then
  10. * the thread size must match the page size (which is 8k and larger here).
  11. */
  12. #if PAGE_SHIFT < 13
  13. #ifdef CONFIG_4KSTACKS
  14. #define THREAD_SIZE 4096
  15. #else
  16. #define THREAD_SIZE 8192
  17. #endif
  18. #else
  19. #define THREAD_SIZE PAGE_SIZE
  20. #endif
  21. #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1)
  22. #ifndef __ASSEMBLY__
  23. struct thread_info {
  24. struct task_struct *task; /* main task structure */
  25. unsigned long flags;
  26. mm_segment_t addr_limit; /* thread address space */
  27. int preempt_count; /* 0 => preemptable, <0 => BUG */
  28. __u32 cpu; /* should always be 0 on m68k */
  29. unsigned long tp_value; /* thread pointer */
  30. };
  31. #endif /* __ASSEMBLY__ */
  32. #define INIT_THREAD_INFO(tsk) \
  33. { \
  34. .task = &tsk, \
  35. .addr_limit = KERNEL_DS, \
  36. .preempt_count = INIT_PREEMPT_COUNT, \
  37. }
  38. #ifndef __ASSEMBLY__
  39. /* how to get the thread information struct from C */
  40. static inline struct thread_info *current_thread_info(void)
  41. {
  42. struct thread_info *ti;
  43. __asm__(
  44. "move.l %%sp, %0 \n\t"
  45. "and.l %1, %0"
  46. : "=&d"(ti)
  47. : "di" (~(THREAD_SIZE-1))
  48. );
  49. return ti;
  50. }
  51. #endif
  52. /* entry.S relies on these definitions!
  53. * bits 0-7 are tested at every exception exit
  54. * bits 8-15 are also tested at syscall exit
  55. */
  56. #define TIF_NOTIFY_RESUME 5 /* callback before returning to user */
  57. #define TIF_SIGPENDING 6 /* signal pending */
  58. #define TIF_NEED_RESCHED 7 /* rescheduling necessary */
  59. #define TIF_DELAYED_TRACE 14 /* single step a syscall */
  60. #define TIF_SYSCALL_TRACE 15 /* syscall trace active */
  61. #define TIF_MEMDIE 16 /* is terminating due to OOM killer */
  62. #define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal */
  63. #endif /* _ASM_M68K_THREAD_INFO_H */