aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-i386/signal.c')
-rw-r--r--arch/um/sys-i386/signal.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index b87195b92fcc..bcbfb0d64813 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -10,28 +10,6 @@
10#include "frame_kern.h" 10#include "frame_kern.h"
11#include "skas.h" 11#include "skas.h"
12 12
13static void copy_sc(struct uml_pt_regs *regs, void *from)
14{
15 struct sigcontext *sc = from;
16
17 REGS_GS(regs->gp) = sc->gs;
18 REGS_FS(regs->gp) = sc->fs;
19 REGS_ES(regs->gp) = sc->es;
20 REGS_DS(regs->gp) = sc->ds;
21 REGS_EDI(regs->gp) = sc->di;
22 REGS_ESI(regs->gp) = sc->si;
23 REGS_EBP(regs->gp) = sc->bp;
24 REGS_SP(regs->gp) = sc->sp;
25 REGS_EBX(regs->gp) = sc->bx;
26 REGS_EDX(regs->gp) = sc->dx;
27 REGS_ECX(regs->gp) = sc->cx;
28 REGS_EAX(regs->gp) = sc->ax;
29 REGS_IP(regs->gp) = sc->ip;
30 REGS_CS(regs->gp) = sc->cs;
31 REGS_EFLAGS(regs->gp) = sc->flags;
32 REGS_SS(regs->gp) = sc->ss;
33}
34
35/* 13/*
36 * FPU tag word conversions. 14 * FPU tag word conversions.
37 */ 15 */
@@ -175,7 +153,27 @@ static int copy_sc_from_user(struct pt_regs *regs,
175 return err; 153 return err;
176 154
177 pid = userspace_pid[current_thread_info()->cpu]; 155 pid = userspace_pid[current_thread_info()->cpu];
178 copy_sc(&regs->regs, &sc); 156
157#define GETREG(regno, regname) regs->regs.gp[HOST_##regno] = sc.regname
158
159 GETREG(GS, gs);
160 GETREG(FS, fs);
161 GETREG(ES, es);
162 GETREG(DS, ds);
163 GETREG(EDI, di);
164 GETREG(ESI, si);
165 GETREG(EBP, bp);
166 GETREG(SP, sp);
167 GETREG(EBX, bx);
168 GETREG(EDX, dx);
169 GETREG(ECX, cx);
170 GETREG(EAX, ax);
171 GETREG(IP, ip);
172 GETREG(CS, cs);
173 GETREG(EFLAGS, flags);
174 GETREG(SS, ss);
175
176#undef GETREG
179 if (have_fpx_regs) { 177 if (have_fpx_regs) {
180 struct user_fxsr_struct fpx; 178 struct user_fxsr_struct fpx;
181 179
@@ -196,8 +194,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
196 -err); 194 -err);
197 return 1; 195 return 1;
198 } 196 }
199 } 197 } else {
200 else {
201 struct user_i387_struct fp; 198 struct user_i387_struct fp;
202 199
203 err = copy_from_user(&fp, sc.fpstate, 200 err = copy_from_user(&fp, sc.fpstate,
@@ -224,6 +221,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
224 struct sigcontext sc; 221 struct sigcontext sc;
225 struct faultinfo * fi = &current->thread.arch.faultinfo; 222 struct faultinfo * fi = &current->thread.arch.faultinfo;
226 int err, pid; 223 int err, pid;
224 memset(&sc, 0, sizeof(struct sigcontext));
227 225
228 sc.gs = REGS_GS(regs->regs.gp); 226 sc.gs = REGS_GS(regs->regs.gp);
229 sc.fs = REGS_FS(regs->regs.gp); 227 sc.fs = REGS_FS(regs->regs.gp);