processor.h 2.9 KB

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