aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2014-04-04 10:42:16 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2014-05-09 10:47:48 -0400
commit0e0276d1e1dd063cd14ce377707970d0417a0792 (patch)
tree9757d82c4280161d4a72409547f70eec7e5548dd
parent9141300a5884b57cea6d32c4e3fd16a337cfc99a (diff)
arm64: Remove the aux_context structure
This patch removes the aux_context structure (and the containing file) to allow the placement of the _aarch64_ctx end magic based on the context stored on the signal stack. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
-rw-r--r--arch/arm64/include/asm/sigcontext.h31
-rw-r--r--arch/arm64/kernel/signal.c27
2 files changed, 17 insertions, 41 deletions
diff --git a/arch/arm64/include/asm/sigcontext.h b/arch/arm64/include/asm/sigcontext.h
deleted file mode 100644
index dca1094acc74..000000000000
--- a/arch/arm64/include/asm/sigcontext.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * Copyright (C) 2012 ARM Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef __ASM_SIGCONTEXT_H
17#define __ASM_SIGCONTEXT_H
18
19#include <uapi/asm/sigcontext.h>
20
21/*
22 * Auxiliary context saved in the sigcontext.__reserved array. Not exported to
23 * user space as it will change with the addition of new context. User space
24 * should check the magic/size information.
25 */
26struct aux_context {
27 struct fpsimd_context fpsimd;
28 /* additional context to be added before "end" */
29 struct _aarch64_ctx end;
30};
31#endif
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 890a591f75dd..7ff2eee96c6b 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -100,8 +100,7 @@ static int restore_sigframe(struct pt_regs *regs,
100{ 100{
101 sigset_t set; 101 sigset_t set;
102 int i, err; 102 int i, err;
103 struct aux_context __user *aux = 103 void *aux = sf->uc.uc_mcontext.__reserved;
104 (struct aux_context __user *)sf->uc.uc_mcontext.__reserved;
105 104
106 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); 105 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
107 if (err == 0) 106 if (err == 0)
@@ -121,8 +120,11 @@ static int restore_sigframe(struct pt_regs *regs,
121 120
122 err |= !valid_user_regs(&regs->user_regs); 121 err |= !valid_user_regs(&regs->user_regs);
123 122
124 if (err == 0) 123 if (err == 0) {
125 err |= restore_fpsimd_context(&aux->fpsimd); 124 struct fpsimd_context *fpsimd_ctx =
125 container_of(aux, struct fpsimd_context, head);
126 err |= restore_fpsimd_context(fpsimd_ctx);
127 }
126 128
127 return err; 129 return err;
128} 130}
@@ -167,8 +169,8 @@ static int setup_sigframe(struct rt_sigframe __user *sf,
167 struct pt_regs *regs, sigset_t *set) 169 struct pt_regs *regs, sigset_t *set)
168{ 170{
169 int i, err = 0; 171 int i, err = 0;
170 struct aux_context __user *aux = 172 void *aux = sf->uc.uc_mcontext.__reserved;
171 (struct aux_context __user *)sf->uc.uc_mcontext.__reserved; 173 struct _aarch64_ctx *end;
172 174
173 /* set up the stack frame for unwinding */ 175 /* set up the stack frame for unwinding */
174 __put_user_error(regs->regs[29], &sf->fp, err); 176 __put_user_error(regs->regs[29], &sf->fp, err);
@@ -185,12 +187,17 @@ static int setup_sigframe(struct rt_sigframe __user *sf,
185 187
186 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set)); 188 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
187 189
188 if (err == 0) 190 if (err == 0) {
189 err |= preserve_fpsimd_context(&aux->fpsimd); 191 struct fpsimd_context *fpsimd_ctx =
192 container_of(aux, struct fpsimd_context, head);
193 err |= preserve_fpsimd_context(fpsimd_ctx);
194 aux += sizeof(*fpsimd_ctx);
195 }
190 196
191 /* set the "end" magic */ 197 /* set the "end" magic */
192 __put_user_error(0, &aux->end.magic, err); 198 end = aux;
193 __put_user_error(0, &aux->end.size, err); 199 __put_user_error(0, &end->magic, err);
200 __put_user_error(0, &end->size, err);
194 201
195 return err; 202 return err;
196} 203}