thread_info.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Port on Texas Instruments TMS320C6x architecture
  3. *
  4. * Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
  5. * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
  6. *
  7. * Updated for 2.6.3x: Mark Salter <msalter@redhat.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #ifndef _ASM_C6X_THREAD_INFO_H
  14. #define _ASM_C6X_THREAD_INFO_H
  15. #ifdef __KERNEL__
  16. #include <asm/page.h>
  17. #ifdef CONFIG_4KSTACKS
  18. #define THREAD_SIZE 4096
  19. #define THREAD_SHIFT 12
  20. #define THREAD_SIZE_ORDER 0
  21. #else
  22. #define THREAD_SIZE 8192
  23. #define THREAD_SHIFT 13
  24. #define THREAD_SIZE_ORDER 1
  25. #endif
  26. #define THREAD_START_SP (THREAD_SIZE - 8)
  27. #ifndef __ASSEMBLY__
  28. typedef struct {
  29. unsigned long seg;
  30. } mm_segment_t;
  31. /*
  32. * low level task data.
  33. */
  34. struct thread_info {
  35. struct task_struct *task; /* main task structure */
  36. unsigned long flags; /* low level flags */
  37. int cpu; /* cpu we're on */
  38. int preempt_count; /* 0 = preemptable, <0 = BUG */
  39. mm_segment_t addr_limit; /* thread address space */
  40. };
  41. /*
  42. * macros/functions for gaining access to the thread information structure
  43. *
  44. * preempt_count needs to be 1 initially, until the scheduler is functional.
  45. */
  46. #define INIT_THREAD_INFO(tsk) \
  47. { \
  48. .task = &tsk, \
  49. .flags = 0, \
  50. .cpu = 0, \
  51. .preempt_count = INIT_PREEMPT_COUNT, \
  52. .addr_limit = KERNEL_DS, \
  53. }
  54. #define init_thread_info (init_thread_union.thread_info)
  55. #define init_stack (init_thread_union.stack)
  56. /* get the thread information struct of current task */
  57. static inline __attribute__((const))
  58. struct thread_info *current_thread_info(void)
  59. {
  60. struct thread_info *ti;
  61. asm volatile (" clr .s2 B15,0,%1,%0\n"
  62. : "=b" (ti)
  63. : "Iu5" (THREAD_SHIFT - 1));
  64. return ti;
  65. }
  66. #define get_thread_info(ti) get_task_struct((ti)->task)
  67. #define put_thread_info(ti) put_task_struct((ti)->task)
  68. #endif /* __ASSEMBLY__ */
  69. /*
  70. * thread information flag bit numbers
  71. * - pending work-to-be-done flags are in LSW
  72. * - other flags in MSW
  73. */
  74. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  75. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  76. #define TIF_SIGPENDING 2 /* signal pending */
  77. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  78. #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
  79. #define TIF_MEMDIE 17 /* OOM killer killed process */
  80. #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */
  81. #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */
  82. #endif /* __KERNEL__ */
  83. #endif /* _ASM_C6X_THREAD_INFO_H */