Linux Audio

Check our new training course

Loading...
v5.4
 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
 9#include <linux/compat.h>
10
11/* 32-bit ucontext as seen from an 64-bit kernel */
12struct compat_ucontext {
13        compat_uint_t uc_flags;
14        compat_uptr_t uc_link;
15        compat_stack_t uc_stack;        /* struct compat_sigaltstack (12 bytes)*/
16        /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */
17        compat_uint_t pad[1];
18        struct compat_sigcontext uc_mcontext;
19        compat_sigset_t uc_sigmask;     /* mask last for extensibility */
20};
21
22/* ELF32 signal handling */
23
24/* In a deft move of uber-hackery, we decide to carry the top half of all
25 * 64-bit registers in a non-portable, non-ABI, hidden structure.
26 * Userspace can read the hidden structure if it *wants* but is never
27 * guaranteed to be in the same place. In fact the uc_sigmask from the
28 * ucontext_t structure may push the hidden register file downards
29 */
30struct compat_regfile {
31        /* Upper half of all the 64-bit registers that were truncated
32           on a copy to a 32-bit userspace */
33        compat_int_t rf_gr[32];
34        compat_int_t rf_iasq[2];
35        compat_int_t rf_iaoq[2];
36        compat_int_t rf_sar;
37};
38
39#define COMPAT_SIGRETURN_TRAMP 4
40#define COMPAT_SIGRESTARTBLOCK_TRAMP 5
41#define COMPAT_TRAMP_SIZE (COMPAT_SIGRETURN_TRAMP + \
42				COMPAT_SIGRESTARTBLOCK_TRAMP)
43
44struct compat_rt_sigframe {
45        /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c
46                Secondary to that it must protect the ERESTART_RESTARTBLOCK
47                trampoline we left on the stack (we were bad and didn't
48                change sp so we could run really fast.) */
49        compat_uint_t tramp[COMPAT_TRAMP_SIZE];
50        compat_siginfo_t info;
51        struct compat_ucontext uc;
52        /* Hidden location of truncated registers, *must* be last. */
53        struct compat_regfile regs;
54};
55
56/*
57 * The 32-bit ABI wants at least 48 bytes for a function call frame:
58 * 16 bytes for arg0-arg3, and 32 bytes for magic (the only part of
59 * which Linux/parisc uses is sp-20 for the saved return pointer...)
60 * Then, the stack pointer must be rounded to a cache line (64 bytes).
61 */
62#define SIGFRAME32              64
63#define FUNCTIONCALLFRAME32     48
64#define PARISC_RT_SIGFRAME_SIZE32 (((sizeof(struct compat_rt_sigframe) + FUNCTIONCALLFRAME32) + SIGFRAME32) & -SIGFRAME32)
65
66long restore_sigcontext32(struct compat_sigcontext __user *sc, 
67		struct compat_regfile __user *rf,
68		struct pt_regs *regs);
69long setup_sigcontext32(struct compat_sigcontext __user *sc, 
70		struct compat_regfile __user *rf,
71		struct pt_regs *regs, int in_syscall);
72
73#endif
v4.17
 
 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
22#include <linux/compat.h>
23
24/* 32-bit ucontext as seen from an 64-bit kernel */
25struct compat_ucontext {
26        compat_uint_t uc_flags;
27        compat_uptr_t uc_link;
28        compat_stack_t uc_stack;        /* struct compat_sigaltstack (12 bytes)*/
29        /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */
30        compat_uint_t pad[1];
31        struct compat_sigcontext uc_mcontext;
32        compat_sigset_t uc_sigmask;     /* mask last for extensibility */
33};
34
35/* ELF32 signal handling */
36
37/* In a deft move of uber-hackery, we decide to carry the top half of all
38 * 64-bit registers in a non-portable, non-ABI, hidden structure.
39 * Userspace can read the hidden structure if it *wants* but is never
40 * guaranteed to be in the same place. In fact the uc_sigmask from the
41 * ucontext_t structure may push the hidden register file downards
42 */
43struct compat_regfile {
44        /* Upper half of all the 64-bit registers that were truncated
45           on a copy to a 32-bit userspace */
46        compat_int_t rf_gr[32];
47        compat_int_t rf_iasq[2];
48        compat_int_t rf_iaoq[2];
49        compat_int_t rf_sar;
50};
51
52#define COMPAT_SIGRETURN_TRAMP 4
53#define COMPAT_SIGRESTARTBLOCK_TRAMP 5
54#define COMPAT_TRAMP_SIZE (COMPAT_SIGRETURN_TRAMP + \
55				COMPAT_SIGRESTARTBLOCK_TRAMP)
56
57struct compat_rt_sigframe {
58        /* XXX: Must match trampoline size in arch/parisc/kernel/signal.c
59                Secondary to that it must protect the ERESTART_RESTARTBLOCK
60                trampoline we left on the stack (we were bad and didn't
61                change sp so we could run really fast.) */
62        compat_uint_t tramp[COMPAT_TRAMP_SIZE];
63        compat_siginfo_t info;
64        struct compat_ucontext uc;
65        /* Hidden location of truncated registers, *must* be last. */
66        struct compat_regfile regs;
67};
68
69/*
70 * The 32-bit ABI wants at least 48 bytes for a function call frame:
71 * 16 bytes for arg0-arg3, and 32 bytes for magic (the only part of
72 * which Linux/parisc uses is sp-20 for the saved return pointer...)
73 * Then, the stack pointer must be rounded to a cache line (64 bytes).
74 */
75#define SIGFRAME32              64
76#define FUNCTIONCALLFRAME32     48
77#define PARISC_RT_SIGFRAME_SIZE32 (((sizeof(struct compat_rt_sigframe) + FUNCTIONCALLFRAME32) + SIGFRAME32) & -SIGFRAME32)
78
79long restore_sigcontext32(struct compat_sigcontext __user *sc, 
80		struct compat_regfile __user *rf,
81		struct pt_regs *regs);
82long setup_sigcontext32(struct compat_sigcontext __user *sc, 
83		struct compat_regfile __user *rf,
84		struct pt_regs *regs, int in_syscall);
85
86#endif