fix build error in xUbuntu_19.10
[tools/qemu-arm-static.git] / user-exec.c
1 /*
2  *  User emulator execution
3  *
4  *  Copyright (c) 2003-2005 Fabrice Bellard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18  */
19 #include "config.h"
20 #include "cpu.h"
21 #include "disas/disas.h"
22 #include "tcg.h"
23 #include "qemu/bitops.h"
24
25 #undef EAX
26 #undef ECX
27 #undef EDX
28 #undef EBX
29 #undef ESP
30 #undef EBP
31 #undef ESI
32 #undef EDI
33 #undef EIP
34 #include <signal.h>
35 #ifdef __linux__
36 #include <sys/ucontext.h>
37 #endif
38
39 //#define DEBUG_SIGNAL
40
41 static void exception_action(CPUArchState *env1)
42 {
43 #if defined(TARGET_I386)
44     raise_exception_err(env1, env1->exception_index, env1->error_code);
45 #else
46     cpu_loop_exit(env1);
47 #endif
48 }
49
50 /* exit the current TB from a signal handler. The host registers are
51    restored in a state compatible with the CPU emulator
52  */
53 void cpu_resume_from_signal(CPUArchState *env1, void *puc)
54 {
55 #ifdef __linux__
56    // struct ucontext *uc = puc;
57    // Use typdef struct ucontext {...}ucontext_t in others distro,
58    // But use typedef struct ucontext_t {...}ucontext_t.
59    // So need to use unified define ucontext_t.
60       ucontext_t *uc = puc;
61 #elif defined(__OpenBSD__)
62     struct sigcontext *uc = puc;
63 #endif
64
65     if (puc) {
66         /* XXX: use siglongjmp ? */
67 #ifdef __linux__
68 #ifdef __ia64
69         sigprocmask(SIG_SETMASK, (sigset_t *)&uc->uc_sigmask, NULL);
70 #else
71         sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL);
72 #endif
73 #elif defined(__OpenBSD__)
74         sigprocmask(SIG_SETMASK, &uc->sc_mask, NULL);
75 #endif
76     }
77     env1->exception_index = -1;
78     siglongjmp(env1->jmp_env, 1);
79 }
80
81 /* 'pc' is the host PC at which the exception was raised. 'address' is
82    the effective address of the memory exception. 'is_write' is 1 if a
83    write caused the exception and otherwise 0'. 'old_set' is the
84    signal set which should be restored */
85 static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
86                                     int is_write, sigset_t *old_set,
87                                     void *puc)
88 {
89     CPUArchState *env;
90     int ret;
91
92 #if defined(DEBUG_SIGNAL)
93     qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
94                 pc, address, is_write, *(unsigned long *)old_set);
95 #endif
96     /* XXX: locking issue */
97     if (is_write && h2g_valid(address)
98         && page_unprotect(h2g(address), pc, puc)) {
99         return 1;
100     }
101
102     /* Convert forcefully to guest address space, invalid addresses
103        are still valid segv ones */
104     address = h2g_nocheck(address);
105
106     env = current_cpu->env_ptr;
107     /* see if it is an MMU fault */
108     ret = cpu_handle_mmu_fault(env, address, is_write, MMU_USER_IDX);
109     if (ret < 0) {
110         return 0; /* not an MMU fault */
111     }
112     if (ret == 0) {
113         return 1; /* the MMU fault was handled without causing real CPU fault */
114     }
115     /* now we have a real cpu fault */
116     cpu_restore_state(env, pc);
117
118     /* we restore the process signal mask as the sigreturn should
119        do it (XXX: use sigsetjmp) */
120     sigprocmask(SIG_SETMASK, old_set, NULL);
121     exception_action(env);
122
123     /* never comes here */
124     return 1;
125 }
126
127 #if defined(__i386__)
128
129 #if defined(__APPLE__)
130 #include <sys/ucontext.h>
131
132 #define EIP_sig(context)  (*((unsigned long *)&(context)->uc_mcontext->ss.eip))
133 #define TRAP_sig(context)    ((context)->uc_mcontext->es.trapno)
134 #define ERROR_sig(context)   ((context)->uc_mcontext->es.err)
135 #define MASK_sig(context)    ((context)->uc_sigmask)
136 #elif defined(__NetBSD__)
137 #include <ucontext.h>
138
139 #define EIP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_EIP])
140 #define TRAP_sig(context)    ((context)->uc_mcontext.__gregs[_REG_TRAPNO])
141 #define ERROR_sig(context)   ((context)->uc_mcontext.__gregs[_REG_ERR])
142 #define MASK_sig(context)    ((context)->uc_sigmask)
143 #elif defined(__FreeBSD__) || defined(__DragonFly__)
144 #include <ucontext.h>
145
146 #define EIP_sig(context)  (*((unsigned long *)&(context)->uc_mcontext.mc_eip))
147 #define TRAP_sig(context)    ((context)->uc_mcontext.mc_trapno)
148 #define ERROR_sig(context)   ((context)->uc_mcontext.mc_err)
149 #define MASK_sig(context)    ((context)->uc_sigmask)
150 #elif defined(__OpenBSD__)
151 #define EIP_sig(context)     ((context)->sc_eip)
152 #define TRAP_sig(context)    ((context)->sc_trapno)
153 #define ERROR_sig(context)   ((context)->sc_err)
154 #define MASK_sig(context)    ((context)->sc_mask)
155 #else
156 #define EIP_sig(context)     ((context)->uc_mcontext.gregs[REG_EIP])
157 #define TRAP_sig(context)    ((context)->uc_mcontext.gregs[REG_TRAPNO])
158 #define ERROR_sig(context)   ((context)->uc_mcontext.gregs[REG_ERR])
159 #define MASK_sig(context)    ((context)->uc_sigmask)
160 #endif
161
162 int cpu_signal_handler(int host_signum, void *pinfo,
163                        void *puc)
164 {
165     siginfo_t *info = pinfo;
166 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
167     ucontext_t *uc = puc;
168 #elif defined(__OpenBSD__)
169     struct sigcontext *uc = puc;
170 #else
171     ucontext_t *uc = puc;
172 #endif
173     unsigned long pc;
174     int trapno;
175
176 #ifndef REG_EIP
177 /* for glibc 2.1 */
178 #define REG_EIP    EIP
179 #define REG_ERR    ERR
180 #define REG_TRAPNO TRAPNO
181 #endif
182     pc = EIP_sig(uc);
183     trapno = TRAP_sig(uc);
184     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
185                              trapno == 0xe ?
186                              (ERROR_sig(uc) >> 1) & 1 : 0,
187                              &MASK_sig(uc), puc);
188 }
189
190 #elif defined(__x86_64__)
191
192 #ifdef __NetBSD__
193 #define PC_sig(context)       _UC_MACHINE_PC(context)
194 #define TRAP_sig(context)     ((context)->uc_mcontext.__gregs[_REG_TRAPNO])
195 #define ERROR_sig(context)    ((context)->uc_mcontext.__gregs[_REG_ERR])
196 #define MASK_sig(context)     ((context)->uc_sigmask)
197 #elif defined(__OpenBSD__)
198 #define PC_sig(context)       ((context)->sc_rip)
199 #define TRAP_sig(context)     ((context)->sc_trapno)
200 #define ERROR_sig(context)    ((context)->sc_err)
201 #define MASK_sig(context)     ((context)->sc_mask)
202 #elif defined(__FreeBSD__) || defined(__DragonFly__)
203 #include <ucontext.h>
204
205 #define PC_sig(context)  (*((unsigned long *)&(context)->uc_mcontext.mc_rip))
206 #define TRAP_sig(context)     ((context)->uc_mcontext.mc_trapno)
207 #define ERROR_sig(context)    ((context)->uc_mcontext.mc_err)
208 #define MASK_sig(context)     ((context)->uc_sigmask)
209 #else
210 #define PC_sig(context)       ((context)->uc_mcontext.gregs[REG_RIP])
211 #define TRAP_sig(context)     ((context)->uc_mcontext.gregs[REG_TRAPNO])
212 #define ERROR_sig(context)    ((context)->uc_mcontext.gregs[REG_ERR])
213 #define MASK_sig(context)     ((context)->uc_sigmask)
214 #endif
215
216 int cpu_signal_handler(int host_signum, void *pinfo,
217                        void *puc)
218 {
219     siginfo_t *info = pinfo;
220     unsigned long pc;
221 #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
222     ucontext_t *uc = puc;
223 #elif defined(__OpenBSD__)
224     struct sigcontext *uc = puc;
225 #else
226     ucontext_t *uc = puc;
227 #endif
228
229     pc = PC_sig(uc);
230     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
231                              TRAP_sig(uc) == 0xe ?
232                              (ERROR_sig(uc) >> 1) & 1 : 0,
233                              &MASK_sig(uc), puc);
234 }
235
236 #elif defined(_ARCH_PPC)
237
238 /***********************************************************************
239  * signal context platform-specific definitions
240  * From Wine
241  */
242 #ifdef linux
243 /* All Registers access - only for local access */
244 #define REG_sig(reg_name, context)              \
245     ((context)->uc_mcontext.regs->reg_name)
246 /* Gpr Registers access  */
247 #define GPR_sig(reg_num, context)              REG_sig(gpr[reg_num], context)
248 /* Program counter */
249 #define IAR_sig(context)                       REG_sig(nip, context)
250 /* Machine State Register (Supervisor) */
251 #define MSR_sig(context)                       REG_sig(msr, context)
252 /* Count register */
253 #define CTR_sig(context)                       REG_sig(ctr, context)
254 /* User's integer exception register */
255 #define XER_sig(context)                       REG_sig(xer, context)
256 /* Link register */
257 #define LR_sig(context)                        REG_sig(link, context)
258 /* Condition register */
259 #define CR_sig(context)                        REG_sig(ccr, context)
260
261 /* Float Registers access  */
262 #define FLOAT_sig(reg_num, context)                                     \
263     (((double *)((char *)((context)->uc_mcontext.regs + 48 * 4)))[reg_num])
264 #define FPSCR_sig(context) \
265     (*(int *)((char *)((context)->uc_mcontext.regs + (48 + 32 * 2) * 4)))
266 /* Exception Registers access */
267 #define DAR_sig(context)                       REG_sig(dar, context)
268 #define DSISR_sig(context)                     REG_sig(dsisr, context)
269 #define TRAP_sig(context)                      REG_sig(trap, context)
270 #endif /* linux */
271
272 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
273 #include <ucontext.h>
274 #define IAR_sig(context)               ((context)->uc_mcontext.mc_srr0)
275 #define MSR_sig(context)               ((context)->uc_mcontext.mc_srr1)
276 #define CTR_sig(context)               ((context)->uc_mcontext.mc_ctr)
277 #define XER_sig(context)               ((context)->uc_mcontext.mc_xer)
278 #define LR_sig(context)                ((context)->uc_mcontext.mc_lr)
279 #define CR_sig(context)                ((context)->uc_mcontext.mc_cr)
280 /* Exception Registers access */
281 #define DAR_sig(context)               ((context)->uc_mcontext.mc_dar)
282 #define DSISR_sig(context)             ((context)->uc_mcontext.mc_dsisr)
283 #define TRAP_sig(context)              ((context)->uc_mcontext.mc_exc)
284 #endif /* __FreeBSD__|| __FreeBSD_kernel__ */
285
286 #ifdef __APPLE__
287 #include <sys/ucontext.h>
288 typedef struct ucontext SIGCONTEXT;
289 /* All Registers access - only for local access */
290 #define REG_sig(reg_name, context)              \
291     ((context)->uc_mcontext->ss.reg_name)
292 #define FLOATREG_sig(reg_name, context)         \
293     ((context)->uc_mcontext->fs.reg_name)
294 #define EXCEPREG_sig(reg_name, context)         \
295     ((context)->uc_mcontext->es.reg_name)
296 #define VECREG_sig(reg_name, context)           \
297     ((context)->uc_mcontext->vs.reg_name)
298 /* Gpr Registers access */
299 #define GPR_sig(reg_num, context)              REG_sig(r##reg_num, context)
300 /* Program counter */
301 #define IAR_sig(context)                       REG_sig(srr0, context)
302 /* Machine State Register (Supervisor) */
303 #define MSR_sig(context)                       REG_sig(srr1, context)
304 #define CTR_sig(context)                       REG_sig(ctr, context)
305 /* Link register */
306 #define XER_sig(context)                       REG_sig(xer, context)
307 /* User's integer exception register */
308 #define LR_sig(context)                        REG_sig(lr, context)
309 /* Condition register */
310 #define CR_sig(context)                        REG_sig(cr, context)
311 /* Float Registers access */
312 #define FLOAT_sig(reg_num, context)             \
313     FLOATREG_sig(fpregs[reg_num], context)
314 #define FPSCR_sig(context)                      \
315     ((double)FLOATREG_sig(fpscr, context))
316 /* Exception Registers access */
317 /* Fault registers for coredump */
318 #define DAR_sig(context)                       EXCEPREG_sig(dar, context)
319 #define DSISR_sig(context)                     EXCEPREG_sig(dsisr, context)
320 /* number of powerpc exception taken */
321 #define TRAP_sig(context)                      EXCEPREG_sig(exception, context)
322 #endif /* __APPLE__ */
323
324 int cpu_signal_handler(int host_signum, void *pinfo,
325                        void *puc)
326 {
327     siginfo_t *info = pinfo;
328 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
329     ucontext_t *uc = puc;
330 #else
331     ucontext_t *uc = puc;
332 #endif
333     unsigned long pc;
334     int is_write;
335
336     pc = IAR_sig(uc);
337     is_write = 0;
338 #if 0
339     /* ppc 4xx case */
340     if (DSISR_sig(uc) & 0x00800000) {
341         is_write = 1;
342     }
343 #else
344     if (TRAP_sig(uc) != 0x400 && (DSISR_sig(uc) & 0x02000000)) {
345         is_write = 1;
346     }
347 #endif
348     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
349                              is_write, &uc->uc_sigmask, puc);
350 }
351
352 #elif defined(__alpha__)
353
354 int cpu_signal_handler(int host_signum, void *pinfo,
355                            void *puc)
356 {
357     siginfo_t *info = pinfo;
358     ucontext_t *uc = puc;
359     uint32_t *pc = uc->uc_mcontext.sc_pc;
360     uint32_t insn = *pc;
361     int is_write = 0;
362
363     /* XXX: need kernel patch to get write flag faster */
364     switch (insn >> 26) {
365     case 0x0d: /* stw */
366     case 0x0e: /* stb */
367     case 0x0f: /* stq_u */
368     case 0x24: /* stf */
369     case 0x25: /* stg */
370     case 0x26: /* sts */
371     case 0x27: /* stt */
372     case 0x2c: /* stl */
373     case 0x2d: /* stq */
374     case 0x2e: /* stl_c */
375     case 0x2f: /* stq_c */
376         is_write = 1;
377     }
378
379     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
380                              is_write, &uc->uc_sigmask, puc);
381 }
382 #elif defined(__sparc__)
383
384 int cpu_signal_handler(int host_signum, void *pinfo,
385                        void *puc)
386 {
387     siginfo_t *info = pinfo;
388     int is_write;
389     uint32_t insn;
390 #if !defined(__arch64__) || defined(CONFIG_SOLARIS)
391     uint32_t *regs = (uint32_t *)(info + 1);
392     void *sigmask = (regs + 20);
393     /* XXX: is there a standard glibc define ? */
394     unsigned long pc = regs[1];
395 #else
396 #ifdef __linux__
397     struct sigcontext *sc = puc;
398     unsigned long pc = sc->sigc_regs.tpc;
399     void *sigmask = (void *)sc->sigc_mask;
400 #elif defined(__OpenBSD__)
401     struct sigcontext *uc = puc;
402     unsigned long pc = uc->sc_pc;
403     void *sigmask = (void *)(long)uc->sc_mask;
404 #endif
405 #endif
406
407     /* XXX: need kernel patch to get write flag faster */
408     is_write = 0;
409     insn = *(uint32_t *)pc;
410     if ((insn >> 30) == 3) {
411         switch ((insn >> 19) & 0x3f) {
412         case 0x05: /* stb */
413         case 0x15: /* stba */
414         case 0x06: /* sth */
415         case 0x16: /* stha */
416         case 0x04: /* st */
417         case 0x14: /* sta */
418         case 0x07: /* std */
419         case 0x17: /* stda */
420         case 0x0e: /* stx */
421         case 0x1e: /* stxa */
422         case 0x24: /* stf */
423         case 0x34: /* stfa */
424         case 0x27: /* stdf */
425         case 0x37: /* stdfa */
426         case 0x26: /* stqf */
427         case 0x36: /* stqfa */
428         case 0x25: /* stfsr */
429         case 0x3c: /* casa */
430         case 0x3e: /* casxa */
431             is_write = 1;
432             break;
433         }
434     }
435     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
436                              is_write, sigmask, NULL);
437 }
438
439 #elif defined(__arm__)
440
441 int cpu_signal_handler(int host_signum, void *pinfo,
442                        void *puc)
443 {
444     siginfo_t *info = pinfo;
445     ucontext_t *uc = puc;
446     unsigned long pc;
447     int is_write;
448
449 #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 3))
450     pc = uc->uc_mcontext.gregs[R15];
451 #else
452     pc = uc->uc_mcontext.arm_pc;
453 #endif
454
455     /* error_code is the FSR value, in which bit 11 is WnR (assuming a v6 or
456      * later processor; on v5 we will always report this as a read).
457      */
458     is_write = extract32(uc->uc_mcontext.error_code, 11, 1);
459     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
460                              is_write,
461                              &uc->uc_sigmask, puc);
462 }
463
464 #elif defined(__aarch64__)
465
466 int cpu_signal_handler(int host_signum, void *pinfo,
467                        void *puc)
468 {
469     siginfo_t *info = pinfo;
470     ucontext_t *uc = puc;
471     uint64_t pc;
472     int is_write = 0; /* XXX how to determine? */
473
474     pc = uc->uc_mcontext.pc;
475     return handle_cpu_signal(pc, (uint64_t)info->si_addr,
476                              is_write, &uc->uc_sigmask, puc);
477 }
478
479 #elif defined(__mc68000)
480
481 int cpu_signal_handler(int host_signum, void *pinfo,
482                        void *puc)
483 {
484     siginfo_t *info = pinfo;
485     ucontext_t *uc = puc;
486     unsigned long pc;
487     int is_write;
488
489     pc = uc->uc_mcontext.gregs[16];
490     /* XXX: compute is_write */
491     is_write = 0;
492     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
493                              is_write,
494                              &uc->uc_sigmask, puc);
495 }
496
497 #elif defined(__ia64)
498
499 #ifndef __ISR_VALID
500   /* This ought to be in <bits/siginfo.h>... */
501 # define __ISR_VALID    1
502 #endif
503
504 int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
505 {
506     siginfo_t *info = pinfo;
507     ucontext_t *uc = puc;
508     unsigned long ip;
509     int is_write = 0;
510
511     ip = uc->uc_mcontext.sc_ip;
512     switch (host_signum) {
513     case SIGILL:
514     case SIGFPE:
515     case SIGSEGV:
516     case SIGBUS:
517     case SIGTRAP:
518         if (info->si_code && (info->si_segvflags & __ISR_VALID)) {
519             /* ISR.W (write-access) is bit 33:  */
520             is_write = (info->si_isr >> 33) & 1;
521         }
522         break;
523
524     default:
525         break;
526     }
527     return handle_cpu_signal(ip, (unsigned long)info->si_addr,
528                              is_write,
529                              (sigset_t *)&uc->uc_sigmask, puc);
530 }
531
532 #elif defined(__s390__)
533
534 int cpu_signal_handler(int host_signum, void *pinfo,
535                        void *puc)
536 {
537     siginfo_t *info = pinfo;
538     ucontext_t *uc = puc;
539     unsigned long pc;
540     uint16_t *pinsn;
541     int is_write = 0;
542
543     pc = uc->uc_mcontext.psw.addr;
544
545     /* ??? On linux, the non-rt signal handler has 4 (!) arguments instead
546        of the normal 2 arguments.  The 3rd argument contains the "int_code"
547        from the hardware which does in fact contain the is_write value.
548        The rt signal handler, as far as I can tell, does not give this value
549        at all.  Not that we could get to it from here even if it were.  */
550     /* ??? This is not even close to complete, since it ignores all
551        of the read-modify-write instructions.  */
552     pinsn = (uint16_t *)pc;
553     switch (pinsn[0] >> 8) {
554     case 0x50: /* ST */
555     case 0x42: /* STC */
556     case 0x40: /* STH */
557         is_write = 1;
558         break;
559     case 0xc4: /* RIL format insns */
560         switch (pinsn[0] & 0xf) {
561         case 0xf: /* STRL */
562         case 0xb: /* STGRL */
563         case 0x7: /* STHRL */
564             is_write = 1;
565         }
566         break;
567     case 0xe3: /* RXY format insns */
568         switch (pinsn[2] & 0xff) {
569         case 0x50: /* STY */
570         case 0x24: /* STG */
571         case 0x72: /* STCY */
572         case 0x70: /* STHY */
573         case 0x8e: /* STPQ */
574         case 0x3f: /* STRVH */
575         case 0x3e: /* STRV */
576         case 0x2f: /* STRVG */
577             is_write = 1;
578         }
579         break;
580     }
581     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
582                              is_write, &uc->uc_sigmask, puc);
583 }
584
585 #elif defined(__mips__)
586
587 int cpu_signal_handler(int host_signum, void *pinfo,
588                        void *puc)
589 {
590     siginfo_t *info = pinfo;
591     ucontext_t *uc = puc;
592     greg_t pc = uc->uc_mcontext.pc;
593     int is_write;
594
595     /* XXX: compute is_write */
596     is_write = 0;
597     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
598                              is_write, &uc->uc_sigmask, puc);
599 }
600
601 #elif defined(__hppa__)
602
603 int cpu_signal_handler(int host_signum, void *pinfo,
604                        void *puc)
605 {
606     siginfo_t *info = pinfo;
607     ucontext_t *uc = puc;
608     unsigned long pc = uc->uc_mcontext.sc_iaoq[0];
609     uint32_t insn = *(uint32_t *)pc;
610     int is_write = 0;
611
612     /* XXX: need kernel patch to get write flag faster.  */
613     switch (insn >> 26) {
614     case 0x1a: /* STW */
615     case 0x19: /* STH */
616     case 0x18: /* STB */
617     case 0x1b: /* STWM */
618         is_write = 1;
619         break;
620
621     case 0x09: /* CSTWX, FSTWX, FSTWS */
622     case 0x0b: /* CSTDX, FSTDX, FSTDS */
623         /* Distinguish from coprocessor load ... */
624         is_write = (insn >> 9) & 1;
625         break;
626
627     case 0x03:
628         switch ((insn >> 6) & 15) {
629         case 0xa: /* STWS */
630         case 0x9: /* STHS */
631         case 0x8: /* STBS */
632         case 0xe: /* STWAS */
633         case 0xc: /* STBYS */
634             is_write = 1;
635         }
636         break;
637     }
638
639     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
640                              is_write, &uc->uc_sigmask, puc);
641 }
642
643 #else
644
645 #error host CPU specific signal handler needed
646
647 #endif
648