xref: /openbmc/qemu/linux-user/sparc/signal.c (revision 729cc683)
1 /*
2  *  Emulation of Linux signals
3  *
4  *  Copyright (c) 2003 Fabrice Bellard
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19 #include "qemu/osdep.h"
20 #include "qemu.h"
21 #include "signal-common.h"
22 #include "linux-user/trace.h"
23 
24 #define __SUNOS_MAXWIN   31
25 
26 /* This is what SunOS does, so shall I. */
27 struct target_sigcontext {
28     abi_ulong sigc_onstack;      /* state to restore */
29 
30     abi_ulong sigc_mask;         /* sigmask to restore */
31     abi_ulong sigc_sp;           /* stack pointer */
32     abi_ulong sigc_pc;           /* program counter */
33     abi_ulong sigc_npc;          /* next program counter */
34     abi_ulong sigc_psr;          /* for condition codes etc */
35     abi_ulong sigc_g1;           /* User uses these two registers */
36     abi_ulong sigc_o0;           /* within the trampoline code. */
37 
38     /* Now comes information regarding the users window set
39          * at the time of the signal.
40          */
41     abi_ulong sigc_oswins;       /* outstanding windows */
42 
43     /* stack ptrs for each regwin buf */
44     char *sigc_spbuf[__SUNOS_MAXWIN];
45 
46     /* Windows to restore after signal */
47     struct {
48         abi_ulong locals[8];
49         abi_ulong ins[8];
50     } sigc_wbuf[__SUNOS_MAXWIN];
51 };
52 /* A Sparc stack frame */
53 struct sparc_stackf {
54     abi_ulong locals[8];
55     abi_ulong ins[8];
56     /* It's simpler to treat fp and callers_pc as elements of ins[]
57          * since we never need to access them ourselves.
58          */
59     char *structptr;
60     abi_ulong xargs[6];
61     abi_ulong xxargs[1];
62 };
63 
64 typedef struct {
65     struct {
66         abi_ulong psr;
67         abi_ulong pc;
68         abi_ulong npc;
69         abi_ulong y;
70         abi_ulong u_regs[16]; /* globals and ins */
71     }               si_regs;
72     int             si_mask;
73 } __siginfo_t;
74 
75 typedef struct {
76     abi_ulong  si_float_regs[32];
77     unsigned   long si_fsr;
78     unsigned   long si_fpqdepth;
79     struct {
80         unsigned long *insn_addr;
81         unsigned long insn;
82     } si_fpqueue [16];
83 } qemu_siginfo_fpu_t;
84 
85 
86 struct target_signal_frame {
87     struct sparc_stackf ss;
88     __siginfo_t         info;
89     abi_ulong           fpu_save;
90     uint32_t            insns[2] QEMU_ALIGNED(8);
91     abi_ulong           extramask[TARGET_NSIG_WORDS - 1];
92     abi_ulong           extra_size; /* Should be 0 */
93     qemu_siginfo_fpu_t fpu_state;
94 };
95 struct target_rt_signal_frame {
96     struct sparc_stackf ss;
97     siginfo_t           info;
98     abi_ulong           regs[20];
99     sigset_t            mask;
100     abi_ulong           fpu_save;
101     uint32_t            insns[2];
102     stack_t             stack;
103     unsigned int        extra_size; /* Should be 0 */
104     qemu_siginfo_fpu_t  fpu_state;
105 };
106 
107 static inline abi_ulong get_sigframe(struct target_sigaction *sa,
108                                      CPUSPARCState *env,
109                                      unsigned long framesize)
110 {
111     abi_ulong sp = get_sp_from_cpustate(env);
112 
113     /*
114      * If we are on the alternate signal stack and would overflow it, don't.
115      * Return an always-bogus address instead so we will die with SIGSEGV.
116          */
117     if (on_sig_stack(sp) && !likely(on_sig_stack(sp - framesize))) {
118             return -1;
119     }
120 
121     /* This is the X/Open sanctioned signal stack switching.  */
122     sp = target_sigsp(sp, sa) - framesize;
123 
124     /* Always align the stack frame.  This handles two cases.  First,
125      * sigaltstack need not be mindful of platform specific stack
126      * alignment.  Second, if we took this signal because the stack
127      * is not aligned properly, we'd like to take the signal cleanly
128      * and report that.
129      */
130     sp &= ~15UL;
131 
132     return sp;
133 }
134 
135 static int
136 setup___siginfo(__siginfo_t *si, CPUSPARCState *env, abi_ulong mask)
137 {
138     int err = 0, i;
139 
140     __put_user(env->psr, &si->si_regs.psr);
141     __put_user(env->pc, &si->si_regs.pc);
142     __put_user(env->npc, &si->si_regs.npc);
143     __put_user(env->y, &si->si_regs.y);
144     for (i=0; i < 8; i++) {
145         __put_user(env->gregs[i], &si->si_regs.u_regs[i]);
146     }
147     for (i=0; i < 8; i++) {
148         __put_user(env->regwptr[WREG_O0 + i], &si->si_regs.u_regs[i + 8]);
149     }
150     __put_user(mask, &si->si_mask);
151     return err;
152 }
153 
154 #define NF_ALIGNEDSZ  (((sizeof(struct target_signal_frame) + 7) & (~7)))
155 
156 void setup_frame(int sig, struct target_sigaction *ka,
157                  target_sigset_t *set, CPUSPARCState *env)
158 {
159     abi_ulong sf_addr;
160     struct target_signal_frame *sf;
161     int sigframe_size, err, i;
162 
163     /* 1. Make sure everything is clean */
164     //synchronize_user_stack();
165 
166     sigframe_size = NF_ALIGNEDSZ;
167     sf_addr = get_sigframe(ka, env, sigframe_size);
168     trace_user_setup_frame(env, sf_addr);
169 
170     sf = lock_user(VERIFY_WRITE, sf_addr,
171                    sizeof(struct target_signal_frame), 0);
172     if (!sf) {
173         goto sigsegv;
174     }
175 #if 0
176     if (invalid_frame_pointer(sf, sigframe_size))
177         goto sigill_and_return;
178 #endif
179     /* 2. Save the current process state */
180     err = setup___siginfo(&sf->info, env, set->sig[0]);
181     __put_user(0, &sf->extra_size);
182 
183     //save_fpu_state(regs, &sf->fpu_state);
184     //__put_user(&sf->fpu_state, &sf->fpu_save);
185 
186     __put_user(set->sig[0], &sf->info.si_mask);
187     for (i = 0; i < TARGET_NSIG_WORDS - 1; i++) {
188         __put_user(set->sig[i + 1], &sf->extramask[i]);
189     }
190 
191     for (i = 0; i < 8; i++) {
192         __put_user(env->regwptr[i + WREG_L0], &sf->ss.locals[i]);
193     }
194     for (i = 0; i < 8; i++) {
195         __put_user(env->regwptr[i + WREG_I0], &sf->ss.ins[i]);
196     }
197     if (err)
198         goto sigsegv;
199 
200     /* 3. signal handler back-trampoline and parameters */
201     env->regwptr[WREG_SP] = sf_addr;
202     env->regwptr[WREG_O0] = sig;
203     env->regwptr[WREG_O1] = sf_addr +
204             offsetof(struct target_signal_frame, info);
205     env->regwptr[WREG_O2] = sf_addr +
206             offsetof(struct target_signal_frame, info);
207 
208     /* 4. signal handler */
209     env->pc = ka->_sa_handler;
210     env->npc = (env->pc + 4);
211     /* 5. return to kernel instructions */
212     if (ka->ka_restorer) {
213         env->regwptr[WREG_O7] = ka->ka_restorer;
214     } else {
215         uint32_t val32;
216 
217         env->regwptr[WREG_O7] = sf_addr +
218                 offsetof(struct target_signal_frame, insns) - 2 * 4;
219 
220         /* mov __NR_sigreturn, %g1 */
221         val32 = 0x821020d8;
222         __put_user(val32, &sf->insns[0]);
223 
224         /* t 0x10 */
225         val32 = 0x91d02010;
226         __put_user(val32, &sf->insns[1]);
227     }
228     unlock_user(sf, sf_addr, sizeof(struct target_signal_frame));
229     return;
230 #if 0
231 sigill_and_return:
232     force_sig(TARGET_SIGILL);
233 #endif
234 sigsegv:
235     unlock_user(sf, sf_addr, sizeof(struct target_signal_frame));
236     force_sigsegv(sig);
237 }
238 
239 void setup_rt_frame(int sig, struct target_sigaction *ka,
240                     target_siginfo_t *info,
241                     target_sigset_t *set, CPUSPARCState *env)
242 {
243     qemu_log_mask(LOG_UNIMP, "setup_rt_frame: not implemented\n");
244 }
245 
246 long do_sigreturn(CPUSPARCState *env)
247 {
248     abi_ulong sf_addr;
249     struct target_signal_frame *sf;
250     abi_ulong up_psr, pc, npc;
251     target_sigset_t set;
252     sigset_t host_set;
253     int i;
254 
255     sf_addr = env->regwptr[WREG_SP];
256     trace_user_do_sigreturn(env, sf_addr);
257     if (!lock_user_struct(VERIFY_READ, sf, sf_addr, 1)) {
258         goto segv_and_exit;
259     }
260 
261     /* 1. Make sure we are not getting garbage from the user */
262 
263     if (sf_addr & 3)
264         goto segv_and_exit;
265 
266     __get_user(pc,  &sf->info.si_regs.pc);
267     __get_user(npc, &sf->info.si_regs.npc);
268 
269     if ((pc | npc) & 3) {
270         goto segv_and_exit;
271     }
272 
273     /* 2. Restore the state */
274     __get_user(up_psr, &sf->info.si_regs.psr);
275 
276     /* User can only change condition codes and FPU enabling in %psr. */
277     env->psr = (up_psr & (PSR_ICC /* | PSR_EF */))
278             | (env->psr & ~(PSR_ICC /* | PSR_EF */));
279 
280     env->pc = pc;
281     env->npc = npc;
282     __get_user(env->y, &sf->info.si_regs.y);
283     for (i=0; i < 8; i++) {
284         __get_user(env->gregs[i], &sf->info.si_regs.u_regs[i]);
285     }
286     for (i=0; i < 8; i++) {
287         __get_user(env->regwptr[i + WREG_O0], &sf->info.si_regs.u_regs[i + 8]);
288     }
289 
290     /* FIXME: implement FPU save/restore:
291      * __get_user(fpu_save, &sf->fpu_save);
292      * if (fpu_save) {
293      *     if (restore_fpu_state(env, fpu_save)) {
294      *         goto segv_and_exit;
295      *     }
296      * }
297      */
298 
299     /* This is pretty much atomic, no amount locking would prevent
300          * the races which exist anyways.
301          */
302     __get_user(set.sig[0], &sf->info.si_mask);
303     for(i = 1; i < TARGET_NSIG_WORDS; i++) {
304         __get_user(set.sig[i], &sf->extramask[i - 1]);
305     }
306 
307     target_to_host_sigset_internal(&host_set, &set);
308     set_sigmask(&host_set);
309 
310     unlock_user_struct(sf, sf_addr, 0);
311     return -TARGET_QEMU_ESIGRETURN;
312 
313 segv_and_exit:
314     unlock_user_struct(sf, sf_addr, 0);
315     force_sig(TARGET_SIGSEGV);
316     return -TARGET_QEMU_ESIGRETURN;
317 }
318 
319 long do_rt_sigreturn(CPUSPARCState *env)
320 {
321     trace_user_do_rt_sigreturn(env, 0);
322     qemu_log_mask(LOG_UNIMP, "do_rt_sigreturn: not implemented\n");
323     return -TARGET_ENOSYS;
324 }
325 
326 #if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
327 #define SPARC_MC_TSTATE 0
328 #define SPARC_MC_PC 1
329 #define SPARC_MC_NPC 2
330 #define SPARC_MC_Y 3
331 #define SPARC_MC_G1 4
332 #define SPARC_MC_G2 5
333 #define SPARC_MC_G3 6
334 #define SPARC_MC_G4 7
335 #define SPARC_MC_G5 8
336 #define SPARC_MC_G6 9
337 #define SPARC_MC_G7 10
338 #define SPARC_MC_O0 11
339 #define SPARC_MC_O1 12
340 #define SPARC_MC_O2 13
341 #define SPARC_MC_O3 14
342 #define SPARC_MC_O4 15
343 #define SPARC_MC_O5 16
344 #define SPARC_MC_O6 17
345 #define SPARC_MC_O7 18
346 #define SPARC_MC_NGREG 19
347 
348 typedef abi_ulong target_mc_greg_t;
349 typedef target_mc_greg_t target_mc_gregset_t[SPARC_MC_NGREG];
350 
351 struct target_mc_fq {
352     abi_ulong mcfq_addr;
353     uint32_t mcfq_insn;
354 };
355 
356 /*
357  * Note the manual 16-alignment; the kernel gets this because it
358  * includes a "long double qregs[16]" in the mcpu_fregs union,
359  * which we can't do.
360  */
361 struct target_mc_fpu {
362     union {
363         uint32_t sregs[32];
364         uint64_t dregs[32];
365         //uint128_t qregs[16];
366     } mcfpu_fregs;
367     abi_ulong mcfpu_fsr;
368     abi_ulong mcfpu_fprs;
369     abi_ulong mcfpu_gsr;
370     abi_ulong mcfpu_fq;
371     unsigned char mcfpu_qcnt;
372     unsigned char mcfpu_qentsz;
373     unsigned char mcfpu_enab;
374 } __attribute__((aligned(16)));
375 typedef struct target_mc_fpu target_mc_fpu_t;
376 
377 typedef struct {
378     target_mc_gregset_t mc_gregs;
379     target_mc_greg_t mc_fp;
380     target_mc_greg_t mc_i7;
381     target_mc_fpu_t mc_fpregs;
382 } target_mcontext_t;
383 
384 struct target_ucontext {
385     abi_ulong tuc_link;
386     abi_ulong tuc_flags;
387     target_sigset_t tuc_sigmask;
388     target_mcontext_t tuc_mcontext;
389 };
390 
391 /* A V9 register window */
392 struct target_reg_window {
393     abi_ulong locals[8];
394     abi_ulong ins[8];
395 };
396 
397 #define TARGET_STACK_BIAS 2047
398 
399 /* {set, get}context() needed for 64-bit SparcLinux userland. */
400 void sparc64_set_context(CPUSPARCState *env)
401 {
402     abi_ulong ucp_addr;
403     struct target_ucontext *ucp;
404     target_mc_gregset_t *grp;
405     target_mc_fpu_t *fpup;
406     abi_ulong pc, npc, tstate;
407     unsigned int i;
408     unsigned char fenab;
409 
410     ucp_addr = env->regwptr[WREG_O0];
411     if (!lock_user_struct(VERIFY_READ, ucp, ucp_addr, 1)) {
412         goto do_sigsegv;
413     }
414     grp  = &ucp->tuc_mcontext.mc_gregs;
415     __get_user(pc, &((*grp)[SPARC_MC_PC]));
416     __get_user(npc, &((*grp)[SPARC_MC_NPC]));
417     if ((pc | npc) & 3) {
418         goto do_sigsegv;
419     }
420     if (env->regwptr[WREG_O1]) {
421         target_sigset_t target_set;
422         sigset_t set;
423 
424         if (TARGET_NSIG_WORDS == 1) {
425             __get_user(target_set.sig[0], &ucp->tuc_sigmask.sig[0]);
426         } else {
427             abi_ulong *src, *dst;
428             src = ucp->tuc_sigmask.sig;
429             dst = target_set.sig;
430             for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) {
431                 __get_user(*dst, src);
432             }
433         }
434         target_to_host_sigset_internal(&set, &target_set);
435         set_sigmask(&set);
436     }
437     env->pc = pc;
438     env->npc = npc;
439     __get_user(env->y, &((*grp)[SPARC_MC_Y]));
440     __get_user(tstate, &((*grp)[SPARC_MC_TSTATE]));
441     /* Honour TSTATE_ASI, TSTATE_ICC and TSTATE_XCC only */
442     env->asi = (tstate >> 24) & 0xff;
443     cpu_put_ccr(env, (tstate >> 32) & 0xff);
444     __get_user(env->gregs[1], (&(*grp)[SPARC_MC_G1]));
445     __get_user(env->gregs[2], (&(*grp)[SPARC_MC_G2]));
446     __get_user(env->gregs[3], (&(*grp)[SPARC_MC_G3]));
447     __get_user(env->gregs[4], (&(*grp)[SPARC_MC_G4]));
448     __get_user(env->gregs[5], (&(*grp)[SPARC_MC_G5]));
449     __get_user(env->gregs[6], (&(*grp)[SPARC_MC_G6]));
450     /* Skip g7 as that's the thread register in userspace */
451 
452     /*
453      * Note that unlike the kernel, we didn't need to mess with the
454      * guest register window state to save it into a pt_regs to run
455      * the kernel. So for us the guest's O regs are still in WREG_O*
456      * (unlike the kernel which has put them in UREG_I* in a pt_regs)
457      * and the fp and i7 are still in WREG_I6 and WREG_I7 and don't
458      * need to be written back to userspace memory.
459      */
460     __get_user(env->regwptr[WREG_O0], (&(*grp)[SPARC_MC_O0]));
461     __get_user(env->regwptr[WREG_O1], (&(*grp)[SPARC_MC_O1]));
462     __get_user(env->regwptr[WREG_O2], (&(*grp)[SPARC_MC_O2]));
463     __get_user(env->regwptr[WREG_O3], (&(*grp)[SPARC_MC_O3]));
464     __get_user(env->regwptr[WREG_O4], (&(*grp)[SPARC_MC_O4]));
465     __get_user(env->regwptr[WREG_O5], (&(*grp)[SPARC_MC_O5]));
466     __get_user(env->regwptr[WREG_O6], (&(*grp)[SPARC_MC_O6]));
467     __get_user(env->regwptr[WREG_O7], (&(*grp)[SPARC_MC_O7]));
468 
469     __get_user(env->regwptr[WREG_FP], &(ucp->tuc_mcontext.mc_fp));
470     __get_user(env->regwptr[WREG_I7], &(ucp->tuc_mcontext.mc_i7));
471 
472     fpup = &ucp->tuc_mcontext.mc_fpregs;
473 
474     __get_user(fenab, &(fpup->mcfpu_enab));
475     if (fenab) {
476         abi_ulong fprs;
477 
478         /*
479          * We use the FPRS from the guest only in deciding whether
480          * to restore the upper, lower, or both banks of the FPU regs.
481          * The kernel here writes the FPU register data into the
482          * process's current_thread_info state and unconditionally
483          * clears FPRS and TSTATE_PEF: this disables the FPU so that the
484          * next FPU-disabled trap will copy the data out of
485          * current_thread_info and into the real FPU registers.
486          * QEMU doesn't need to handle lazy-FPU-state-restoring like that,
487          * so we always load the data directly into the FPU registers
488          * and leave FPRS and TSTATE_PEF alone (so the FPU stays enabled).
489          * Note that because we (and the kernel) always write zeroes for
490          * the fenab and fprs in sparc64_get_context() none of this code
491          * will execute unless the guest manually constructed or changed
492          * the context structure.
493          */
494         __get_user(fprs, &(fpup->mcfpu_fprs));
495         if (fprs & FPRS_DL) {
496             for (i = 0; i < 16; i++) {
497                 __get_user(env->fpr[i].ll, &(fpup->mcfpu_fregs.dregs[i]));
498             }
499         }
500         if (fprs & FPRS_DU) {
501             for (i = 16; i < 32; i++) {
502                 __get_user(env->fpr[i].ll, &(fpup->mcfpu_fregs.dregs[i]));
503             }
504         }
505         __get_user(env->fsr, &(fpup->mcfpu_fsr));
506         __get_user(env->gsr, &(fpup->mcfpu_gsr));
507     }
508     unlock_user_struct(ucp, ucp_addr, 0);
509     return;
510 do_sigsegv:
511     unlock_user_struct(ucp, ucp_addr, 0);
512     force_sig(TARGET_SIGSEGV);
513 }
514 
515 void sparc64_get_context(CPUSPARCState *env)
516 {
517     abi_ulong ucp_addr;
518     struct target_ucontext *ucp;
519     target_mc_gregset_t *grp;
520     target_mcontext_t *mcp;
521     int err;
522     unsigned int i;
523     target_sigset_t target_set;
524     sigset_t set;
525 
526     ucp_addr = env->regwptr[WREG_O0];
527     if (!lock_user_struct(VERIFY_WRITE, ucp, ucp_addr, 0)) {
528         goto do_sigsegv;
529     }
530 
531     memset(ucp, 0, sizeof(*ucp));
532 
533     mcp = &ucp->tuc_mcontext;
534     grp = &mcp->mc_gregs;
535 
536     /* Skip over the trap instruction, first. */
537     env->pc = env->npc;
538     env->npc += 4;
539 
540     /* If we're only reading the signal mask then do_sigprocmask()
541      * is guaranteed not to fail, which is important because we don't
542      * have any way to signal a failure or restart this operation since
543      * this is not a normal syscall.
544      */
545     err = do_sigprocmask(0, NULL, &set);
546     assert(err == 0);
547     host_to_target_sigset_internal(&target_set, &set);
548     if (TARGET_NSIG_WORDS == 1) {
549         __put_user(target_set.sig[0],
550                    (abi_ulong *)&ucp->tuc_sigmask);
551     } else {
552         abi_ulong *src, *dst;
553         src = target_set.sig;
554         dst = ucp->tuc_sigmask.sig;
555         for (i = 0; i < TARGET_NSIG_WORDS; i++, dst++, src++) {
556             __put_user(*src, dst);
557         }
558     }
559 
560     __put_user(sparc64_tstate(env), &((*grp)[SPARC_MC_TSTATE]));
561     __put_user(env->pc, &((*grp)[SPARC_MC_PC]));
562     __put_user(env->npc, &((*grp)[SPARC_MC_NPC]));
563     __put_user(env->y, &((*grp)[SPARC_MC_Y]));
564     __put_user(env->gregs[1], &((*grp)[SPARC_MC_G1]));
565     __put_user(env->gregs[2], &((*grp)[SPARC_MC_G2]));
566     __put_user(env->gregs[3], &((*grp)[SPARC_MC_G3]));
567     __put_user(env->gregs[4], &((*grp)[SPARC_MC_G4]));
568     __put_user(env->gregs[5], &((*grp)[SPARC_MC_G5]));
569     __put_user(env->gregs[6], &((*grp)[SPARC_MC_G6]));
570     __put_user(env->gregs[7], &((*grp)[SPARC_MC_G7]));
571 
572     /*
573      * Note that unlike the kernel, we didn't need to mess with the
574      * guest register window state to save it into a pt_regs to run
575      * the kernel. So for us the guest's O regs are still in WREG_O*
576      * (unlike the kernel which has put them in UREG_I* in a pt_regs)
577      * and the fp and i7 are still in WREG_I6 and WREG_I7 and don't
578      * need to be fished out of userspace memory.
579      */
580     __put_user(env->regwptr[WREG_O0], &((*grp)[SPARC_MC_O0]));
581     __put_user(env->regwptr[WREG_O1], &((*grp)[SPARC_MC_O1]));
582     __put_user(env->regwptr[WREG_O2], &((*grp)[SPARC_MC_O2]));
583     __put_user(env->regwptr[WREG_O3], &((*grp)[SPARC_MC_O3]));
584     __put_user(env->regwptr[WREG_O4], &((*grp)[SPARC_MC_O4]));
585     __put_user(env->regwptr[WREG_O5], &((*grp)[SPARC_MC_O5]));
586     __put_user(env->regwptr[WREG_O6], &((*grp)[SPARC_MC_O6]));
587     __put_user(env->regwptr[WREG_O7], &((*grp)[SPARC_MC_O7]));
588 
589     __put_user(env->regwptr[WREG_FP], &(mcp->mc_fp));
590     __put_user(env->regwptr[WREG_I7], &(mcp->mc_i7));
591 
592     /*
593      * We don't write out the FPU state. This matches the kernel's
594      * implementation (which has the code for doing this but
595      * hidden behind an "if (fenab)" where fenab is always 0).
596      */
597 
598     unlock_user_struct(ucp, ucp_addr, 1);
599     return;
600 do_sigsegv:
601     unlock_user_struct(ucp, ucp_addr, 1);
602     force_sig(TARGET_SIGSEGV);
603 }
604 #endif
605