Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1304020
| From | Yury Norov <ynorov@caviumnetworks.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v6 15/21] arm64: signal: wrap struct ucontext, fp and lr with struct sigframe |
| Date | 2016-01-08 00:50 +0100 |
| Message-ID | <qOstA-6LL-13@gated-at.bofh.it> (permalink) |
| References | <qOsjT-6Hv-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
It helps to move common code for lp64 and ilp32 to separated header.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
arch/arm64/kernel/signal.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 65baaef..20dca65 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -35,14 +35,18 @@
#include <asm/signal32.h>
#include <asm/vdso.h>
+struct sigframe {
+ struct ucontext uc;
+ u64 fp;
+ u64 lr;
+};
+
/*
* Do a signal return; undo the signal stack. These are aligned to 128-bit.
*/
struct rt_sigframe {
struct siginfo info;
- struct ucontext uc;
- u64 fp;
- u64 lr;
+ struct sigframe sig;
};
static int preserve_fpsimd_context(struct fpsimd_context __user *ctx)
@@ -93,7 +97,7 @@ static int restore_fpsimd_context(struct fpsimd_context __user *ctx)
}
static int restore_sigframe(struct pt_regs *regs,
- struct rt_sigframe __user *sf)
+ struct sigframe __user *sf)
{
sigset_t set;
int i, err;
@@ -145,10 +149,10 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
goto badframe;
- if (restore_sigframe(regs, frame))
+ if (restore_sigframe(regs, &frame->sig))
goto badframe;
- if (restore_altstack(&frame->uc.uc_stack))
+ if (restore_altstack(&frame->sig.uc.uc_stack))
goto badframe;
return regs->regs[0];
@@ -162,7 +166,7 @@ badframe:
return 0;
}
-static int setup_sigframe(struct rt_sigframe __user *sf,
+static int setup_sigframe(struct sigframe __user *sf,
struct pt_regs *regs, sigset_t *set)
{
int i, err = 0;
@@ -230,13 +234,13 @@ static struct rt_sigframe __user *get_sigframe(struct ksignal *ksig,
}
static void setup_return(struct pt_regs *regs, struct k_sigaction *ka,
- void __user *frame, int usig)
+ void __user *frame, off_t sigframe_off, int usig)
{
__sigrestore_t sigtramp;
regs->regs[0] = usig;
regs->sp = (unsigned long)frame;
- regs->regs[29] = regs->sp + offsetof(struct rt_sigframe, fp);
+ regs->regs[29] = regs->sp + sigframe_off + offsetof(struct sigframe, fp);
regs->pc = (unsigned long)ka->sa.sa_handler;
if (ka->sa.sa_flags & SA_RESTORER)
@@ -257,17 +261,18 @@ static int setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
if (!frame)
return 1;
- __put_user_error(0, &frame->uc.uc_flags, err);
- __put_user_error(NULL, &frame->uc.uc_link, err);
+ __put_user_error(0, &frame->sig.uc.uc_flags, err);
+ __put_user_error(NULL, &frame->sig.uc.uc_link, err);
- err |= __save_altstack(&frame->uc.uc_stack, regs->sp);
- err |= setup_sigframe(frame, regs, set);
+ err |= __save_altstack(&frame->sig.uc.uc_stack, regs->sp);
+ err |= setup_sigframe(&frame->sig, regs, set);
if (err == 0) {
- setup_return(regs, &ksig->ka, frame, usig);
+ setup_return(regs, &ksig->ka, frame,
+ offsetof(struct rt_sigframe, sig), usig);
if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
err |= copy_siginfo_to_user(&frame->info, &ksig->info);
regs->regs[1] = (unsigned long)&frame->info;
- regs->regs[2] = (unsigned long)&frame->uc;
+ regs->regs[2] = (unsigned long)&frame->sig.uc;
}
}
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC4 PATCH v6 00/21] ILP32 for ARM64 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:40 +0100
[PATCH v6 12/21] arm64:ilp32: share HWCAP between LP64 and ILP32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:40 +0100
Re: [PATCH v6 12/21] arm64:ilp32: share HWCAP between LP64 and ILP32 Arnd Bergmann <arnd@arndb.de> - 2016-01-08 10:00 +0100
[PATCH v6 05/21] arm64: compat: fix wrong dependency Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:40 +0100
Re: [PATCH v6 05/21] arm64: compat: fix wrong dependency Arnd Bergmann <arnd@arndb.de> - 2016-01-08 10:00 +0100
[PATCH v6 03/21] arm64: rename COMPAT to AARCH32_EL0 in Kconfig Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:40 +0100
[PATCH v6 21/21] arm64:ilp32: add ARM64_ILP32 to Kconfig Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
[PATCH v6 15/21] arm64: signal: wrap struct ucontext, fp and lr with struct sigframe Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
[PATCH v6 18/21] arm64: ilp32: introduce ilp32-specific handlers for sigframe Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
[PATCH v6 20/21] arm64:ilp32: change COMPAT_ELF_PLATFORM to report a a subplatform for ILP32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
Re: [PATCH v6 20/21] arm64:ilp32: change COMPAT_ELF_PLATFORM to report a a subplatform for ILP32 Arnd Bergmann <arnd@arndb.de> - 2016-01-08 10:10 +0100
[PATCH v6 13/21] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
Re: [PATCH v6 13/21] arm64: ptrace: handle ptrace_request differently for aarch32 and ilp32 Arnd Bergmann <arnd@arndb.de> - 2016-01-08 10:10 +0100
[PATCH v6 19/21] arm64:ilp32: add vdso-ilp32 and use for signal return Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
[PATCH v6 16/21] arm64: signal: share lp64 signal routines to ilp32 Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
[PATCH v6 14/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
Re: [PATCH v6 14/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Arnd Bergmann <arnd@arndb.de> - 2016-01-08 10:10 +0100
Re: [PATCH v6 14/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Arnd Bergmann <arnd@arndb.de> - 2016-01-08 10:30 +0100
Re: [PATCH v6 14/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 12:20 +0100
Re: [PATCH v6 14/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Arnd Bergmann <arnd@arndb.de> - 2016-01-08 17:50 +0100
Re: [PATCH v6 14/21] arm64:ilp32: add sys_ilp32.c and a separate table (in entry.S) to use it Yury Norov <ynorov@caviumnetworks.com> - 2016-01-13 17:30 +0100
[PATCH v6 17/21] arm64: signal32: move ilp32 and aarch32 common code to separated file Yury Norov <ynorov@caviumnetworks.com> - 2016-01-08 00:50 +0100
csiph-web