thread_info_32.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * thread_info.h: sparc low-level thread information
  4. * adapted from the ppc version by Pete Zaitcev, which was
  5. * adapted from the i386 version by Paul Mackerras
  6. *
  7. * Copyright (C) 2002 David Howells (dhowells@redhat.com)
  8. * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
  9. * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  10. */
  11. #ifndef _ASM_THREAD_INFO_H
  12. #define _ASM_THREAD_INFO_H
  13. #ifdef __KERNEL__
  14. #ifndef __ASSEMBLY__
  15. #include <asm/ptrace.h>
  16. #include <asm/page.h>
  17. /*
  18. * Low level task data.
  19. *
  20. * If you change this, change the TI_* offsets below to match.
  21. */
  22. #define NSWINS 8
  23. struct thread_info {
  24. unsigned long uwinmask;
  25. struct task_struct *task; /* main task structure */
  26. unsigned long flags; /* low level flags */
  27. int cpu; /* cpu we're on */
  28. int preempt_count; /* 0 => preemptable,
  29. <0 => BUG */
  30. int softirq_count;
  31. int hardirq_count;
  32. u32 __unused;
  33. /* Context switch saved kernel state. */
  34. unsigned long ksp; /* ... ksp __attribute__ ((aligned (8))); */
  35. unsigned long kpc;
  36. unsigned long kpsr;
  37. unsigned long kwim;
  38. /* A place to store user windows and stack pointers
  39. * when the stack needs inspection.
  40. */
  41. struct reg_window32 reg_window[NSWINS]; /* align for ldd! */
  42. unsigned long rwbuf_stkptrs[NSWINS];
  43. unsigned long w_saved;
  44. };
  45. /*
  46. * macros/functions for gaining access to the thread information structure
  47. */
  48. #define INIT_THREAD_INFO(tsk) \
  49. { \
  50. .uwinmask = 0, \
  51. .task = &tsk, \
  52. .flags = 0, \
  53. .cpu = 0, \
  54. .preempt_count = INIT_PREEMPT_COUNT, \
  55. }
  56. /* how to get the thread information struct from C */
  57. register struct thread_info *current_thread_info_reg asm("g6");
  58. #define current_thread_info() (current_thread_info_reg)
  59. /*
  60. * thread information allocation
  61. */
  62. #define THREAD_SIZE_ORDER 1
  63. #endif /* __ASSEMBLY__ */
  64. /* Size of kernel stack for each process */
  65. #define THREAD_SIZE (2 * PAGE_SIZE)
  66. /*
  67. * Offsets in thread_info structure, used in assembly code
  68. * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
  69. */
  70. #define TI_UWINMASK 0x00 /* uwinmask */
  71. #define TI_TASK 0x04
  72. #define TI_FLAGS 0x08
  73. #define TI_CPU 0x0c
  74. #define TI_PREEMPT 0x10 /* preempt_count */
  75. #define TI_SOFTIRQ 0x14 /* softirq_count */
  76. #define TI_HARDIRQ 0x18 /* hardirq_count */
  77. #define TI_KSP 0x20 /* ksp */
  78. #define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */
  79. #define TI_KPSR 0x28 /* kpsr */
  80. #define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */
  81. #define TI_REG_WINDOW 0x30
  82. #define TI_RWIN_SPTRS 0x230
  83. #define TI_W_SAVED 0x250
  84. /*
  85. * thread information flag bit numbers
  86. */
  87. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  88. #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
  89. #define TIF_SIGPENDING 2 /* signal pending */
  90. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  91. #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
  92. #define TIF_USEDFPU 8 /* FPU was used by this task
  93. * this quantum (SMP) */
  94. #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
  95. * TIF_NEED_RESCHED */
  96. #define TIF_MEMDIE 10 /* is terminating due to OOM killer */
  97. /* as above, but as bit values */
  98. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  99. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  100. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  101. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  102. #define _TIF_USEDFPU (1<<TIF_USEDFPU)
  103. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  104. #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
  105. _TIF_SIGPENDING)
  106. #define is_32bit_task() (1)
  107. #endif /* __KERNEL__ */
  108. #endif /* _ASM_THREAD_INFO_H */