thread_info.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. /* get the thread information struct of current task */
  55. static inline __attribute__((const))
  56. struct thread_info *current_thread_info(void)
  57. {
  58. struct thread_info *ti;
  59. asm volatile (" clr .s2 B15,0,%1,%0\n"
  60. : "=b" (ti)
  61. : "Iu5" (THREAD_SHIFT - 1));
  62. return ti;
  63. }
  64. #define get_thread_info(ti) get_task_struct((ti)->task)
  65. #define put_thread_info(ti) put_task_struct((ti)->task)
  66. #endif /* __ASSEMBLY__ */
  67. /*
  68. * thread information flag bit numbers
  69. * - pending work-to-be-done flags are in LSW
  70. * - other flags in MSW
  71. */
  72. #define TIF_SYSCALL_TRACE 0 /* syscall trace active */
  73. #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */
  74. #define TIF_SIGPENDING 2 /* signal pending */
  75. #define TIF_NEED_RESCHED 3 /* rescheduling necessary */
  76. #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
  77. #define TIF_MEMDIE 17 /* OOM killer killed process */
  78. #define TIF_WORK_MASK 0x00007FFE /* work on irq/exception return */
  79. #define TIF_ALLWORK_MASK 0x00007FFF /* work on any return to u-space */
  80. #endif /* __KERNEL__ */
  81. #endif /* _ASM_C6X_THREAD_INFO_H */