thread_info.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* thread_info.h: description
  2. *
  3. * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. * Derived from include/asm-i386/thread_info.h
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #ifndef _ASM_THREAD_INFO_H
  13. #define _ASM_THREAD_INFO_H
  14. #ifdef __KERNEL__
  15. #ifndef __ASSEMBLY__
  16. #include <asm/processor.h>
  17. #endif
  18. #define THREAD_SIZE 8192
  19. /*
  20. * low level task data that entry.S needs immediate access to
  21. * - this struct should fit entirely inside of one cache line
  22. * - this struct shares the supervisor stack pages
  23. * - if the contents of this structure are changed, the assembly constants must also be changed
  24. */
  25. #ifndef __ASSEMBLY__
  26. struct thread_info {
  27. struct task_struct *task; /* main task structure */
  28. unsigned long flags; /* low level flags */
  29. unsigned long status; /* thread-synchronous flags */
  30. __u32 cpu; /* current CPU */
  31. int preempt_count; /* 0 => preemptable, <0 => BUG */
  32. mm_segment_t addr_limit; /* thread address space:
  33. * 0-0xBFFFFFFF for user-thead
  34. * 0-0xFFFFFFFF for kernel-thread
  35. */
  36. __u8 supervisor_stack[0];
  37. };
  38. #else /* !__ASSEMBLY__ */
  39. #include <asm/asm-offsets.h>
  40. #endif
  41. /*
  42. * macros/functions for gaining access to the thread information structure
  43. */
  44. #ifndef __ASSEMBLY__
  45. #define INIT_THREAD_INFO(tsk) \
  46. { \
  47. .task = &tsk, \
  48. .flags = 0, \
  49. .cpu = 0, \
  50. .preempt_count = INIT_PREEMPT_COUNT, \
  51. .addr_limit = KERNEL_DS, \
  52. }
  53. #define init_thread_info (init_thread_union.thread_info)
  54. #define init_stack (init_thread_union.stack)
  55. /* how to get the thread information struct from C */
  56. register struct thread_info *__current_thread_info asm("gr15");
  57. #define current_thread_info() ({ __current_thread_info; })
  58. #endif /* __ASSEMBLY__ */
  59. /*
  60. * thread information flags
  61. * - these are process state flags that various assembly files may need to access
  62. * - pending work-to-be-done flags are in LSW
  63. * - other flags in MSW
  64. */
  65. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  66. #define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
  67. #define TIF_SIGPENDING 2 /* signal pending */
  68. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  69. #define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */
  70. #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
  71. #define TIF_MEMDIE 7 /* is terminating due to OOM killer */
  72. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  73. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  74. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  75. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  76. #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
  77. /* work to do on interrupt/exception return */
  78. #define _TIF_WORK_MASK \
  79. (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP)
  80. /* work to do on any return to u-space */
  81. #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE)
  82. #if _TIF_ALLWORK_MASK >= 0x2000
  83. #error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)"
  84. #endif
  85. /*
  86. * Thread-synchronous status.
  87. *
  88. * This is different from the flags in that nobody else
  89. * ever touches our thread-synchronous status, so we don't
  90. * have to worry about atomic accesses.
  91. */
  92. #define TS_USEDFPM 0x0001 /* FPU/Media was used by this task this quantum (SMP) */
  93. #endif /* __KERNEL__ */
  94. #endif /* _ASM_THREAD_INFO_H */