thread_info.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * linux/include/asm-arm26/thread_info.h
  3. *
  4. * Copyright (C) 2002 Russell King.
  5. * Copyright (C) 2003 Ian Molton.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef __ASM_ARM_THREAD_INFO_H
  12. #define __ASM_ARM_THREAD_INFO_H
  13. #ifdef __KERNEL__
  14. #ifndef __ASSEMBLY__
  15. struct task_struct;
  16. struct exec_domain;
  17. #include <linux/compiler.h>
  18. #include <asm/fpstate.h>
  19. #include <asm/ptrace.h>
  20. #include <asm/types.h>
  21. typedef unsigned long mm_segment_t;
  22. struct cpu_context_save {
  23. __u32 r4;
  24. __u32 r5;
  25. __u32 r6;
  26. __u32 r7;
  27. __u32 r8;
  28. __u32 r9;
  29. __u32 sl;
  30. __u32 fp;
  31. __u32 sp;
  32. __u32 pc;
  33. };
  34. /*
  35. * low level task data that entry.S needs immediate access to.
  36. * We assume cpu_context follows immedately after cpu_domain.
  37. */
  38. struct thread_info {
  39. unsigned long flags; /* low level flags */
  40. int preempt_count; /* 0 => preemptable, <0 => bug */
  41. mm_segment_t addr_limit; /* address limit */
  42. struct task_struct *task; /* main task structure */
  43. struct exec_domain *exec_domain; /* execution domain */
  44. __u32 cpu; /* cpu */
  45. struct cpu_context_save cpu_context; /* cpu context */
  46. struct restart_block restart_block;
  47. union fp_state fpstate;
  48. };
  49. #define INIT_THREAD_INFO(tsk) \
  50. { \
  51. .task &tsk, \
  52. .exec_domain &default_exec_domain, \
  53. .flags 0, \
  54. .preempt_count 0, \
  55. .addr_limit KERNEL_DS, \
  56. .restart_block = { \
  57. .fn = do_no_restart_syscall, \
  58. }, \
  59. }
  60. #define init_thread_info (init_thread_union.thread_info)
  61. #define init_stack (init_thread_union.stack)
  62. /*
  63. * how to get the thread information struct from C
  64. */
  65. static inline struct thread_info *current_thread_info(void) __attribute_const__;
  66. static inline struct thread_info *current_thread_info(void)
  67. {
  68. register unsigned long sp asm ("sp");
  69. return (struct thread_info *)(sp & ~0x1fff);
  70. }
  71. #define THREAD_SIZE PAGE_SIZE
  72. #define task_pt_regs(task) ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE - 8) - 1)
  73. extern struct thread_info *alloc_thread_info(struct task_struct *task);
  74. extern void free_thread_info(struct thread_info *);
  75. #define thread_saved_pc(tsk) \
  76. ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
  77. #define thread_saved_fp(tsk) \
  78. ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
  79. #else /* !__ASSEMBLY__ */
  80. #define TI_FLAGS 0
  81. #define TI_PREEMPT 4
  82. #define TI_ADDR_LIMIT 8
  83. #define TI_TASK 12
  84. #define TI_EXEC_DOMAIN 16
  85. #define TI_CPU 20
  86. #define TI_CPU_SAVE 24
  87. #define TI_RESTART_BLOCK 28
  88. #define TI_FPSTATE 68
  89. #endif
  90. #define PREEMPT_ACTIVE 0x04000000
  91. /*
  92. * thread information flags:
  93. * TIF_SYSCALL_TRACE - syscall trace active
  94. * TIF_NOTIFY_RESUME - resumption notification requested
  95. * TIF_SIGPENDING - signal pending
  96. * TIF_NEED_RESCHED - rescheduling necessary
  97. * TIF_USEDFPU - FPU was used by this task this quantum (SMP)
  98. * TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED
  99. */
  100. #define TIF_NOTIFY_RESUME 0
  101. #define TIF_SIGPENDING 1
  102. #define TIF_NEED_RESCHED 2
  103. #define TIF_SYSCALL_TRACE 8
  104. #define TIF_USED_FPU 16
  105. #define TIF_POLLING_NRFLAG 17
  106. #define TIF_MEMDIE 18
  107. #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
  108. #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
  109. #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
  110. #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
  111. #define _TIF_USED_FPU (1 << TIF_USED_FPU)
  112. #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
  113. /*
  114. * Change these and you break ASM code in entry-common.S
  115. */
  116. #define _TIF_WORK_MASK 0x000000ff
  117. #endif /* __KERNEL__ */
  118. #endif /* __ASM_ARM_THREAD_INFO_H */