processor.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * Process/processor support for the Hexagon architecture
  3. *
  4. * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 and
  8. * only version 2 as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  18. * 02110-1301, USA.
  19. */
  20. #ifndef _ASM_PROCESSOR_H
  21. #define _ASM_PROCESSOR_H
  22. #ifndef __ASSEMBLY__
  23. #include <asm/mem-layout.h>
  24. #include <asm/registers.h>
  25. #include <asm/hexagon_vm.h>
  26. /* task_struct, defined elsewhere, is the "process descriptor" */
  27. struct task_struct;
  28. extern void start_thread(struct pt_regs *, unsigned long, unsigned long);
  29. /*
  30. * thread_struct is supposed to be for context switch data.
  31. * Specifically, to hold the state necessary to perform switch_to...
  32. */
  33. struct thread_struct {
  34. void *switch_sp;
  35. };
  36. /*
  37. * initializes thread_struct
  38. * The only thing we have in there is switch_sp
  39. * which doesn't really need to be initialized.
  40. */
  41. #define INIT_THREAD { \
  42. }
  43. #define cpu_relax() __vmyield()
  44. /*
  45. * Decides where the kernel will search for a free chunk of vm space during
  46. * mmaps.
  47. * See also arch_get_unmapped_area.
  48. * Doesn't affect if you have MAX_FIXED in the page flags set though...
  49. *
  50. * Apparently the convention is that ld.so will ask for "unmapped" private
  51. * memory to be allocated SOMEWHERE, but it also asks for memory explicitly
  52. * via MAP_FIXED at the lower * addresses starting at VA=0x0.
  53. *
  54. * If the two requests collide, you get authentic segfaulting action, so
  55. * you have to kick the "unmapped" base requests higher up.
  56. */
  57. #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE/3))
  58. #define task_pt_regs(task) \
  59. ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
  60. #define KSTK_EIP(tsk) (pt_elr(task_pt_regs(tsk)))
  61. #define KSTK_ESP(tsk) (pt_psp(task_pt_regs(tsk)))
  62. /* Free all resources held by a thread; defined in process.c */
  63. extern void release_thread(struct task_struct *dead_task);
  64. /* Get wait channel for task P. */
  65. extern unsigned long get_wchan(struct task_struct *p);
  66. /* The following stuff is pretty HEXAGON specific. */
  67. /* This is really just here for __switch_to.
  68. Offsets are pulled via asm-offsets.c */
  69. /*
  70. * No real reason why VM and native switch stacks should be different.
  71. * Ultimately this should merge. Note that Rev C. ABI called out only
  72. * R24-27 as callee saved GPRs needing explicit attention (R29-31 being
  73. * dealt with automagically by allocframe), but the current ABI has
  74. * more, R16-R27. By saving more, the worst case is that we waste some
  75. * cycles if building with the old compilers.
  76. */
  77. struct hexagon_switch_stack {
  78. union {
  79. struct {
  80. unsigned long r16;
  81. unsigned long r17;
  82. };
  83. unsigned long long r1716;
  84. };
  85. union {
  86. struct {
  87. unsigned long r18;
  88. unsigned long r19;
  89. };
  90. unsigned long long r1918;
  91. };
  92. union {
  93. struct {
  94. unsigned long r20;
  95. unsigned long r21;
  96. };
  97. unsigned long long r2120;
  98. };
  99. union {
  100. struct {
  101. unsigned long r22;
  102. unsigned long r23;
  103. };
  104. unsigned long long r2322;
  105. };
  106. union {
  107. struct {
  108. unsigned long r24;
  109. unsigned long r25;
  110. };
  111. unsigned long long r2524;
  112. };
  113. union {
  114. struct {
  115. unsigned long r26;
  116. unsigned long r27;
  117. };
  118. unsigned long long r2726;
  119. };
  120. unsigned long fp;
  121. unsigned long lr;
  122. };
  123. #endif /* !__ASSEMBLY__ */
  124. #endif