thread_info.h 2.2 KB

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