Merge remote-tracking branch 'battery/master'
[linux-2.6/next.git] / arch / um / sys-ppc / shared / sysdep / sigcontext.h
blobb7286f0a1e00dd40a7221e02322389b7e5812201
1 /*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #ifndef __SYS_SIGCONTEXT_PPC_H
7 #define __SYS_SIGCONTEXT_PPC_H
9 #define DSISR_WRITE 0x02000000
11 #define SC_FAULT_ADDR(sc) ({ \
12 struct sigcontext *_sc = (sc); \
13 long retval = -1; \
14 switch (_sc->regs->trap) { \
15 case 0x300: \
16 /* data exception */ \
17 retval = _sc->regs->dar; \
18 break; \
19 case 0x400: \
20 /* instruction exception */ \
21 retval = _sc->regs->nip; \
22 break; \
23 default: \
24 panic("SC_FAULT_ADDR: unhandled trap type\n"); \
25 } \
26 retval; \
29 #define SC_FAULT_WRITE(sc) ({ \
30 struct sigcontext *_sc = (sc); \
31 long retval = -1; \
32 switch (_sc->regs->trap) { \
33 case 0x300: \
34 /* data exception */ \
35 retval = !!(_sc->regs->dsisr & DSISR_WRITE); \
36 break; \
37 case 0x400: \
38 /* instruction exception: not a write */ \
39 retval = 0; \
40 break; \
41 default: \
42 panic("SC_FAULT_ADDR: unhandled trap type\n"); \
43 } \
44 retval; \
47 #define SC_IP(sc) ((sc)->regs->nip)
48 #define SC_SP(sc) ((sc)->regs->gpr[1])
49 #define SEGV_IS_FIXABLE(sc) (1)
51 #endif