Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sigcontext.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000 Jeff Dike ([email protected])
3  * Licensed under the GPL
4  */
5 
6 #ifndef __SYS_SIGCONTEXT_PPC_H
7 #define __SYS_SIGCONTEXT_PPC_H
8 
9 #define DSISR_WRITE 0x02000000
10 
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; \
27  })
28 
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; \
45  })
46 
47 #define SC_IP(sc) ((sc)->regs->nip)
48 #define SC_SP(sc) ((sc)->regs->gpr[1])
49 #define SEGV_IS_FIXABLE(sc) (1)
50 
51 #endif
52