thread_info.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* thread_info.h: CRIS low-level thread information
  2. *
  3. * Copyright (C) 2002 David Howells (dhowells@redhat.com)
  4. * - Incorporating suggestions made by Linus Torvalds and Dave Miller
  5. *
  6. * CRIS port by Axis Communications
  7. */
  8. #ifndef _ASM_THREAD_INFO_H
  9. #define _ASM_THREAD_INFO_H
  10. #ifdef __KERNEL__
  11. #ifndef __ASSEMBLY__
  12. #include <asm/types.h>
  13. #include <asm/processor.h>
  14. #include <arch/thread_info.h>
  15. #include <asm/segment.h>
  16. #endif
  17. /*
  18. * low level task data that entry.S needs immediate access to
  19. * - this struct should fit entirely inside of one cache line
  20. * - this struct shares the supervisor stack pages
  21. * - if the contents of this structure are changed, the assembly constants must also be changed
  22. */
  23. #ifndef __ASSEMBLY__
  24. struct thread_info {
  25. struct task_struct *task; /* main task structure */
  26. struct exec_domain *exec_domain; /* execution domain */
  27. unsigned long flags; /* low level flags */
  28. __u32 cpu; /* current CPU */
  29. int preempt_count; /* 0 => preemptable, <0 => BUG */
  30. __u32 tls; /* TLS for this thread */
  31. mm_segment_t addr_limit; /* thread address space:
  32. 0-0xBFFFFFFF for user-thead
  33. 0-0xFFFFFFFF for kernel-thread
  34. */
  35. struct restart_block restart_block;
  36. __u8 supervisor_stack[0];
  37. };
  38. #endif
  39. #define PREEMPT_ACTIVE 0x10000000
  40. /*
  41. * macros/functions for gaining access to the thread information structure
  42. */
  43. #ifndef __ASSEMBLY__
  44. #define INIT_THREAD_INFO(tsk) \
  45. { \
  46. .task = &tsk, \
  47. .exec_domain = &default_exec_domain, \
  48. .flags = 0, \
  49. .cpu = 0, \
  50. .preempt_count = INIT_PREEMPT_COUNT, \
  51. .addr_limit = KERNEL_DS, \
  52. .restart_block = { \
  53. .fn = do_no_restart_syscall, \
  54. }, \
  55. }
  56. #define init_thread_info (init_thread_union.thread_info)
  57. #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
  58. /* thread information allocation */
  59. #define alloc_thread_info_node(tsk, node) \
  60. ((struct thread_info *) __get_free_pages(GFP_KERNEL, 1))
  61. #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  62. #endif /* !__ASSEMBLY__ */
  63. /*
  64. * thread information flags
  65. * - these are process state flags that various assembly files 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_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
  74. #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
  75. #define TIF_MEMDIE 17 /* is terminating due to OOM killer */
  76. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  77. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  78. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  79. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  80. #define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
  81. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  82. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  83. #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
  84. #endif /* __KERNEL__ */
  85. #endif /* _ASM_THREAD_INFO_H */