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