thread_info.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 <asm/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. mm_segment_t addr_limit; /* thread address space:
  31. 0-0xBFFFFFFF for user-thead
  32. 0-0xFFFFFFFF for kernel-thread
  33. */
  34. struct restart_block restart_block;
  35. __u8 supervisor_stack[0];
  36. };
  37. #endif
  38. #define PREEMPT_ACTIVE 0x10000000
  39. /*
  40. * macros/functions for gaining access to the thread information structure
  41. *
  42. * preempt_count needs to be 1 initially, until the scheduler is functional.
  43. */
  44. #ifndef __ASSEMBLY__
  45. #define INIT_THREAD_INFO(tsk) \
  46. { \
  47. .task = &tsk, \
  48. .exec_domain = &default_exec_domain, \
  49. .flags = 0, \
  50. .cpu = 0, \
  51. .preempt_count = 1, \
  52. .addr_limit = KERNEL_DS, \
  53. .restart_block = { \
  54. .fn = do_no_restart_syscall, \
  55. }, \
  56. }
  57. #define init_thread_info (init_thread_union.thread_info)
  58. /* thread information allocation */
  59. #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
  60. #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  61. #endif /* !__ASSEMBLY__ */
  62. /*
  63. * thread information flags
  64. * - these are process state flags that various assembly files may need to access
  65. * - pending work-to-be-done flags are in LSW
  66. * - other flags in MSW
  67. */
  68. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  69. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  70. #define TIF_SIGPENDING 2 /* signal pending */
  71. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  72. #define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
  73. #define TIF_MEMDIE 17
  74. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  75. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  76. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  77. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  78. #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
  79. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  80. #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
  81. #endif /* __KERNEL__ */
  82. #endif /* _ASM_THREAD_INFO_H */