signal32.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (C) 2001 Matthew Wilcox <willy at parisc-linux.org>
  4. * Copyright (C) 2003 Carlos O'Donell <carlos at parisc-linux.org>
  5. */
  6. #ifndef _PARISC64_KERNEL_SIGNAL32_H
  7. #define _PARISC64_KERNEL_SIGNAL32_H
  8. #include <linux/compat.h>
  9. /* 32-bit ucontext as seen from an 64-bit kernel */
  10. struct compat_ucontext {
  11. compat_uint_t uc_flags;
  12. compat_uptr_t uc_link;
  13. compat_stack_t uc_stack; /* struct compat_sigaltstack (12 bytes)*/
  14. /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */
  15. compat_uint_t pad[1];
  16. struct compat_sigcontext uc_mcontext;
  17. compat_sigset_t uc_sigmask; /* mask last for extensibility */
  18. };
  19. /* ELF32 signal handling */
  20. /* In a deft move of uber-hackery, we decide to carry the top half of all
  21. * 64-bit registers in a non-portable, non-ABI, hidden structure.
  22. * Userspace can read the hidden structure if it *wants* but is never
  23. * guaranteed to be in the same place. In fact the uc_sigmask from the
  24. * ucontext_t structure may push the hidden register file downards
  25. */
  26. struct compat_regfile {
  27. /* Upper half of all the 64-bit registers that were truncated
  28. on a copy to a 32-bit userspace */
  29. compat_int_t rf_gr[32];
  30. compat_int_t rf_iasq[2];
  31. compat_int_t rf_iaoq[2];
  32. compat_int_t rf_sar;
  33. };
  34. struct compat_rt_sigframe {
  35. unsigned int tramp[2]; /* holds original return address */
  36. compat_siginfo_t info;
  37. struct compat_ucontext uc;
  38. /* Hidden location of truncated registers, *must* be last. */
  39. struct compat_regfile regs;
  40. };
  41. /*
  42. * The 32-bit ABI wants at least 48 bytes for a function call frame:
  43. * 16 bytes for arg0-arg3, and 32 bytes for magic (the only part of
  44. * which Linux/parisc uses is sp-20 for the saved return pointer...)
  45. * Then, the stack pointer must be rounded to a cache line (64 bytes).
  46. */
  47. #define SIGFRAME32 64
  48. #define FUNCTIONCALLFRAME32 48
  49. #define PARISC_RT_SIGFRAME_SIZE32 (((sizeof(struct compat_rt_sigframe) + FUNCTIONCALLFRAME32) + SIGFRAME32) & -SIGFRAME32)
  50. long restore_sigcontext32(struct compat_sigcontext __user *sc,
  51. struct compat_regfile __user *rf,
  52. struct pt_regs *regs);
  53. long setup_sigcontext32(struct compat_sigcontext __user *sc,
  54. struct compat_regfile __user *rf,
  55. struct pt_regs *regs, int in_syscall);
  56. #endif