/arch/alpha/include/asm/thread_info.h

http://github.com/mirrors/linux · C Header · 112 lines · 78 code · 18 blank · 16 comment · 6 complexity · fb22d54fe02368f1563bf3a1966ff00b MD5 · raw file

  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ALPHA_THREAD_INFO_H
  3. #define _ALPHA_THREAD_INFO_H
  4. #ifdef __KERNEL__
  5. #ifndef __ASSEMBLY__
  6. #include <asm/processor.h>
  7. #include <asm/types.h>
  8. #include <asm/hwrpb.h>
  9. #include <asm/sysinfo.h>
  10. #endif
  11. #ifndef __ASSEMBLY__
  12. struct thread_info {
  13. struct pcb_struct pcb; /* palcode state */
  14. struct task_struct *task; /* main task structure */
  15. unsigned int flags; /* low level flags */
  16. unsigned int ieee_state; /* see fpu.h */
  17. mm_segment_t addr_limit; /* thread address space */
  18. unsigned cpu; /* current CPU */
  19. int preempt_count; /* 0 => preemptable, <0 => BUG */
  20. unsigned int status; /* thread-synchronous flags */
  21. int bpt_nsaved;
  22. unsigned long bpt_addr[2]; /* breakpoint handling */
  23. unsigned int bpt_insn[2];
  24. };
  25. /*
  26. * Macros/functions for gaining access to the thread information structure.
  27. */
  28. #define INIT_THREAD_INFO(tsk) \
  29. { \
  30. .task = &tsk, \
  31. .addr_limit = KERNEL_DS, \
  32. .preempt_count = INIT_PREEMPT_COUNT, \
  33. }
  34. /* How to get the thread information struct from C. */
  35. register struct thread_info *__current_thread_info __asm__("$8");
  36. #define current_thread_info() __current_thread_info
  37. #endif /* __ASSEMBLY__ */
  38. /* Thread information allocation. */
  39. #define THREAD_SIZE_ORDER 1
  40. #define THREAD_SIZE (2*PAGE_SIZE)
  41. /*
  42. * Thread information flags:
  43. * - these are process state flags and used from assembly
  44. * - pending work-to-be-done flags come first and must be assigned to be
  45. * within bits 0 to 7 to fit in and immediate operand.
  46. *
  47. * TIF_SYSCALL_TRACE is known to be 0 via blbs.
  48. */
  49. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  50. #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
  51. #define TIF_SIGPENDING 2 /* signal pending */
  52. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  53. #define TIF_SYSCALL_AUDIT 4 /* syscall audit active */
  54. #define TIF_DIE_IF_KERNEL 9 /* dik recursion lock */
  55. #define TIF_MEMDIE 13 /* is terminating due to OOM killer */
  56. #define TIF_POLLING_NRFLAG 14 /* idle is polling for TIF_NEED_RESCHED */
  57. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  58. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  59. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  60. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  61. #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
  62. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  63. /* Work to do on interrupt/exception return. */
  64. #define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
  65. _TIF_NOTIFY_RESUME)
  66. /* Work to do on any return to userspace. */
  67. #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK \
  68. | _TIF_SYSCALL_TRACE)
  69. #define TS_UAC_NOPRINT 0x0001 /* ! Preserve the following three */
  70. #define TS_UAC_NOFIX 0x0002 /* ! flags as they match */
  71. #define TS_UAC_SIGBUS 0x0004 /* ! userspace part of 'osf_sysinfo' */
  72. #define SET_UNALIGN_CTL(task,value) ({ \
  73. __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
  74. if (value & PR_UNALIGN_NOPRINT) \
  75. status |= TS_UAC_NOPRINT; \
  76. if (value & PR_UNALIGN_SIGBUS) \
  77. status |= TS_UAC_SIGBUS; \
  78. if (value & 4) /* alpha-specific */ \
  79. status |= TS_UAC_NOFIX; \
  80. task_thread_info(task)->status = status; \
  81. 0; })
  82. #define GET_UNALIGN_CTL(task,value) ({ \
  83. __u32 status = task_thread_info(task)->status & ~UAC_BITMASK; \
  84. __u32 res = 0; \
  85. if (status & TS_UAC_NOPRINT) \
  86. res |= PR_UNALIGN_NOPRINT; \
  87. if (status & TS_UAC_SIGBUS) \
  88. res |= PR_UNALIGN_SIGBUS; \
  89. if (status & TS_UAC_NOFIX) \
  90. res |= 4; \
  91. put_user(res, (int __user *)(value)); \
  92. })
  93. #endif /* __KERNEL__ */
  94. #endif /* _ALPHA_THREAD_INFO_H */