signal32.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2001 Matthew Wilcox <willy at parisc-linux.org>
  3. * Copyright (C) 2003 Carlos O'Donell <carlos at parisc-linux.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef _PARISC64_KERNEL_SIGNAL32_H
  20. #define _PARISC64_KERNEL_SIGNAL32_H
  21. #include <linux/compat.h>
  22. /* 32-bit ucontext as seen from an 64-bit kernel */
  23. struct compat_ucontext {
  24. compat_uint_t uc_flags;
  25. compat_uptr_t uc_link;
  26. compat_stack_t uc_stack; /* struct compat_sigaltstack (12 bytes)*/
  27. /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */
  28. compat_uint_t pad[1];
  29. struct compat_sigcontext uc_mcontext;
  30. compat_sigset_t uc_sigmask; /* mask last for extensibility */
  31. };
  32. /* ELF32 signal handling */
  33. /* In a deft move of uber-hackery, we decide to carry the top half of all
  34. * 64-bit registers in a non-portable, non-ABI, hidden structure.
  35. * Userspace can read the hidden structure if it *wants* but is never
  36. * guaranteed to be in the same place. In fact the uc_sigmask from the
  37. * ucontext_t structure may push the hidden register file downards
  38. */
  39. struct compat_regfile {
  40. /* Upper half of all the 64-bit registers that were truncated
  41. on a copy to a 32-bit userspace */
  42. compat_int_t rf_gr[32];
  43. compat_int_t rf_iasq[2];
  44. compat_int_t rf_iaoq[2];
  45. compat_int_t rf_sar;
  46. };
  47. #define COMPAT_SIGRETURN_TRAMP 4
  48. #define COMPAT_SIGRESTARTBLOCK_TRAMP 5
  49. #define COMPAT_TRAMP_SIZE (COMPAT_SIGRETURN_TRAMP + \
  50. COMPAT_SIGRESTARTBLOCK_TRAMP)
  51. struct compat_rt_sigframe {
  52. /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c
  53. Secondary to that it must protect the ERESTART_RESTARTBLOCK
  54. trampoline we left on the stack (we were bad and didn't
  55. change sp so we could run really fast.) */
  56. compat_uint_t tramp[COMPAT_TRAMP_SIZE];
  57. compat_siginfo_t info;
  58. struct compat_ucontext uc;
  59. /* Hidden location of truncated registers, *must* be last. */
  60. struct compat_regfile regs;
  61. };
  62. /*
  63. * The 32-bit ABI wants at least 48 bytes for a function call frame:
  64. * 16 bytes for arg0-arg3, and 32 bytes for magic (the only part of
  65. * which Linux/parisc uses is sp-20 for the saved return pointer...)
  66. * Then, the stack pointer must be rounded to a cache line (64 bytes).
  67. */
  68. #define SIGFRAME32 64
  69. #define FUNCTIONCALLFRAME32 48
  70. #define PARISC_RT_SIGFRAME_SIZE32 (((sizeof(struct compat_rt_sigframe) + FUNCTIONCALLFRAME32) + SIGFRAME32) & -SIGFRAME32)
  71. long restore_sigcontext32(struct compat_sigcontext __user *sc,
  72. struct compat_regfile __user *rf,
  73. struct pt_regs *regs);
  74. long setup_sigcontext32(struct compat_sigcontext __user *sc,
  75. struct compat_regfile __user *rf,
  76. struct pt_regs *regs, int in_syscall);
  77. #endif