thread_info.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Thread support for the Hexagon architecture
  4. *
  5. * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
  6. */
  7. #ifndef _ASM_THREAD_INFO_H
  8. #define _ASM_THREAD_INFO_H
  9. #ifdef __KERNEL__
  10. #ifndef __ASSEMBLY__
  11. #include <asm/processor.h>
  12. #include <asm/registers.h>
  13. #include <asm/page.h>
  14. #endif
  15. #define THREAD_SHIFT 12
  16. #define THREAD_SIZE (1<<THREAD_SHIFT)
  17. #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
  18. #ifndef __ASSEMBLY__
  19. /*
  20. * This is union'd with the "bottom" of the kernel stack.
  21. * It keeps track of thread info which is handy for routines
  22. * to access quickly.
  23. */
  24. struct thread_info {
  25. struct task_struct *task; /* main task structure */
  26. unsigned long flags; /* low level flags */
  27. __u32 cpu; /* current cpu */
  28. int preempt_count; /* 0=>preemptible,<0=>BUG */
  29. /*
  30. * used for syscalls somehow;
  31. * seems to have a function pointer and four arguments
  32. */
  33. /* Points to the current pt_regs frame */
  34. struct pt_regs *regs;
  35. /*
  36. * saved kernel sp at switch_to time;
  37. * not sure if this is used (it's not in the VM model it seems;
  38. * see thread_struct)
  39. */
  40. unsigned long sp;
  41. };
  42. #else /* !__ASSEMBLY__ */
  43. #include <asm/asm-offsets.h>
  44. #endif /* __ASSEMBLY__ */
  45. #ifndef __ASSEMBLY__
  46. #define INIT_THREAD_INFO(tsk) \
  47. { \
  48. .task = &tsk, \
  49. .flags = 0, \
  50. .cpu = 0, \
  51. .preempt_count = 1, \
  52. .sp = 0, \
  53. .regs = NULL, \
  54. }
  55. /* Tacky preprocessor trickery */
  56. #define qqstr(s) qstr(s)
  57. #define qstr(s) #s
  58. #define QUOTED_THREADINFO_REG qqstr(THREADINFO_REG)
  59. register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG);
  60. #define current_thread_info() __current_thread_info
  61. #endif /* __ASSEMBLY__ */
  62. /*
  63. * thread information flags
  64. * - these are process state flags that various assembly files
  65. * may need to access
  66. * - pending work-to-be-done flags are in LSW
  67. * - other flags in MSW
  68. */
  69. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  70. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  71. #define TIF_SIGPENDING 2 /* signal pending */
  72. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  73. #define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */
  74. #define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */
  75. #define TIF_NOTIFY_SIGNAL 7 /* signal notifications exist */
  76. /* true if poll_idle() is polling TIF_NEED_RESCHED */
  77. #define TIF_MEMDIE 17 /* OOM killer killed process */
  78. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  79. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  80. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  81. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  82. #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
  83. #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL)
  84. /* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */
  85. #define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE)
  86. /* work to do on any return to u-space */
  87. #define _TIF_ALLWORK_MASK 0x0000FFFF
  88. #endif /* __KERNEL__ */
  89. #endif