thread_info_32.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * thread_info.h: sparc low-level thread information
  3. * adapted from the ppc version by Pete Zaitcev, which was
  4. * adapted from the i386 version by Paul Mackerras
  5. *
  6. * Copyright (C) 2002 David Howells (dhowells@redhat.com)
  7. * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
  8. * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  9. */
  10. #ifndef _ASM_THREAD_INFO_H
  11. #define _ASM_THREAD_INFO_H
  12. #ifdef __KERNEL__
  13. #ifndef __ASSEMBLY__
  14. #include <asm/btfixup.h>
  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. struct exec_domain *exec_domain; /* execution domain */
  27. unsigned long flags; /* low level flags */
  28. int cpu; /* cpu we're on */
  29. int preempt_count; /* 0 => preemptable,
  30. <0 => BUG */
  31. int softirq_count;
  32. int hardirq_count;
  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. struct restart_block restart_block;
  45. };
  46. /*
  47. * macros/functions for gaining access to the thread information structure
  48. *
  49. * preempt_count needs to be 1 initially, until the scheduler is functional.
  50. */
  51. #define INIT_THREAD_INFO(tsk) \
  52. { \
  53. .uwinmask = 0, \
  54. .task = &tsk, \
  55. .exec_domain = &default_exec_domain, \
  56. .flags = 0, \
  57. .cpu = 0, \
  58. .preempt_count = 1, \
  59. .restart_block = { \
  60. .fn = do_no_restart_syscall, \
  61. }, \
  62. }
  63. #define init_thread_info (init_thread_union.thread_info)
  64. #define init_stack (init_thread_union.stack)
  65. /* how to get the thread information struct from C */
  66. register struct thread_info *current_thread_info_reg asm("g6");
  67. #define current_thread_info() (current_thread_info_reg)
  68. /*
  69. * thread information allocation
  70. */
  71. #define THREAD_INFO_ORDER 1
  72. #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
  73. BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void)
  74. #define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)()
  75. BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
  76. #define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
  77. #endif /* __ASSEMBLY__ */
  78. /*
  79. * Size of kernel stack for each process.
  80. * Observe the order of get_free_pages() in alloc_thread_info().
  81. * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.
  82. */
  83. #define THREAD_SIZE 8192
  84. /*
  85. * Offsets in thread_info structure, used in assembly code
  86. * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
  87. */
  88. #define TI_UWINMASK 0x00 /* uwinmask */
  89. #define TI_TASK 0x04
  90. #define TI_EXECDOMAIN 0x08 /* exec_domain */
  91. #define TI_FLAGS 0x0c
  92. #define TI_CPU 0x10
  93. #define TI_PREEMPT 0x14 /* preempt_count */
  94. #define TI_SOFTIRQ 0x18 /* softirq_count */
  95. #define TI_HARDIRQ 0x1c /* hardirq_count */
  96. #define TI_KSP 0x20 /* ksp */
  97. #define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */
  98. #define TI_KPSR 0x28 /* kpsr */
  99. #define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */
  100. #define TI_REG_WINDOW 0x30
  101. #define TI_RWIN_SPTRS 0x230
  102. #define TI_W_SAVED 0x250
  103. /* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */
  104. #define PREEMPT_ACTIVE 0x4000000
  105. /*
  106. * thread information flag bit numbers
  107. */
  108. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  109. #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
  110. #define TIF_SIGPENDING 2 /* signal pending */
  111. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  112. #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
  113. #define TIF_USEDFPU 8 /* FPU was used by this task
  114. * this quantum (SMP) */
  115. #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
  116. * TIF_NEED_RESCHED */
  117. #define TIF_MEMDIE 10
  118. #define TIF_FREEZE 11 /* is freezing for suspend */
  119. /* as above, but as bit values */
  120. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  121. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  122. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  123. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  124. #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
  125. #define _TIF_USEDFPU (1<<TIF_USEDFPU)
  126. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  127. #define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
  128. _TIF_SIGPENDING | \
  129. _TIF_RESTORE_SIGMASK)
  130. #define _TIF_FREEZE (1<<TIF_FREEZE)
  131. #endif /* __KERNEL__ */
  132. #endif /* _ASM_THREAD_INFO_H */