sigcontext.h 4.3 KB

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