stack.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* SPARC stack layout Macros and structures,
  2. * mainly taken from BCC (the Bare C compiler for
  3. * SPARC LEON2/3) sources.
  4. *
  5. * (C) Copyright 2007
  6. * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
  7. *
  8. * SPDX-License-Identifier: GPL-2.0+
  9. */
  10. #ifndef __SPARC_STACK_H__
  11. #define __SPARC_STACK_H__
  12. #include <asm/ptrace.h>
  13. #ifndef __ASSEMBLER__
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #define PT_REGS_SZ sizeof(struct pt_regs)
  18. /* A Sparc stack frame */
  19. struct sparc_stackframe_regs {
  20. unsigned long sf_locals[8];
  21. unsigned long sf_ins[6];
  22. struct sparc_stackframe_regs *sf_fp;
  23. unsigned long sf_callers_pc;
  24. char *sf_structptr;
  25. unsigned long sf_xargs[6];
  26. unsigned long sf_xxargs[1];
  27. };
  28. #define SF_REGS_SZ sizeof(struct sparc_stackframe_regs)
  29. /* A register window */
  30. struct sparc_regwindow_regs {
  31. unsigned long locals[8];
  32. unsigned long ins[8];
  33. };
  34. #define RW_REGS_SZ sizeof(struct sparc_regwindow_regs)
  35. /* A fpu window */
  36. struct sparc_fpuwindow_regs {
  37. unsigned long locals[32];
  38. unsigned long fsr;
  39. unsigned long lastctx;
  40. };
  41. #define FW_REGS_SZ sizeof(struct sparc_fpuwindow_regs)
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #else
  46. #define PT_REGS_SZ 0x50 /* 20*4 */
  47. #define SF_REGS_SZ 0x60 /* 24*4 */
  48. #define RW_REGS_SZ 0x20 /* 16*4 */
  49. #define FW_REGS_SZ 0x88 /* 34*4 */
  50. #endif /* !ASM */
  51. /* These are for pt_regs. */
  52. #define PT_PSR 0x0
  53. #define PT_PC 0x4
  54. #define PT_NPC 0x8
  55. #define PT_Y 0xc
  56. #define PT_G0 0x10
  57. #define PT_WIM PT_G0
  58. #define PT_G1 0x14
  59. #define PT_G2 0x18
  60. #define PT_G3 0x1c
  61. #define PT_G4 0x20
  62. #define PT_G5 0x24
  63. #define PT_G6 0x28
  64. #define PT_G7 0x2c
  65. #define PT_I0 0x30
  66. #define PT_I1 0x34
  67. #define PT_I2 0x38
  68. #define PT_I3 0x3c
  69. #define PT_I4 0x40
  70. #define PT_I5 0x44
  71. #define PT_I6 0x48
  72. #define PT_FP PT_I6
  73. #define PT_I7 0x4c
  74. /* Stack_frame offsets */
  75. #define SF_L0 0x00
  76. #define SF_L1 0x04
  77. #define SF_L2 0x08
  78. #define SF_L3 0x0c
  79. #define SF_L4 0x10
  80. #define SF_L5 0x14
  81. #define SF_L6 0x18
  82. #define SF_L7 0x1c
  83. #define SF_I0 0x20
  84. #define SF_I1 0x24
  85. #define SF_I2 0x28
  86. #define SF_I3 0x2c
  87. #define SF_I4 0x30
  88. #define SF_I5 0x34
  89. #define SF_FP 0x38
  90. #define SF_PC 0x3c
  91. #define SF_RETP 0x40
  92. #define SF_XARG0 0x44
  93. #define SF_XARG1 0x48
  94. #define SF_XARG2 0x4c
  95. #define SF_XARG3 0x50
  96. #define SF_XARG4 0x54
  97. #define SF_XARG5 0x58
  98. #define SF_XXARG 0x5c
  99. /* Reg_window offsets */
  100. #define RW_L0 0x00
  101. #define RW_L1 0x04
  102. #define RW_L2 0x08
  103. #define RW_L3 0x0c
  104. #define RW_L4 0x10
  105. #define RW_L5 0x14
  106. #define RW_L6 0x18
  107. #define RW_L7 0x1c
  108. #define RW_I0 0x20
  109. #define RW_I1 0x24
  110. #define RW_I2 0x28
  111. #define RW_I3 0x2c
  112. #define RW_I4 0x30
  113. #define RW_I5 0x34
  114. #define RW_I6 0x38
  115. #define RW_I7 0x3c
  116. /* Fpu_window offsets */
  117. #define FW_F0 0x00
  118. #define FW_F2 0x08
  119. #define FW_F4 0x10
  120. #define FW_F6 0x18
  121. #define FW_F8 0x20
  122. #define FW_F10 0x28
  123. #define FW_F12 0x30
  124. #define FW_F14 0x38
  125. #define FW_F16 0x40
  126. #define FW_F18 0x48
  127. #define FW_F20 0x50
  128. #define FW_F22 0x58
  129. #define FW_F24 0x60
  130. #define FW_F26 0x68
  131. #define FW_F28 0x70
  132. #define FW_F30 0x78
  133. #define FW_FSR 0x80
  134. #endif