thread_info.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #ifndef __ASM_SH64_THREAD_INFO_H
  2. #define __ASM_SH64_THREAD_INFO_H
  3. /*
  4. * SuperH 5 version
  5. * Copyright (C) 2003 Paul Mundt
  6. */
  7. #ifdef __KERNEL__
  8. #ifndef __ASSEMBLY__
  9. #include <asm/registers.h>
  10. /*
  11. * low level task data that entry.S needs immediate access to
  12. * - this struct should fit entirely inside of one cache line
  13. * - this struct shares the supervisor stack pages
  14. * - if the contents of this structure are changed, the assembly constants must also be changed
  15. */
  16. struct thread_info {
  17. struct task_struct *task; /* main task structure */
  18. struct exec_domain *exec_domain; /* execution domain */
  19. unsigned long flags; /* low level flags */
  20. /* Put the 4 32-bit fields together to make asm offsetting easier. */
  21. int preempt_count; /* 0 => preemptable, <0 => BUG */
  22. __u16 cpu;
  23. mm_segment_t addr_limit;
  24. struct restart_block restart_block;
  25. __u8 supervisor_stack[0];
  26. };
  27. /*
  28. * macros/functions for gaining access to the thread information structure
  29. */
  30. #define INIT_THREAD_INFO(tsk) \
  31. { \
  32. .task = &tsk, \
  33. .exec_domain = &default_exec_domain, \
  34. .flags = 0, \
  35. .cpu = 0, \
  36. .preempt_count = 1, \
  37. .addr_limit = KERNEL_DS, \
  38. .restart_block = { \
  39. .fn = do_no_restart_syscall, \
  40. }, \
  41. }
  42. #define init_thread_info (init_thread_union.thread_info)
  43. #define init_stack (init_thread_union.stack)
  44. /* how to get the thread information struct from C */
  45. static inline struct thread_info *current_thread_info(void)
  46. {
  47. struct thread_info *ti;
  48. __asm__ __volatile__ ("getcon " __KCR0 ", %0\n\t" : "=r" (ti));
  49. return ti;
  50. }
  51. /* thread information allocation */
  52. #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
  53. #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
  54. #define get_thread_info(ti) get_task_struct((ti)->task)
  55. #define put_thread_info(ti) put_task_struct((ti)->task)
  56. #endif /* __ASSEMBLY__ */
  57. #define THREAD_SIZE 8192
  58. #define PREEMPT_ACTIVE 0x10000000
  59. /* thread information flags */
  60. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  61. #define TIF_SIGPENDING 2 /* signal pending */
  62. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  63. #define TIF_MEMDIE 4
  64. #endif /* __KERNEL__ */
  65. #endif /* __ASM_SH64_THREAD_INFO_H */