thread_info.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. unsigned long flags; /* low level flags */
  27. __u32 cpu; /* current CPU */
  28. int preempt_count; /* 0 => preemptable, <0 => BUG */
  29. __u32 tls; /* TLS for this thread */
  30. mm_segment_t addr_limit; /* thread address space:
  31. 0-0xBFFFFFFF for user-thead
  32. 0-0xFFFFFFFF for kernel-thread
  33. */
  34. __u8 supervisor_stack[0];
  35. };
  36. #endif
  37. /*
  38. * macros/functions for gaining access to the thread information structure
  39. */
  40. #ifndef __ASSEMBLY__
  41. #define INIT_THREAD_INFO(tsk) \
  42. { \
  43. .task = &tsk, \
  44. .flags = 0, \
  45. .cpu = 0, \
  46. .preempt_count = INIT_PREEMPT_COUNT, \
  47. .addr_limit = KERNEL_DS, \
  48. }
  49. #define init_thread_info (init_thread_union.thread_info)
  50. #endif /* !__ASSEMBLY__ */
  51. /*
  52. * thread information flags
  53. * - these are process state flags that various assembly files may need to access
  54. * - pending work-to-be-done flags are in LSW
  55. * - other flags in MSW
  56. */
  57. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  58. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  59. #define TIF_SIGPENDING 2 /* signal pending */
  60. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  61. #define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
  62. #define TIF_MEMDIE 17 /* is terminating due to OOM killer */
  63. #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
  64. #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
  65. #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
  66. #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
  67. #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
  68. #define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */
  69. #endif /* __KERNEL__ */
  70. #endif /* _ASM_THREAD_INFO_H */