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