sigcontext_powerpc.h 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. #ifndef _ASM_POWERPC_SIGCONTEXT_H
  3. #define _ASM_POWERPC_SIGCONTEXT_H
  4. /*
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. */
  10. #include <asm/ptrace.h>
  11. #ifdef __powerpc64__
  12. #include <asm/elf.h>
  13. #endif
  14. struct sigcontext {
  15. unsigned long _unused[4];
  16. int signal;
  17. #ifdef __powerpc64__
  18. int _pad0;
  19. #endif
  20. unsigned long handler;
  21. unsigned long oldmask;
  22. struct pt_regs *regs;
  23. #ifdef __powerpc64__
  24. elf_gregset_t gp_regs;
  25. elf_fpregset_t fp_regs;
  26. /*
  27. * To maintain compatibility with current implementations the sigcontext is
  28. * extended by appending a pointer (v_regs) to a quadword type (elf_vrreg_t)
  29. * followed by an unstructured (vmx_reserve) field of 101 doublewords. This
  30. * allows the array of vector registers to be quadword aligned independent of
  31. * the alignment of the containing sigcontext or ucontext. It is the
  32. * responsibility of the code setting the sigcontext to set this pointer to
  33. * either NULL (if this processor does not support the VMX feature) or the
  34. * address of the first quadword within the allocated (vmx_reserve) area.
  35. *
  36. * The pointer (v_regs) of vector type (elf_vrreg_t) is type compatible with
  37. * an array of 34 quadword entries (elf_vrregset_t). The entries with
  38. * indexes 0-31 contain the corresponding vector registers. The entry with
  39. * index 32 contains the vscr as the last word (offset 12) within the
  40. * quadword. This allows the vscr to be stored as either a quadword (since
  41. * it must be copied via a vector register to/from storage) or as a word.
  42. * The entry with index 33 contains the vrsave as the first word (offset 0)
  43. * within the quadword.
  44. *
  45. * Part of the VSX data is stored here also by extending vmx_restore
  46. * by an additional 32 double words. Architecturally the layout of
  47. * the VSR registers and how they overlap on top of the legacy FPR and
  48. * VR registers is shown below:
  49. *
  50. * VSR doubleword 0 VSR doubleword 1
  51. * ----------------------------------------------------------------
  52. * VSR[0] | FPR[0] | |
  53. * ----------------------------------------------------------------
  54. * VSR[1] | FPR[1] | |
  55. * ----------------------------------------------------------------
  56. * | ... | |
  57. * | ... | |
  58. * ----------------------------------------------------------------
  59. * VSR[30] | FPR[30] | |
  60. * ----------------------------------------------------------------
  61. * VSR[31] | FPR[31] | |
  62. * ----------------------------------------------------------------
  63. * VSR[32] | VR[0] |
  64. * ----------------------------------------------------------------
  65. * VSR[33] | VR[1] |
  66. * ----------------------------------------------------------------
  67. * | ... |
  68. * | ... |
  69. * ----------------------------------------------------------------
  70. * VSR[62] | VR[30] |
  71. * ----------------------------------------------------------------
  72. * VSR[63] | VR[31] |
  73. * ----------------------------------------------------------------
  74. *
  75. * FPR/VSR 0-31 doubleword 0 is stored in fp_regs, and VMX/VSR 32-63
  76. * is stored at the start of vmx_reserve. vmx_reserve is extended for
  77. * backwards compatility to store VSR 0-31 doubleword 1 after the VMX
  78. * registers and vscr/vrsave.
  79. */
  80. elf_vrreg_t *v_regs;
  81. long vmx_reserve[ELF_NVRREG + ELF_NVRREG + 1 + 32];
  82. #endif
  83. };
  84. #endif /* _ASM_POWERPC_SIGCONTEXT_H */